Skip to content
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

Trace id for sqs messages is not propagated #12267

Open
aarrsseni opened this issue Sep 17, 2024 · 7 comments
Open

Trace id for sqs messages is not propagated #12267

aarrsseni opened this issue Sep 17, 2024 · 7 comments
Labels

Comments

@aarrsseni
Copy link

aarrsseni commented Sep 17, 2024

Describe the bug

I have service which is publishing sqs message to the queue and also is reading the message from this queue.
It's using javaagent and have opentelemetry-aws-sdk-2.2-autoconfigure dependency.
Parameters described here https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/aws-sdk/README.md are enabled as well.

I see that trace id is not propagated and there is no trace and span id at all after message consuming.

Steps to reproduce

Spring service publishes simple sqs message to the queue using spring-cloud-aws-sqs SqsTemplate. Consume the message using @SqsListener from spring-cloud-aws-sqs. Check the trace id before and after sending.

Expected behavior

Trace id and span id should be propagated and shouldn't be lost.

Actual behavior

Trace id and span id are lost after sending sqs message.

Javaagent or library instrumentation version

2.5.0

Environment

JDK: Temurin 17.0.7
OS: Alpine Linux
Spring: 6.1.10
opentelemetry-aws-sdk-2.2-autoconfigure: 2.7.0-alpha
spring-cloud-aws-sqs: 3.1.1

Additional context

No response

@aarrsseni aarrsseni added bug Something isn't working needs triage New issue that requires triage labels Sep 17, 2024
@laurit
Copy link
Contributor

laurit commented Sep 17, 2024

Since camel provides its own open telemetry integration you should seek assistance from the camel community. If you are able to reproduce this without using camel then please provide a minimal application that reproduces the issue along with any necessary instructions.

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label Sep 17, 2024
@aarrsseni
Copy link
Author

@laurit, thanks for the reply about camel.
I checked another service I have, which is not using Camel at all. I updated task description with the new case.
It's using spring-cloud-aws-sqs, do you know, has open telemetry support for it?
Should I configure something else?
In any way for now looks like there is not enough just to add one dependency and enable few flags to propagate trace id.

@github-actions github-actions bot removed the needs author feedback Waiting for additional feedback from the author label Sep 17, 2024
@laurit
Copy link
Contributor

laurit commented Sep 17, 2024

It's using javaagent and have opentelemetry-aws-sdk-2.2-autoconfigure dependency.

When using java agent you don't need to include opentelemetry-aws-sdk-2.2-autoconfigure.

Spring service publishes simple sqs message to the queue using spring-cloud-aws-sqs SqsTemplate. Consume the message using @SqsListener from spring-cloud-aws-sqs. Check the trace id before and after sending.

Please provide minimal application that reproduces the issue along with any instructions necessary.

@aarrsseni
Copy link
Author

@laurit, here is an example https://github.com/aarrsseni/demo-sqs-opentelemetry/tree/master/src/main.
I checked in my env and I had trace id for rest request but no trace id for sqs.
As I mentioned I'm using javaagent 2.5.0.
Now I haven't included any opentelemetry dependencies, only javaagent.

@laurit
Copy link
Contributor

laurit commented Sep 19, 2024

@aarrsseni your configuration https://github.com/aarrsseni/demo-sqs-opentelemetry/blob/73a79bbcb059f70ee244fc551d8b2ef642c20eeb/src/main/resources/application.yml#L9 sets endpoint to http://docker:4566 is that localstack? If it is localstack then as far as I know localstack propagates aws trace headers only in commercial version. Idk if that has changed. If that is the case see https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/aws-sdk/aws-sdk-2.2/library/README.md#trace-propagation there is an experimental option to use a different propagation mechanism. If it is not localstack then please elaborate what it is.

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label Sep 19, 2024
@aarrsseni
Copy link
Author

aarrsseni commented Sep 19, 2024

@laurit, yes, this is LocalStack in the example but I have the same configuration in the real env without LocalStack.
I've checked parameters described in the documentation as well but it didn't help.

Maybe you have an example of working solution to check the config or some more detailed documentation?

@github-actions github-actions bot removed the needs author feedback Waiting for additional feedback from the author label Sep 19, 2024
@laurit
Copy link
Contributor

laurit commented Sep 19, 2024

This will require instrumentation for @SqsListener. There is also #4788

@laurit laurit added enhancement New feature or request new instrumentation and removed bug Something isn't working needs repro needs triage New issue that requires triage labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants