Conversation
The WebMock instrumentation for Typhoeus::Hydra didn't work anymore with the patches Restify added to it's Hydra object to keep track of the OTEL context. The patched removed the callback behavior in Hydra that was used by WebMock. This commit fixes that by keeping tracking of the OTEL context with the Typhoeus request itself, restoring the context when Hydra actually adds the request. Otherwise, the same code is called as before and callbacks will work again too. The WebMock support is further expanded to catch exception and bubble them up to the promise, e.g. when request ain't allowed. Before, they only stopped the background thread, and promises run into a timeout. Now, whenever an exception is raised to a specific request, it will instead reject the Promise of that request. Lastly, the commit adds specs for the WebMock integration as well as the working OTEL context propagation.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #66 +/- ##
==========================================
+ Coverage 95.87% 95.88% +0.01%
==========================================
Files 21 21
Lines 678 681 +3
==========================================
+ Hits 650 653 +3
Misses 28 28 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The WebMock instrumentation for Typhoeus::Hydra didn't work anymore with the patches Restify added to its Hydra object to keep track of the OTEL context. The patched removed the callback behavior in Hydra that was used by WebMock.
This commit fixes that by keeping tracking of the OTEL context with the Typhoeus request itself, restoring the context when Hydra actually adds the request. Otherwise, the same code is called as before and callbacks will work again too.
The WebMock support is further expanded to catch exceptions and bubble them up to the promise, e.g. when request ain't allowed. Before, they only stopped the background thread, and promises run into a timeout. Now, whenever an exception is raised to a specific request, it will instead reject the Promise of that request.
Lastly, the commit adds specs for the WebMock integration as well as the working OTEL context propagation.