-
Notifications
You must be signed in to change notification settings - Fork 501
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
Instrumentation for SNS/ SQS #1613
Comments
Would the AWS client instrumentation work? |
I think that might trace the interaction with the SNS/SQS service, but it sounds like what's needed here is context propagation in messages carried by those services. Is that correct? If so, there are a few options. You could use the propagation API to inject trace context data into the messages at the producer and extract it at the consumer. This could also be done using message attributes instead of the message body. The second option would be to create a middleware for the AWS SDK v2 that could identify SQS requests/responses and handle the propagation automatically. Not quite sure how this would hand back an extracted span context to a consumer, but it might be an avenue worth exploring if you're using the v2 SDK. The third approach would be to wrap the SDK client, similar to the Sarama instrumentation. |
Thanks @Aneurysm9, I will need message propagation as well. I will look into the options provided. |
I have a very similar use-case to yours, @febinrejoe . Any advancement in your solution? Thank you! |
I am currently sketching this carrier to perform context propagation across SQS messages using message attributes. // ContextFromSqsMessageAttributes gets a tracing context from SQS message attributes.
// `sqsMessage` is incoming, received SQS message (possibly) carring trace information in the message attributes.
// Use ContextFromSqsMessageAttributes right after receiving an SQS message.
func ContextFromSqsMessageAttributes(sqsMessage *types.Message) context.Context
// InjectIntoSqsMessageAttributes inserts tracing from context into the SQS message attributes.
// `ctx` holds current context with trace information.
// `sqsMessage` is outgoing SQS message that will be set to carry trace information.
// Use InjectIntoSqsMessageAttributes right before sending out the SQS message.
func InjectIntoSqsMessageAttributes(ctx context.Context, sqsMessage *types.Message) https://pkg.go.dev/github.com/udhos/opentelemetry-trace-sqs@main/otelsqs It might be useful to some. |
Problem Statement
This could be more of a question rather than a feature request. I was wondering if we have a way to instrument Go for SNS/ SQS transactions. To give some background, I have a Go service (Service A) which talks to another service (Service B) via SQS and I would like to do tracing across these services. Any help with this will be greatly appreciated.
The text was updated successfully, but these errors were encountered: