-
Notifications
You must be signed in to change notification settings - Fork 153
Feature request: access to the root trace id in Tracer #1070
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
Comments
Hi @misterjoshua thank you for another interesting feature request. At the moment Tracer doesn't expose any method but I think there's a chance that the I wonder if we should instead generalise the logic of this method in the Utility class present in Would like to hear the take of other maintainers, as well as your opinion on the above, before moving forward |
|
Yes, sorry, point 2 is what I was referring to. I wouldn't want to take a dependency on the X-ray SDK. I was proposing to either find & use the method from the SDK in the tracer only OR Generalize the method into Either way the bundle would stay more or less the same for all packages involved. |
I like this idea. I absolutely see scenarios in which correlation IDs generated by AWS including this one might need to be inspected or handled by your application. Not the same but good for context that there has been some conversation going on in the past about AWS-generated correlation IDs: |
I like where this is headed. It makes practical sense to me to move Logger's One small point from me: What access modifier are we thinking to use on |
I don't have a strong preference on the access modifier to be used in Regarding the subclasses and
Please let me know if anyone has any objection on this. In the meanwhile, another discussion that I'd like to have is around the actual implementation of this method in As you'll notice in the current implementation in private getXrayTraceId(): string {
const xRayTraceId = this.getEnvVarsService().getXrayTraceId();
return xRayTraceId.length > 0 ? xRayTraceId.split(';')[0].replace('Root=', '') : xRayTraceId;
} This service is The reasons why I bring this up though, are the following: 1. Shared / Duplicate CodeRelated issues: #484 (especially this comment & subsequent one), #547 There is a similar implementation of For this reason I think we should have a discussion also on how to implement 2. Default return valueRelated issues: #165 Regardless of the decision on the previous point, the implementation of Any thoughts on all these points? |
I see easy access to the trace ID as helpful. I also agree to the |
Hi @misterjoshua, @sthuber90, I have opened a PR (#1123) that addresses the changes discussed above. Would love to have your opinion on the current direction. |
Thanks for your work so far. I'll be in a better position to take a look this evening. |
|
The feature has been released in v1.4.0 |
Description of the feature request
Problem statement
When handling application errors, I want to embed the XRay Trace ID in the payload & error message returned by my API so that customers can cite the trace ID in support requests, and so our development team can easily look up the trace from a customer service request via AWS XRay's web console.
Summary of the feature
I'd like the tracer to provide the root trace id so that I can access it in my (otherwise) unhandled exceptions handler when I construct a user-facing error message.
Code examples
Benefits for you and the wider AWS community
Makes it easier for the wider community to expose trace IDs to their customers so that developers can look up the conditions and contexts of the errors reported by their customers.
Describe alternatives you've considered
For now, we've implemented this by parsing out the
Root=
traceid fromprocess.env['_X_AMZN_TRACE_ID']
, but our preference would be to depend on Powertools for this.Additional context
None
Related issues, RFCs
None
The text was updated successfully, but these errors were encountered: