-
Notifications
You must be signed in to change notification settings - Fork 174
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
Recording exception as standalone events #970
Conversation
docs/exceptions/exceptions-events.md
Outdated
[events](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.31.0/specification/logs/event-api.md#emit-event) | ||
emitted through the [EventLogger](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/event-api.md#eventlogger) API. | ||
|
||
|
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.
nit: two blank lines, probably failing lint
I feel like we may need to document somewhere the difference of capturing exceptions as events vs logs. IMO, it is clear that "event exceptions" are the same as span exceptions - both captured as events with name |
* Spans and Events: Exception recording in Spans and Events follows a similar pattern. Both utilize the event name `exception`. Exceptions MAY be recorded within Span Events if they occur during the span's lifecycle. | ||
* Logs: Exceptions SHOULD be recorded in logs when utilizing the log bridge API to map application logs to OpenTelemetry logs. | ||
|
||
Note that in all cases the exception data is stored in attributes. |
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.
Can we entertain the idea of recording stack trace in the payload and not in the attribute to avoid all the common problems (parsing, truncation, etc) ?
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.
@lmolkova Can you elaborate a bit on how recording the stacktrace in the Event Payload (LogRecord Body) address those issues? Even within the any
type field, the data would still have to be put into the standard primitive types.
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.
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.
@trask thanks for the pointer. I guess we were taking the simplistic approach of keeping the exception
event consistent with exception
spans and exception
logs. However, I can see that moving the exception data to Event body/payload would allow us to have richer data in the Event. For eg., in addition to the structured vs plaintext stacktrace representation, we could add context
or additonal_data
to the Event to capture arbitrary objects which is not possible with attributes which only allow primitive types currently.
|
||
When it comes to recording exceptions, it's crucial to distinguish between Spans, Logs, and Events: | ||
|
||
* Spans and Events: Exception recording in Spans and Events follows a similar pattern. Both utilize the event name `exception`. Exceptions MAY be recorded within Span Events if they occur during the span's lifecycle. |
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.
* Spans and Events: Exception recording in Spans and Events follows a similar pattern. Both utilize the event name `exception`. Exceptions MAY be recorded within Span Events if they occur during the span's lifecycle. | |
* Spans and Events: Exception recording in Spans and Events follows a similar pattern. Both utilize the event name `exception`. Exceptions SHOULD be recorded within Span Events if they occur during the span's lifecycle. |
Is there any reason why we'd diverge from the stable spec statement that makes this a SHOULD here in semconv?
https://opentelemetry.io/docs/specs/otel/trace/exceptions/
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.
* Spans and Events: Exception recording in Spans and Events follows a similar pattern. Both utilize the event name `exception`. Exceptions MAY be recorded within Span Events if they occur during the span's lifecycle. | |
* Spans and Events: Exception recording in Spans and Events follows a similar pattern. Both utilize the event name `exception`. Exceptions MAY be recorded as Log-based Events even if they occur during the span's lifecycle. |
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 changelog entry correctly
## Unreleased | ||
|
||
### Breaking | ||
|
||
### Features | ||
|
||
- Add semantic conventions for recording exceptions in events [#970](https://github.com/open-telemetry/semantic-conventions/pull/970) |
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.
We are not updating changelog directly. Please check requirements in the description of your PR
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Changes
Added semantic convention for recording exception on standalone events.
NOTE on when to use what for recording exceptions:
exception
and attributesexception.*
.exception.*
attributes.exception
and attributesexception.*
.--
Note: if the PR is touching an area that is not listed in the [existing areas](https://github.com/open-telemetry/semantic-## Merge requirement checklist
[chore]