-
Notifications
You must be signed in to change notification settings - Fork 600
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
Ethon instrumentation #2260
Ethon instrumentation #2260
Conversation
add instrumentation for Ethon resolves #2187
- add Ethon instrumentation to default source - regenerate `newrelic.yml`
have the Ethon suite included in the http clients 2 list
2 of the shared HTTP client tests that Ethon was failing on have been re-enabled. The tests were failing because of a stray typo made in the shared tests file that had since been corrected.
- headers: seeing as we don't operate directly on the libcurl object, we need to propagate any added headers down to that object via `Ethon::Easy#headers=` - errors: use the `Tracer` wrapper around `yield` to automatically notice any errors With those changes, the 2 temporarily skipped tests are now enabled
- Define a response wrapper. It makes sense to have all HTTP client instrumentation follow this pattern. - Enable Ethon instrumentation while using Typhoeus. When Typhoeus engages with Ethon, the child nodes will show up where expected - Restore testing of the majority of cross HTTP client tests with Ethon
Response wrapper headers are different from request wrapper headers. Parse the response headers string to set the response wrapper headers properly
When `Ethon::Multi#perform` is invoked, create a parent segment for the `Ethon::Multi` instance and a child segment for each `Ethon::Easy` instance that exists in the `Ethon::Multi#easy_handles` array.
entry for Ethon instrumentation
Accommodate for both the Typhoeus and Ethon instrumentation being active at the same time (the default)
For an instance of `Ethon::Easy`, consider a `#return_code` result not equal to `:ok` to be the indicator of an error instead of the `#response_code` being equal to `0`. With direct Ethon usage, these equality checks seem interchangeable but with Typhoeus the underyling easy object is left with a 0 for its response code on success.
- pass 'Ethon::Easy' as a string to `prepend_instrument` to ensure that the gem's class name is referred to with the `::` bit intact - given that `Ethon::Easy` doesn't bother setting an HTTP action/verb in many cases and defers to Curl, let's just use `'GET'` as a default value - convert 'unknownhost' to 'UNKNOWN_HOST' to fit our naming standards
|
||
executes do | ||
if use_prepend? | ||
# NOTE: to prevent a string like 'Ethon::Easy' from being converted into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice comment I didn't know prepend_instrument
supported a 3rd arg
The shared http client tests will cover gleaning the host from the request headers. Tests have been added to test the other two branches for obtaining a host - the URI instance, and a default string value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing live ✨
After some extensive testing (thanks, @kaylareopelle) we've decided to disable Ethon instrumentation in the presence of Typhoeus. We already create `Typhoeus/GET` segments for each instance of `Typhoeus::Request` and seeing an additional `Ethon::Easy/GET` segment really just seems to duplicate the number of HTTP requests the app performed. Given that all of the information from an `Ethon::Easy/GET` segment is already contained in the `Typhoeus/GET` segment, it's better to prevent the duplication.
bbf0a2f
We've decided to disable Ethon instrumentation when Typhoeus is used and to allow the higher level segments to exist without confusion of seemingly duplicate lower level ones. Fix the shared test cases accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good to merge. I saw two small cleanup things.
- correct `prepend_instrumentation` comment - revert `typhoeus?` helper now that only a lone caller remains
Thanks very much! Cleanup addressed with 285de8a |
SimpleCov Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦅
add instrumentation for Ethon
resolves #2187