-
Notifications
You must be signed in to change notification settings - Fork 15
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
set response status code in zipkin spans during exceptions #128
Conversation
pyramid_zipkin/tween.py
Outdated
response = handler(request) | ||
except Exception as e: | ||
zipkin_context.update_binary_annotations({ | ||
'error_type': type(e).__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.
to ease any future efforts on adapting to opentelemetry's semantic conventions can we use error.type
as the annotation instead?
Source -> http-spans
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.
good call out! made the change
When request processing has exceptions, the zipkin tween will now catch this exception (and re-raise it). Handling this exception in the zipkin tween lets us set the response_status_code (and error_type). This will be useful as SERVER side spans are using for analysis
Tested:
Code change to simulate the error: https://fluffy.yelpcorp.com/i/BrBMl9576HPCwvJBwPHsD4N6Gw5g8RSw.html
Test endpoint: https://www.amokal-example-happyhour-uwsgi.dev.yelp.com/hours/1234567890/v1?zipkin_email=amokal@yelp.com
Trace: https://fluffy.yelpcorp.com/i/1mFnjTRXmFhMWPz3sSWfnmTVD8Dq6lXx.html