I'm trying to instrument SQS and I don't know what I'm doing wrong #15238
-
|
Hello community, First, some context: our applications are already instruments with Open Telemetry and we are getting traces for the out-of-the-box supported frameworks. We run Spring Boot applications on Java 21 and have a little bit of customization in place that unfortunately requires us to stay on 1.41 (or maybe slightly later; the dependency is on the The main thing we've been missing is trying to get trace data for the consumption side of interacting with SQS. We can see trace data when producing messages but that's far less useful than seeing what happens when it's consumed. The happy path would be having distributed tracing on both production and consumption of a message, but for the time being I'm trying to walk before I run. As far as I can tell, getting instrumentation working with SQS requires additional steps per this page: Also of note: another engineer on my team was playing around with this example with an AI tool and the tool called out that the code as written in the example was missing the execution intercepter configuration which looks to be the part that actually detects the consumption side. The code it suggested adding was: .overrideConfiguration(config -> config.addExecutionInterceptor(awsSdkTelemetry.newExecutionInterceptor()))Due to the dependency reasons I stated above with our internal tooling, I've been trying to get things to work with version 1.41 of the open telemetry library, 2.7.0 of the Java instrumentation, and 2.7.0-alpha of the instrumentation extensions. This process has largely left me in Maven dependency hell with no clear way out. When I first added this I encountered this issue: I tried to solve this by adding the It also appears I'm not the only person to have encountered this issue, but there's no comment or solution on the other instance I found: mockito/mockito#3342 Suffice to say, I feel like I'm completely misunderstanding something or doing something egregiously wrong here for reasons that aren't obvious to me. Any guidance on how to properly get SQS instrumentation in place on both the send and receive side would be very much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
The instructions in https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/aws-sdk/aws-sdk-2.2/library include: which, as far as I can tell, looks about the same as what your AI tool suggested. Just replace
it means that you are mixing dependencies from incompatible versions. Use
You could try examining our tests and create a toy application based on the test. If you get that working then perhaps you can figure out what is different in your real application. You could also try the agent instead of the library instrumentation to see whether it yields a better result. The test you could start from is response.messages().forEach().
|
Beta Was this translation helpful? Give feedback.
-
Ah, this was my mistake. I saw
This is where I'm maybe most confused then. I only started getting this after adding the aws-sdk instrumentation and added the tooling dependency because that's where I found AFAICT, version 1.41 of the main open telemetry libraries and 2.7.0/2.7.0-alpha of the instrumentation libraries appear to be compatible with each other if I look at the dependencies the poms declare. Is there a different dependency I should be using to have the aws-sdk-2.2 configuration in my classpath? |
Beta Was this translation helpful? Give feedback.
Firstly you appear to be using https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure this automatically set up the execution interceptor but it won't handle the wrapping of the sqs client that is described in https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/aws-sdk/aws-sdk-2.2/library#usage Secondly you are also using the agent or have included classes from the agent in your application. In later versions we have reworked the code so that this exception doesn't happen. For now you could try removing the
opentelemetry-aws-sdk-2.2-autoconfiguredependency and useo…