opentelemetry-rust icon indicating copy to clipboard operation
opentelemetry-rust copied to clipboard

[Feature Request] Expose functions in opentelemetry-aws to serialize/desiralize AWS tracing information

Open garasubo opened this issue 2 years ago • 0 comments

Context: When I try to introduce OpenTelemetry into AWS SQS messaging, I found that opentelemetry-aws doesn't support extracting context from SQS message. In SQS, we can extract tracing information from the message system attribute (Ref: https://docs.aws.amazon.com/xray/latest/devguide/xray-services-sqs.html). And, we can get the attributes in the SQS message as HashMap<String, String> by using aws-sdk-sqs. However, we cannot extract the span context using XrayPropagator in opentelemetry-aws because it only supports HTTP header, not SQS message attrtibutes. In HTTP header, trace header is in "x-amzn-trace-id". In SQS message attribute, the trace header is in "AwsTraceHeader".

Also, we cannot use XrayPropagator directly to inject span context to SQS message attribute when we send SQS message with aws-sdk-sqs. In aws-sdk-sqs, the type of message system attribute is HashMap<MessageSystemAttributeNameForSends,MessageSystemAttributeValue>, so this doesn't implement Injector.

However, the format of the trace header value is the same as the HTTP header. So most logic in this crate is reusable for SQS as well.

Proposal: To support SQS (and other AWS support as well?), I'd like to expose some functions to extract SpanContext from String, and construct String from SpanContext as public functions.

Thanks.

garasubo avatar Sep 27 '22 09:09 garasubo