-
Notifications
You must be signed in to change notification settings - Fork 146
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
feat(all): moved EnvService to commons + exposed getXrayTraceId in tracer #1123
feat(all): moved EnvService to commons + exposed getXrayTraceId in tracer #1123
Conversation
📊 Package size report 3%↑
🤖 This report was automatically generated by pkg-size-action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks pretty good to me. For now, I have just a few minor comments.
Co-authored-by: Josh Kellendonk <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks good to me!
@misterjoshua Thanks a lot for taking the time to review my PR, appreciate your time! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor update on UT would b great
|
||
describe('Method: getXrayTraceId', () => { | ||
|
||
test('It returns the value of the environment variable _X_AMZN_TRACE_ID', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add better test for this logic:
- if empty ?
- if real (see the split works)
88ae5f1
Description of your changes
In #1070 customers have requested the addition of a new method in Tracer that allows to access the AWS X-Ray Root Trace ID. This is useful in those situations in which customers want to use this id as correlation id in the responses returned by a function or manually pass it to downstream processes.
The logic to retrieve and parse this ID was already present in Logger (here). For that utility we use the method to append the
xray_trace_id
to log entries in some cases.During the discussion of the feature it became clear that this could be a good moment to also extract this logic to the
commons
package continuing the work started in #484, and potentially unlocking/facilitating #165.Before this change
After this change
This issue also introduces a new public method in Tracer called
getRootXrayTraceId
that allows customers to access the AWS X-Ray Root Trace ID within a Lambda handler.Fixes #1070
How to verify this change
Check the unit tests results, as well as package size report, and e2e tests.
Related issues, RFCs
Issue number: #1070
PR status
Is this ready for review?: YES
Is it a breaking change?: NO
Checklist
Breaking change checklist
N/A
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.