Skip to content

X-Ray and OpenTelemetry

0

When using the open source OpenTelemetry collector and SDK, without using the X-Ray SDK, what HTTP headers for the span timeline visualization can be added so that the service name and segment names get rendered in the UI ?

asked 2 years ago860 views

2 Answers
1
Accepted Answer

As per this mapping, the X-Ray segment or subsegment names are derived from the corresponding span's attributes. The most common way is to set the service.name attribute on the spans either via OTel environment variable or from within the code.

AWS

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Awesome answer, the mapping page is a gold mine

-1

When using the open source OpenTelemetry collector and SDK without the X-Ray SDK, you can still achieve X-Ray compatibility for span timeline visualization by using the AWS X-Ray propagator component. This component formats HTTP headers to meet the requirements of the AWS X-Ray trace header format.

By default, OpenTelemetry uses the W3C trace header format. However, to ensure compatibility with X-Ray and proper rendering of service names and segment names in the X-Ray UI, you need to configure the X-Ray propagator.

The X-Ray trace header format includes information such as the root trace ID and sampling decision. It differs from the default W3C format used by OpenTelemetry. The X-Ray header typically looks like this:

X-Amzn-Trace-Id: Root=1-5759e988-bd862e3fe1be46a994272793;Parent=[parent-id];Sampled=1

To use this format, you need to configure the OpenTelemetry SDK to use the AWS X-Ray propagator. This will ensure that the necessary information, including service names and segment names, is properly formatted in the HTTP headers.

By implementing the X-Ray propagator, you can transfer the context across process boundaries and services, allowing X-Ray to correctly visualize the service map and segment names in its UI. This approach enables you to leverage OpenTelemetry's instrumentation while still benefiting from X-Ray's visualization capabilities without directly using the X-Ray SDK.
Sources
Adding AWS X-Ray support to the OpenTelemetry PHP library | AWS Open Source Blog

answered 2 years ago

  • I am looking for more than the correlation Id's for traces these already work to link spans together but do not label the segments when viewed through the UI.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.