How to pass X-Amzn-Trace-Id with the SDK? #504
-
Prerequisites
Question DescriptionTo propagate X-Ray trace information through AWS services that supports it, we need to add an How can I manually add this header to the requests made by the AWS SDK for Rust? Platform/OS/DeviceUbuntu 20.04/Windows 11/macOS Catalina Language Version1.57.0 |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 17 replies
-
@nmoutschen, did you find any solution to this? |
Beta Was this translation helpful? Give feedback.
-
@mbergkvist I've looked into this, and based on the AWS X-Ray documentation about SQS and DDB we'll need to send subsegment data about those services ourselves. These are called Inferred Segments from what I read. I've encountered this same problem when working with the AWS ADO Collector distro for Opentelemetry where I wasn't finding SQS nodes on Servicelens even though I was including the X-Ray Trace Id in the System Message Attribute Value fields for it in the SQS Message. This was because SQS doesn't actually send data to X-Ray, so I have to capture the SDK client response times, queue ARN, and response code to allow it to be inferred in the X-Ray timelines. |
Beta Was this translation helpful? Give feedback.
-
For modifying a service request on a request-by-request basis, the above solution is adequate. However, I think a better customer experience is to allow service |
Beta Was this translation helpful? Give feedback.
-
We will automatically propagate those environment variables in lambda environments: https://github.com/smithy-lang/smithy-rs/blob/main/aws/rust-runtime/aws-runtime/src/recursion_detection.rs#L58-L66 If you wanted to do so generally, you could adapt that interceptor then register it during client creation. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
-
Hi, I follow the approach for aws-sdk-dynamodb specified here: We will possibly have a much nicer way of doing this soon. I try to achieve something like this: let mut paginator = self.dynamo_db_client.query()
.table_name(self.table_name.clone())
.key_condition_expression("partitionKey = :partitionKey")
.expression_attribute_values(
":partitionKey",
aws_sdk_dynamodb::types::AttributeValue::S(partition_key),
)
.into_paginator()
// .customize()
// .mutate_request(move |req| {
// req.headers_mut().insert(
// TRACING_HTTP_HEADER.to_string(),
// trace_id.clone(),
// );
// })
.send(); The Maybe I'm just trying to do this the wrong way. Can anybody help me out? How can I add a tracing header to the HTTP requests of a DynamoDB query paginator? |
Beta Was this translation helpful? Give feedback.
We will possibly have a much nicer way of doing this soon