Record exception on context manager exit#1162
Merged
lzchen merged 1 commit intoopen-telemetry:masterfrom Oct 7, 2020
Merged
Conversation
fc94cd4 to
7351f4b
Compare
c343f53 to
75e46c9
Compare
ccac4bb to
5c04297
Compare
694b26c to
f5abcd5
Compare
toumorokoshi
suggested changes
Oct 3, 2020
Member
toumorokoshi
left a comment
There was a problem hiding this comment.
The goal looks great! +1 to add this convenience.
I think we should re-examine adding that field to the span though. See my comment above.
29f7ef6 to
2222d26
Compare
toumorokoshi
suggested changes
Oct 5, 2020
Member
toumorokoshi
left a comment
There was a problem hiding this comment.
One minor question (incongruent default value from "record_exception") but looking really good!
...pentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py
Show resolved
Hide resolved
5a72598 to
7e30859
Compare
lzchen
reviewed
Oct 6, 2020
...pentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py
Show resolved
Hide resolved
7e30859 to
cf94b05
Compare
This updates the tracer context manager to automatically record exceptions as events on exit if an exception was raised within the context manager's context.
cf94b05 to
57a01cd
Compare
lzchen
approved these changes
Oct 7, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This updates the tracer context manager to record exceptions automatically on
exit if an exception was raised within the context manager's context.
This should be helpful in some situations when manually instrumenting apps. For example,
it can help record any uncaught/unexpected exceptions which one would expect from a tracing
system. This can also be helpful in simplifying auto-instrumentations. I think this should be the
default behavior but happy to hear other thoughts. Otel spec does not say anything about this and leaves span creation/activation to each language implementation. Both OpenTracing and OpenCensus did it AFAICT:
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Checklist: