-
Notifications
You must be signed in to change notification settings - Fork 889
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
RecordException: Allow additional attributes. #874
Changes from all commits
9038240
f861f30
deb27aa
fa7288b
e11486c
8f6200d
75e4ce5
d8aa27b
94fd6fc
ce4fdfd
a77db15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -451,6 +451,9 @@ the ordering of the events' timestamps. | |
Note that the OpenTelemetry project documents certain ["standard event names and | ||
keys"](semantic_conventions/README.md) which have prescribed semantic meanings. | ||
|
||
Note that [`RecordException`](#record-exception) is a specialized variant of | ||
`AddEvent` for recording exception events. | ||
|
||
#### Set Status | ||
|
||
Sets the [`Status`](#status) of the `Span`. If used, this will override the | ||
|
@@ -502,15 +505,25 @@ This API MUST be non-blocking. | |
#### Record Exception | ||
|
||
To facilitate recording an exception languages SHOULD provide a | ||
`RecordException` convenience method. The signature of the method is to be | ||
determined by each language and can be overloaded as appropriate. The method | ||
MUST record an exception as an `Event` with the conventions outlined in the | ||
[exception semantic conventions](semantic_conventions/exceptions.md) document. | ||
|
||
Examples: | ||
|
||
- `RecordException(exception: Exception)` | ||
- `RecordException(type: String, message: String, stacktrace: String)` | ||
`RecordException` method if the language uses exceptions. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do we explicitly rule out Go here? Is the intent? I know that there is an open issue to discuss Go, exceptions and errors (#764) but would like to understand if this change is intentionally excluding Go for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really. 😕 I thought I was stating the obvious here, but if it's confusing, I can remove this change. EDIT: Technically that now does not say that Go SHOULD provide that method anymore, but it does also not say that Go SHOULD NOT provide it 😃 |
||
This is a specialized variant of [`AddEvent`](#add-events), | ||
so for anything not specified here, the same requirements as for `AddEvent` apply. | ||
|
||
The signature of the method is to be determined by each language | ||
and can be overloaded as appropriate. | ||
The method MUST record an exception as an `Event` with the conventions outlined in | ||
the [exception semantic conventions](semantic_conventions/exceptions.md) document. | ||
The minimum required argument SHOULD be no more than only an exception object. | ||
|
||
If `RecordException` is provided, the method MUST accept an optional parameter | ||
to provide any additional event attributes | ||
(this SHOULD be done in the same way as for the `AddEvent` method). | ||
If attributes with the same name would be generated by the method already, | ||
the additional attributes take precedence. | ||
|
||
Note: `RecordException` may be seen as a variant of `AddEvent` with | ||
additional exception-specific parameters and all other parameters being optional | ||
(because they have defaults from the exception semantic convention). | ||
|
||
### Span lifetime | ||
|
||
|
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 like the idea that RecordException is a variant of AddEvent. Perhaps go a bit further and call it AddExceptionEvent?
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 don't really have an opinion which name is better and I don't want to expand the scope of this PR. So perhaps this could be done in a follow-up?
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.
A follow-up sounds good.
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 forestalling that follow-up PR but just before I forget that idea: I'd even call it
AddEventWithException
. It may look like a minor nuance but it will be a lot more discoverable since it will be suggested by IDEs when users typeAddEve...
.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.
Note that @iNikem had a strong opinion on renaming RecordException here #814 (comment)
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 don't have very strong opinion on renaming
RecordException
toAddExceptionEvent
or similar. The comment above was about removingAddExceptionEvent
altogether and replacing it with genericAddEvent