-
Notifications
You must be signed in to change notification settings - Fork 150
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
Sqs distributed trace #2204
Sqs distributed trace #2204
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2204 +/- ##
============================================
- Coverage 70.73% 70.56% -0.17%
+ Complexity 10046 9974 -72
============================================
Files 842 842
Lines 40493 40374 -119
Branches 6151 6119 -32
============================================
- Hits 28641 28490 -151
- Misses 9098 9107 +9
- Partials 2754 2777 +23 ☔ View full report in Codecov by Sentry. |
Class loading errors in instrumentation tests forced me to use inner classes for DT Header classes |
...java-sdk-sqs-1.10.44/src/main/java/com/amazonaws/services/sqs/AmazonSQS_Instrumentation.java
Outdated
Show resolved
Hide resolved
...java-sdk-sqs-1.10.44/src/main/java/com/amazonaws/services/sqs/AmazonSQS_Instrumentation.java
Outdated
Show resolved
Hide resolved
* Headers are used as inner classes to avoid class loading errors when running instrumentation tests | ||
* */ | ||
|
||
public class SQSRequestHeaders implements Headers { |
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.
Move this inner class to its own file and use the same on the async client.
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.
Problem here is when I did that, I got class-loading errors when running instrumentation tests. I suspect its some magic the SDK is using with classloaders that did not mesh well with the agent. This was the one way I got it to work.
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.
You need to add the package that has the header classes to the @InstrumentationTestConfig
In this case it would look like:
@InstrumentationTestConfig(includePrefixes = { "software.amazon.awssdk.services.sqs", "com.newrelic.utils" }, configName = "dt_enabled.yml")
(if you put the header classes in the same package as the other classes in the module)
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 the suggestion. I moved the header classes and the tests pass now.
...src/main/java/software/amazon/awssdk/services/sqs/DefaultSqsAsyncClient_Instrumentation.java
Outdated
Show resolved
Hide resolved
...src/main/java/software/amazon/awssdk/services/sqs/DefaultSqsAsyncClient_Instrumentation.java
Outdated
Show resolved
Hide resolved
…zonaws/services/sqs/AmazonSQS_Instrumentation.java Co-authored-by: André Onuki <[email protected]>
…java-agent into sqs-distributed-trace
Overview
Adds distributed trace headers as message attributes for SQS send operations.
(Edit: Distributed tracing is only supported in the v2 sdks for SQS. See the new PR that removed sqs changes for the v1 sdk)
Related Github Issue
#2036