Resolve Micronaut duplicate transactions/lost custom attributes issues - #3085
Draft
sharvath-newrelic wants to merge 2 commits into
Draft
Resolve Micronaut duplicate transactions/lost custom attributes issues#3085sharvath-newrelic wants to merge 2 commits into
sharvath-newrelic wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3085 +/- ##
============================================
- Coverage 70.92% 70.85% -0.07%
- Complexity 10681 10709 +28
============================================
Files 871 873 +2
Lines 43006 43135 +129
Branches 6503 6526 +23
============================================
+ Hits 30501 30565 +64
- Misses 9557 9611 +54
- Partials 2948 2959 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Overview
This PR aims to resolve a couple of issues where custom attributes and transaction names set from a
@ServerFilterwere being dropped, and requests sometimes produced two Transaction events for one HTTP call. Two areas have been addressed:PipeliningServerHandler_Instrumentation(all 5 micronaut-http-server-netty-4.x.0 modules): a change was made to callWeaver.callOriginal()before expiring the request token inchannelReadComplete(), not after, as expiring first let a synchronous mid-request dispatch run unlinked, which resulted in a phantom transaction.PropagatedContext_Instrumentation(micronaut-core-4.0.0 and 4.3.0): relink the transaction's token acrossPropagatedContext.wrap(Runnable/Callable), the hop Micronaut uses for@ExecuteOnthread offload. Backed by two small wrapper classes (NRTokenRunnableWrapper,NRTokenCallableWrapper).Related Github Issue
Resolves #3038 (awaiting potential feedback from user)
Testing
Unit tests have been added (JUnit + Mockito, mockito-inline for static mocking) covering both fixes: token-expiry ordering in the netty handler, and the wrap/relink behavior and its cases in
PropagatedContext_Instrumentationand its wrappers.Passing Micronaut AITs.