-
Notifications
You must be signed in to change notification settings - Fork 552
feat(django): Instrument views as spans #787
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
Conversation
@@ -118,7 +118,7 @@ class Address(Base): | |||
assert ( | |||
render_span_tree(event) | |||
== """\ | |||
- op=None: description=None | |||
- op=None: description='None' |
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.
Why op is None
and description is 'None'
? Other ops below have quotes.
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.
Hmm maybe None
=> JSON's null
, while the description will always be a string?
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.
Ah yeah that's an unfortunate side-effect. Will switch to json.dumps
as representation method
tests/conftest.py
Outdated
@@ -334,7 +334,7 @@ def inner(event): | |||
by_parent.setdefault(span["parent_span_id"], []).append(span) | |||
|
|||
def render_span(span): | |||
yield "- op={!r}: description={!r}".format( | |||
yield "- op='{}': description='{}'".format( |
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's the motivation to change this?
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.
It caused incompatibilities between Python 2 and 3 when rendering unicode strings.
if integration is None or not integration.middleware_spans: | ||
return old_resolve(self, path) | ||
|
||
with hub.start_span(op="django.urls.resolve"): |
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 not sure this is of much use. If all the resolver does is call the view, isn't it going to be very similar in duration to the django.view
span?
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.
yeah let's remove it. resolver is probably fast enough, usually
This adds spans around URL resolving and the view itself.