feat(all): moved EnvService to commons + exposed getXrayTraceId in tracer#1123
Merged
dreamorosi merged 5 commits intoOct 27, 2022
Merged
Conversation
Contributor
📊 Package size report 3%↑
🤖 This report was automatically generated by pkg-size-action |
Contributor
Author
Contributor
misterjoshua
left a comment
There was a problem hiding this comment.
This PR looks pretty good to me. For now, I have just a few minor comments.
Co-authored-by: Josh Kellendonk <misterjoshua@users.noreply.github.com>
misterjoshua
previously approved these changes
Oct 21, 2022
Contributor
misterjoshua
left a comment
There was a problem hiding this comment.
This all looks good to me!
Contributor
Author
|
@misterjoshua Thanks a lot for taking the time to review my PR, appreciate your time! |
flochaz
previously approved these changes
Oct 27, 2022
Contributor
flochaz
left a comment
There was a problem hiding this comment.
LGTM, minor update on UT would b great
|
|
||
| describe('Method: getXrayTraceId', () => { | ||
|
|
||
| test('It returns the value of the environment variable _X_AMZN_TRACE_ID', () => { |
Contributor
There was a problem hiding this comment.
can we add better test for this logic:
- if empty ?
- if real (see the split works)
88ae5f1
flochaz
approved these changes
Oct 27, 2022
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_idto 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
commonspackage 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
getRootXrayTraceIdthat 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.