-
Notifications
You must be signed in to change notification settings - Fork 143
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
Improve SubSegment Naming #32
Improve SubSegment Naming #32
Conversation
Addresses #31 |
Thank you for providing the fix. The log warning is at IMO selectively copy the logic from |
btw I added this for httplib: https://github.com/aws/aws-xray-sdk-python/blob/master/aws_xray_sdk/ext/util.py#L97 may prove useful |
@haotianw465 This uses strip_url now as well as doing the logic check from entity. I also added the segment/subsegment name to the log message about invalid chars to make debuging easier for people. |
# Strip URL of ? and following text | ||
sub_name = strip_url(sql['url']) | ||
# Ensure url has a valid characters. | ||
sub_name = ''.join([c for c in sub_name if c in _valid_name_characters]) |
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 is a duplicate to https://github.com/aws/aws-xray-sdk-python/blob/master/aws_xray_sdk/core/models/entity.py#L33. IMO when we see a warning on invalid characters we fix from its source, like the strip_url
here. But we should not deliberately skip the log warning by placing sub_name = ''.join([c for c in sub_name if c in _valid_name_characters])
everywhere.
Otherwise it looks fine.
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.
Without that code, we would still end up logging warnings for certain SQL URLs. For example 'échéanciers' is a valid name or a database in postgres, but would be stripped to 'chanciers' for x-ray... I left this code to prevent the warnings as the sqlalchemy plugin is setting this, so it is not in users control.. If you want it removed I will, let me know.
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.
I'm fine with special casing the sql subsegment name. I will create a follow up issue for further write an utility module that strips unicode for patchers that might capture unicode as subsegment name.
Oh one thing I forgot is that could you add one line on |
would be nice if it changed |
@thehesiod it's nice to have for a utility class to convert some certain unicode characters to ASCII letters. I will make sure to include that on the follow up ISSUE. |
Remove Invalid Chars from URL used in name to prevent errors being logged.