Skip to content

Conversation

@lmolkova
Copy link
Member

@lmolkova lmolkova commented Dec 10, 2024

Related to open-telemetry/semantic-conventions#1536

Changes

Recording exceptions as span events is problematic since it

  • ties recording exceptions to tracing/sampling
  • duplicates exceptions recorded by instrumented libraries on logs
  • does not leverage log features such as typical log filtering based on severity

This OTEP provides guidance on how to record exceptions using OpenTelemetry logs focusing on minimizing duplication and providing context to reduce the noise.

If accepted, the follow-up spec changes are expected to replace existing (stable) documents:


@lmolkova lmolkova changed the title OTEP: Recording exceptions and errors with OpenTelemetry OTEP: Recording exceptions as log based events Dec 10, 2024
@pellared
Copy link
Member

pellared commented Dec 10, 2024

I think this is a related issue:

@tedsuo tedsuo added the OTEP OpenTelemetry Enhancement Proposal (OTEP) label Dec 12, 2024
@lmolkova lmolkova force-pushed the exceptions-on-logs-otep branch 2 times, most recently from b06a09f to 76c7d85 Compare December 17, 2024 17:30
@lmolkova lmolkova force-pushed the exceptions-on-logs-otep branch from db27087 to e9f38aa Compare January 3, 2025 01:42
@carlosalberto
Copy link
Contributor

A small doubt:

If this instrumentation supports tracing, it should capture the error in the scope of the processing span.

Although (I think) it's not called out, I'm understanding exceptions should now be explicitly reported as both 1) Span.Event and 2) Log/Event? i.e. coding wise you should do this:

currentSpan.recordException(e);
logger.logRecordBuilder
    .addException(e);

Is this the case?

Copy link
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I'm very supportive. Just some nits and one mitigation I'd like to see called out/addressed.

Liudmila Molkova and others added 11 commits July 21, 2025 22:08
@lmolkova lmolkova force-pushed the exceptions-on-logs-otep branch from db2b647 to 0b361ca Compare July 22, 2025 05:53
@pellared pellared dismissed their stale review July 22, 2025 15:50

OTEP is updated

@lmolkova lmolkova force-pushed the exceptions-on-logs-otep branch from e030736 to 0be3bc3 Compare July 22, 2025 18:54
@lmolkova lmolkova moved this from Done to In progress in Logs SIG Jul 22, 2025
@lmolkova lmolkova removed the Stale label Jul 22, 2025
@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jul 30, 2025
@github-actions
Copy link

github-actions bot commented Aug 6, 2025

Closed as inactive. Feel free to reopen if this PR is still being worked on.

Comment on lines +22 to +24
This OTEP continues [Span Event API deprecation plan OTEP](./4430-span-event-api-deprecation-plan.md)
and provides guidance on how to record errors and exceptions using OpenTelemetry Logs,
focusing on minimizing duplication and providing context to reduce noise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just ran across another benefit, as it will allow users to capture all exceptions (if they want) even when doing sampling on traces.

@linux-foundation-easycla
Copy link

CLA Missing ID CLA Not Signed

@github-actions github-actions bot removed the Stale label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog.opentelemetry.io OTEP OpenTelemetry Enhancement Proposal (OTEP)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.