-
I'm building a rust lambda and I'm attempting to leverage the X-Ray functionality to trace a downstream dynamo call. I've built a Segment Document, and successfully submitted it and a subsegment for a dynamo call to X-Ray. However I can't seem to find where I would retrieve the x-amzn-RequestId from the dynamo client response to add to the X-ray Subsegment. The value would be passed in as a request_id in the current json version based on the example here (https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html#api-segmentdocuments-aws)
request_id: "UBQNSO5AEM8T4FDA4RQDEB94OVTDRVV4K4HIRGVJF66Q9ASUAAJG" Is there a current way to gather this data in how responses are deserialized? Or do I not need this for proper tracing? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 8 replies
-
There isn't a first-class way to get that right now unfortunately. You'll need to use a workaround by going through the low level DynamoDB client. There, you can use let conf = aws_sdk_dynamodb::Config::builder()
.region(Region::new("us-east-1"))
.build();
let raw_client = aws_hyper::Client::https();
let update_item = aws_sdk_dynamodb::operation::UpdateItem::builder().<...>.build().unwrap().make_operation(&conf).unwrap();
let resp = raw_client.call_raw(update_item)?;
let request_id = resp.raw.headers.get("X-Amzn-Requestid");
let parsed_response = resp.parsed; We're looking into exposing the request id in success and error responses to make this nicer in the future. |
Beta Was this translation helpful? Give feedback.
-
What is your use case for those specific values?
If you're operating on the raw response info like status, it's possible
X-Ray integration would be better handled as a middleware stage (something
else we can investigate)
…On Mon, Aug 16, 2021 at 3:14 PM sarmst22 ***@***.***> wrote:
@rcoh <https://github.com/rcoh> content_length and the status would also
be helpful in this specific case, are they also being examined as
candidates to be easier to access?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#194 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADYKZY7J26CIULVMU6I3RLT5FPRNANCNFSM5CIJGPJQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Getting the request ID from an output or error was implemented in this PR. For outputs: // Import the trait to get the `request_id` method on outputs
use aws_sdk_s3::types::RequestId;
let output = client.list_buckets().send().await?;
println!("Request ID: {:?}", output.request_id()); For errors: use aws_sdk_s3::types::RequestId;
println!("Request ID: {:?}", error.request_id()); |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
-
Just noting for future reference that // Import the trait to get the `request_id` method on outputs
use aws_sdk_s3::operation::RequestId;
let output = client.list_buckets().send().await?;
println!("Request ID: {:?}", output.request_id()); |
Beta Was this translation helpful? Give feedback.
Getting the request ID from an output or error was implemented in this PR.
For outputs:
For errors: