Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apache http client fix exception handling #417

Merged
merged 12 commits into from Aug 1, 2018

Conversation

mar-kolya
Copy link
Contributor

@mar-kolya mar-kolya commented Jul 30, 2018

This should improve how 'hard' cases like redirects and errors are handled by apache http client instrumentation.

@mar-kolya mar-kolya added the tag: do not merge Do not merge changes label Jul 30, 2018
@mar-kolya mar-kolya added this to the 0.12.0 milestone Jul 30, 2018
@mar-kolya mar-kolya added type: bug inst: others All other instrumentations labels Jul 30, 2018
@mar-kolya mar-kolya force-pushed the mar-kolya/apache-http-client-fix-exception-handling branch 3 times, most recently from 64e61af to 020a168 Compare July 30, 2018 22:05
* @see net.bytebuddy.matcher.HasSuperTypeMatcher
*/
@HashCodeAndEqualsPlugin.Enhance
public static class SafeHasSuperTypeMatcher<T extends TypeDescription>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include in your comment how this is different from the SuperTypeMatcher that is built into byte buddy?

Also describe how this is different from using failSafe(hasSuperType(...)).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fixed now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much better.

@mar-kolya mar-kolya force-pushed the mar-kolya/apache-http-client-fix-exception-handling branch 2 times, most recently from 5b5a4dd to 86af4fe Compare July 31, 2018 01:58
@mar-kolya mar-kolya removed the tag: do not merge Do not merge changes label Jul 31, 2018
@mar-kolya mar-kolya force-pushed the mar-kolya/apache-http-client-fix-exception-handling branch from 86af4fe to 982d346 Compare July 31, 2018 02:43
@mar-kolya mar-kolya changed the title Mar kolya/apache http client fix exception handling Apache http client fix exception handling Jul 31, 2018
@mar-kolya mar-kolya force-pushed the mar-kolya/apache-http-client-fix-exception-handling branch from 982d346 to a4238aa Compare July 31, 2018 03:28
@tylerbenson
Copy link
Contributor

I tested this branch using the sample app @htmldoug provided in reference to #410 and it seems to solve the problem in a better way than what I did. I've fixed my pr #411 to revert the part that this PR fixes.

Copy link
Contributor

@gary-huang gary-huang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! This and #411 should instrument Spring Boot!

*/
public static <T extends TypeDescription> ElementMatcher.Junction<T> safeHasSuperType(
final ElementMatcher<? super TypeDescription> matcher) {
// return hasSuperType(matcher);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line not needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Removed.

Copy link
Contributor

@realark realark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(hold merge until after 0.2.12 release)

@realark realark modified the milestones: 0.12.0, 0.13.0 Jul 31, 2018
This makes sure no classes are loaded during instrumentation
transformation which allows us to safely instrument depndent classes.
This allows ByteBuddy to properly find classes injected into the
agent.

Thanks @realark for providing a fix!
It should not be necessary after we jave fixed class location issue
for ByteBuddy
Properly open and close outer span in multi-request cases
The idea is to just 'trim' type hierarchy 'up-trees' that we cannot
resolve dring instrumentation instead of failing to instrument completely.
We not longer need it since our instrumentation can handle underlying
loading problem.
`isSubType` may fail on certain class lookup problems, even on classes
unrelated to given instrumentation, preventing instrumentation from
being applied.
Newer ByteBuddy api simplifies things.
It looks like they fail tests from time to time
@mar-kolya mar-kolya force-pushed the mar-kolya/apache-http-client-fix-exception-handling branch from a4238aa to bb2126b Compare August 1, 2018 00:14
@mar-kolya mar-kolya merged commit 911ad5f into master Aug 1, 2018
@mar-kolya mar-kolya deleted the mar-kolya/apache-http-client-fix-exception-handling branch August 1, 2018 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inst: others All other instrumentations type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants