Skip to content

Update recording errors doc - document when to use error, exception (or both) attributes #2296

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lmolkova
Copy link
Contributor

Fixes #2001

Updates errors guidance to cover:

  • errors vs exceptions and when to use which set of attributes
  • reporting errors on logs/events
  • reporting error.message attribute


- *Error* refers to a general concept describing any non-success condition. This may include an, non-success status code, or an invalid response.

- *Exception* specifically refers to runtime exceptions and their associated stack traces.
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this mesh with languages that don't have "exceptions" and actually only have "errors" like Go or Rust?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored it slightly, please take a look, the key change:

added

Errors and exceptions are related but not the same: an error can occur without
an exception being thrown, and an exception does not necessarily constitute an
error.

Exceptions and how they are recorded in telemetry are inherently
language-specific. Some languages, such as Rust or Go, do not use exceptions
at all.

This document focuses on recording errors.

Plus there are a couple of points below that should address it

  • Semantic conventions intended for cross-language applicability SHOULD use
    error.* attributes.

  • exception attributes SHOULD be documented for conventions that target
    exceptions directly such as exception events.

@lmolkova lmolkova force-pushed the errors-message-and-guidance-for-logs branch from 2ec5940 to 1dc9015 Compare May 23, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

When to use error vs exception attributes
3 participants