-
Notifications
You must be signed in to change notification settings - Fork 651
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
Added ability to extract span attributes from tornado request objects #1178
Conversation
1bb0016
to
5a91eb2
Compare
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 change looks good to me! I added a few small comments.
instrumentation/opentelemetry-instrumentation-tornado/README.rst
Outdated
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py
Outdated
Show resolved
Hide resolved
_excluded_urls = get_excluded_urls() | ||
_traced_attrs = get_traced_request_attrs() |
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.
What about this to not have the function above?
_traced_attrs = get_traced_request_attrs() | |
_traced_attrs = [attr.strip() for attr in configuration.Configuration().TORNADO_TRACED_REQUEST_ATTRS.split(",")] if configuration.Configuration().TORNADO_TRACED_REQUEST_ATTRS else [] |
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.
Very similar functionality above uses a function so I think it's better to be consistent with existing code.
48f3240
to
4bdb84e
Compare
instrumentation/opentelemetry-instrumentation-tornado/README.rst
Outdated
Show resolved
Hide resolved
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.
Please add an entry to CHANGELOG
72350c4
to
fbbba1f
Compare
OTEL_PYTHON_TONADO_TRACED_REQUEST_ATTRS env var can be set to a command separated list of attributes names that will be extracted from Tornado's request object and set as attributes on spans.
Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>
aa607fc
to
badd8d6
Compare
…st_instrumentation.py Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <enruizno@uwaterloo.ca>
badd8d6
to
5c0bc91
Compare
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 one non-blocking comment, otherwise it looks good 👍
def get_traced_request_attrs(): | ||
attrs = configuration.Configuration().TORNADO_TRACED_REQUEST_ATTRS or "" | ||
if attrs: | ||
attrs = [attr.strip() for attr in attrs.split(",")] | ||
else: | ||
attrs = [] | ||
return attrs |
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.
is it worth moving this code into the utils package as well since it seems likely to be repeated?
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.
Agree. I think it might be better to have convenience methods on the configuration class itself for common config items. Something like,
cfg = configuration.Configuration()
cfg.traced_methods("django")
cfg.excluded_urls("django")
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.
Created an issue for it. #1217
Description
OTEL_PYTHON_TORNADO_TRACED_REQUEST_ATTRS env var can be set to a command
separated list of attributes names that will be extracted from Tornado's
request object and set as attributes on spans.
Also fixes #1176
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: