Open fabiolnh opened 12 months ago
More information: all the tests are locally, using localstack (free)
Same as https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/4788
For this to work instrumentation for spring SqsListener
is needed. Also note that the free version of localstack does not propagate AWSTraceHeader
message system attribute that is, by default, used to propagate the trace through sqs. For trace propagation on localstack -Dotel.instrumentation.aws-sdk.experimental-use-propagator-for-messaging=true
could help, but it won't help with having the trace available in SqsListener
.
Describe the bug
I have two services:
Service A: SNS Sender (Using SDK v2 AWS), Spring Boot 2, Java 17, Agent Version 1.30.0 Service B: SQS Listener, Spring Boot 3, Java 17, Agent Version 1.30.0
Docker-compose:
The structure:
Service A -> SNS -> SQS -> Service B
Dockerfile Service A:
Service B:
I tested 3 endpoints:
1) Rest (Working) 2) GRPC (Working) 3) SNS/SQS (Tracing Between Services appears in Jaeger, however, the MDC Log (trace_id and span_id) is empty in Service B (using @SqsConsumer), So I cannot log the trace, which is pretty important)
I tried to implement Manual Instrumentation, importing the libs into the Service B (Micrometer and Open Telemetry), but it does not work, too. (It works with Rest and GRPC, but with SQS does not)
It seems to be something related with Asynchronous communication.
Is there an issue? Or I am doing something wrong? I would appreciate a help.
Libs that I am using in Service B:
Class SqsConsumer in Service B:
log4j2.xml:
Steps to reproduce
Create 2 Services With Java and SpringBoot using the following components:
Service A: SNS Sender (Using SDK v2 AWS), Spring Boot 2, Java 17, Agent Version 1.30.0 Service B: SQS Listener, Spring Boot 3, Java 17, Agent Version 1.30.0
Implement Log4j with the following layout:
Try to communicate through SNS/SQS between them and check the Log
Trace_id and span_id are empty.
Expected behavior
It should show the trace_id and the span_id on the log
Actual behavior
Log in Service B is shown this way:
Javaagent or library instrumentation version
1.30.0
Environment
JDK: 17 OS: MacOS (however, I am running through both servers through Docker)
Additional context
I think there are no more information to provide. If there is some question, please, ask to me that I will be glad to answer. Thank you all.