-
Notifications
You must be signed in to change notification settings - Fork 26
chore: Tracing Sanitize SegmentName to avoid unsupported characters #741
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
chore: Tracing Sanitize SegmentName to avoid unsupported characters #741
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #741 +/- ##
===========================================
+ Coverage 73.32% 73.34% +0.01%
===========================================
Files 200 201 +1
Lines 8112 8118 +6
Branches 871 871
===========================================
+ Hits 5948 5954 +6
Misses 1875 1875
Partials 289 289
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…a-dotnet into fix(tracing)-invalid-sement-name
…' into fix(tracing)-invalid-sement-name
|
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.
Nice improvement! If testes are green - I saw the new test - it's good to merge.
CC @nCubed |
Issue number: #740
Summary
Changes
This pull request introduces several changes to the AWS Lambda Powertools Tracing library, primarily focusing on sanitizing segment names and updating related tests. The most important changes include the addition of a helper method for sanitizing strings, modifications to the
XRayRecorder
andTracingAttribute
classes to use this sanitization, and the addition of new test cases to ensure the changes work correctly.Sanitization of Segment Names:
libraries/src/AWS.Lambda.Powertools.Tracing/Internal/Helpers.cs
: Added a new staticHelpers
class with aSanitizeString
method to remove any characters that are not alphanumeric, whitespace, or one of the following:_ . : / % & # = + - @
.libraries/src/AWS.Lambda.Powertools.Tracing/Internal/XRayRecorder.cs
: Updated theBeginSubsegment
method to useHelpers.SanitizeString
for sanitizing the segment name.Documentation and Attribute Updates:
libraries/src/AWS.Lambda.Powertools.Tracing/TracingAttribute.cs
: Updated the documentation for theSegmentName
property to specify the allowed characters in segment names.Test Enhancements:
libraries/tests/AWS.Lambda.Powertools.Tracing.Tests/Handlers/Handlers.cs
: Added new methodsHandleWithInvalidSegmentName
andMethodWithInvalidSegmentName
to test the handling of invalid segment names.libraries/tests/AWS.Lambda.Powertools.Tracing.Tests/TracingAttributeTest.cs
: Added a new testOnEntry_WhenSegmentName_Is_Unsupported
to verify that the segment names are sanitized correctly.User experience
Checklist
Please leave checklist items unchecked if they do not apply to your change.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.