-
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(tracer): specify subsegment name when capturing class method #1092
feat(tracer): specify subsegment name when capturing class method #1092
Conversation
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.
Just a few small nitpicks in the docs. Otherwise, this looks good to me.
Co-authored-by: Josh Kellendonk <misterjoshua@users.noreply.github.com>
Thank you for taking a look at this and good spotting the mistakes in the docstrings, I have committed your suggestions :) |
const customMetadataValue = process.env.EXPECTED_CUSTOM_METADATA_VALUE ? JSON.parse(process.env.EXPECTED_CUSTOM_METADATA_VALUE) : { bar: 'baz' }; | ||
const customResponseValue = process.env.EXPECTED_CUSTOM_RESPONSE_VALUE ? JSON.parse(process.env.EXPECTED_CUSTOM_RESPONSE_VALUE) : { foo: 'bar' }; |
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.
Question: Why switching away from ??
here?
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.
Parsing a non-JSON / undefined
value throws an error rather than evaluate to false, so if the goal was to use the default value (after the ??
) when one is not explicitly provided in the env, then this should be correct.
Happy to revert if you think it's not ok or I misunderstood the intent of the original expression.
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.
No. I just want to check that it's really a missing edge case.
…egment-names-for-captured-methods
Description of your changes
Community member @misterjoshua suggested a feature in #1084 to allow customers to set a custom name for the subsegment generated by the
Tracer.captureMethod
method.At the moment Tracer automatically sets the subsegment name to the same value of the name of the method. This is a sensible choice but in some cases, when using non descriptive method names, customers might want to set their own names.
This PR adds an optional parameter to the options for
captureMethod
so that the custom name can be set. The PR also splits the type used for the options incaptureMethod
andcaptureLambdaHandler
so that the new parameter is valid only for the former (the latter will always be called## index.${HANDLER NAME}
for now).The PR also adds unit test cases as well as e2e test cases and does some light housekeeping around the e2e tests and docstrings related to this feature.
How to verify this change
Check out newly added unit test cases and new e2e test cases (results here).
Related issues, RFCs
Issue number: #1084
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.