-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Expected Behavior
Propagation of traces to SQS messages is not working.
Using the following config:
otel:
register:
global: true
javaagent:
debug: true
propagators: tracecontext,baggage
traces:
exporter: logging
instrumentation:
messaging:
experimental:
receive-telemetry:
enabled: true
aws-sdk:
experimental-use-propagator-for-messaging: true
experimental-span-attributes: true
I would expect to be able to pass the traceId to the message attributes. However, even though traces are availables in my logs:
INFO: 'test-sqs-queue-name publish' : 4868b868b771d46a7db7ad00b63feb8d f009ef0728c09e05 PRODUCER [tracer: io.opentelemetry.aws-sdk-2.2:1.33.5-alpha] AttributesMap{data={aws.queue.url=http://sqs.us-east-1.localhost:4566/000000000000/test-sqs-queue-name, http.url=http://127.0.0.1:35113/, messaging.destination.name=test-sqs-queue-name, messaging.operation=publish, http.request_content_length=208, rpc.system=aws-api, messaging.system=AmazonSQS, rpc.service=Sqs, net.peer.port=35113, messaging.message.id=f90b76cb-f3f3-4d66-8aa5-6f6ddb424a01, http.method=POST, net.peer.name=127.0.0.1, http.status_code=200, rpc.method=SendMessage, http.response_content_length=171}, capacity=128, totalAddedValues=15}
They are not propagated to the message itself.
According to the documentation
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/aws-sdk/aws-sdk-2.2/library/README.md
for sqs in addition to adding ExecutionInterceptor you also need:
For SQS an additional step is needed
SqsClientBuilder sqsClientBuilder = SqsClient.builder();
...
SqsClient sqsClient = telemetry.wrap(sqsClientBuilder.build());
SqsAsyncClientBuilder sqsAsyncClientBuilder = SqsAsyncClient.builder();
...
SqsAsyncClient sqsAsyncClient = telemetry.wrap(sqsAsyncClientBuilder.build());
I don't see you setting this, which might explain the issue
Actual Behaviour
traces should be propagated to message attributes
Steps To Reproduce
Use following config
otel:
register:
global: true
javaagent:
debug: true
propagators: tracecontext,baggage
traces:
exporter: logging
instrumentation:
messaging:
experimental:
receive-telemetry:
enabled: true
aws-sdk:
experimental-use-propagator-for-messaging: true
experimental-span-attributes: true
Create a SQS queue listener and send a message through SQSClient ( sqsClient.sendMessage(sendMessageRequest);)
Environment Information
JDK17
MAC
Example Application
No response
Version
4.7.6