Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1146d0e
update exception recording guidelines to not use span events
pellared Jan 7, 2026
1387714
Clarify guidance on capturing exception details in metrics and spans
pellared Jan 7, 2026
f9869db
Add changelog entry
pellared Jan 7, 2026
095f876
Deprecate event.exception and update documentation to use logs for re…
pellared Jan 7, 2026
5a37bb0
Update component designation to 'exceptions' in changelog entry
pellared Jan 7, 2026
353b660
Update .chloggen/3256.yaml
pellared Jan 7, 2026
c16c40c
Apply suggestions from code review
pellared Jan 8, 2026
370ec7c
Update docs/general/recording-errors.md
pellared Jan 12, 2026
a5272a5
Deprecate Semantic conventions for exceptions on spans document
pellared Jan 12, 2026
b340f36
Merge branch 'rem-span-events' of github.com:pellared/semantic-conven…
pellared Jan 12, 2026
f71de5c
revert 'event' to 'log record'
pellared Jan 12, 2026
e8b8f4f
update recording exceptions example
pellared Jan 12, 2026
ac1e486
Update recording-errors.md
pellared Jan 12, 2026
c9cef10
lint
pellared Jan 12, 2026
97b607c
Update .github/copilot-instructions.md
pellared Jan 13, 2026
f3bec71
Update exceptions-spans.md to reference semantic conventions for exce…
pellared Jan 13, 2026
a49a364
Apply suggestion from @lmolkova
pellared Jan 27, 2026
ef4f629
instrumented code -> instrumented operation
pellared Jan 27, 2026
f0d31ea
revert deprecation of Exception event
pellared Jan 27, 2026
e28a464
Clarify error recording guidelines for instrumented operations and ex…
pellared Jan 27, 2026
34508f8
Remove redundant instruction for recording exceptions in the document…
pellared Jan 27, 2026
7519ccd
revert guidance on recording handled exceptions in documentation
pellared Jan 27, 2026
4848c59
Update status link for deprecated exceptions spans documentation
pellared Jan 27, 2026
ec62ed5
Update deprecation note in changelog
pellared Jan 27, 2026
3e0fbbd
add semicolons
pellared Jan 27, 2026
668846f
Merge branch 'rem-span-events' of github.com:pellared/semantic-conven…
pellared Jan 27, 2026
f9e3275
format
pellared Jan 27, 2026
fec7b72
Clarify comments regarding error handling in createIfNotExists method
pellared Jan 27, 2026
14f8c7b
Clarify comments on span status handling for ResourceAlreadyExistsExc…
pellared Jan 27, 2026
ee0ba3e
format
pellared Jan 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .chloggen/3256.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
change_type: deprecation
component: exceptions
note: Update exception recording guidelines to not use span events.
issues: [3256]
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ these requirements:

- **Spans**: Set status to Error, populate `error.type`, set description when helpful
- **Metrics**: Include `error.type` attribute for filtering and analysis
- **Exceptions**: Record as span events or log records using SDK APIs
- **Exceptions**: Record as log records
- **Consistency**: Same `error.type` across spans and metrics for same operation

## Common Issues to Flag
Expand Down
2 changes: 1 addition & 1 deletion AREAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ their owners, related project (and project board) as well as its current status.
| Semantic Conventions: Database | [semconv-db-approvers](https://github.com/orgs/open-telemetry/teams/semconv-db-approvers) | https://github.com/open-telemetry/community/blob/main/projects/completed-projects/database-client-semconv.md | https://github.com/orgs/open-telemetry/projects/73 | `area:db` | `inactive` | The SIG is inactive. Bugs and bugfixes are welcome. For substantial changes, follow the [new project process](https://github.com/open-telemetry/community/blob/main/project-management.md) |
| Semantic Conventions: FaaS | [specs-semconv-maintainers](https://github.com/orgs/open-telemetry/teams/specs-semconv-maintainers) | https://github.com/open-telemetry/community/blob/main/projects/completed-projects/faas.md | N/A | `area:faas` | `inactive` | The SIG is inactive. Bugs and bugfixes are welcome. For substantial changes, follow the [new project process](https://github.com/open-telemetry/community/blob/main/project-management.md) |
| Semantic Conventions: JVM | [semconv-jvm-approvers](https://github.com/orgs/open-telemetry/teams/semconv-jvm-approvers) | N/A | https://github.com/orgs/open-telemetry/projects/49 | `area:jvm` | `inactive` | The SIG is inactive. Bugs and bugfixes are welcome. For substantial changes, follow the [new project process](https://github.com/open-telemetry/community/blob/main/project-management.md) |
| Semantic Conventions: Logs | [semconv-log-approvers](https://github.com/orgs/open-telemetry/teams/semconv-log-approvers) | N/A | N/A | `area:log`, `area:event`, `area:exception` | `accepting_contributions`, `active` | The SIG is looking for contributions! |
| Semantic Conventions: Logs | [semconv-log-approvers](https://github.com/orgs/open-telemetry/teams/semconv-log-approvers) | N/A | https://github.com/orgs/open-telemetry/projects/65 | `area:log`, `area:event`, `area:exception` | `accepting_contributions`, `active` | The SIG is looking for contributions! |
| Semantic Conventions: Mainframe | [sig-mainframe-approvers](https://github.com/orgs/open-telemetry/teams/sig-mainframe-approvers) | https://github.com/open-telemetry/community/blob/main/projects/mainframe.md | N/A | `area:mainframe`, `area:zos` | `accepting_contributions`, `active` | The SIG is looking for contributions! |
| Semantic Conventions: Profiling | [profiling-approvers](https://github.com/orgs/open-telemetry/teams/profiling-approvers) | N/A | N/A | `area:profile`, `area:pprof` | `accepting_contributions`, `active` | The SIG is looking for contributions! |
| Semantic Conventions: .NET | [semconv-dotnet-approver](https://github.com/orgs/open-telemetry/teams/semconv-dotnet-approver) | N/A | N/A | `area:dotnet`, `area:aspnetcore`, `area:signalr`, `area:kestrel` | `accepting_contributions`, `active` | SIG is driven by members of the .NET runtime team. Contributions are welcomed but must be aligned with the .NET runtime features/roadmap |
Expand Down
2 changes: 1 addition & 1 deletion areas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ areas:
- name: "semconv-log-approvers"
github: semconv-log-approvers
project: "N/A"
board: "N/A"
board: "https://github.com/orgs/open-telemetry/projects/65"
labels:
- area:log
- area:event
Expand Down
3 changes: 2 additions & 1 deletion docs/exceptions/exceptions-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ linkTitle: Spans

# Semantic conventions for exceptions on spans

**Status**: [Stable][DocumentStatus]
**Status**: [Deprecated][DocumentStatus]<br>
Use [Semantic conventions for exceptions in logs](exceptions-logs.md) instead.

This document defines semantic conventions for recording application
exceptions associated with spans.
Expand Down
47 changes: 33 additions & 14 deletions docs/general/recording-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Individual semantic conventions are encouraged to provide additional guidance.

An operation SHOULD be considered as failed if any of the following is true:

- an exception is thrown by the instrumented method (API, block of code, or another instrumented unit)
- the instrumented method returns an error in another way, for example, via an error code
- an exception is thrown by the instrumented operation (API, block of code, or another instrumented unit)
- the instrumented operation returns an error in another way, for example, via an error code

Semantic conventions that define domain-specific status codes SHOULD specify
which status codes should be reported as errors by a general-purpose instrumentation.
Expand Down Expand Up @@ -83,12 +83,12 @@ include it if the operation succeeded.

## Recording exceptions

When an instrumented operation fails with an exception, instrumentation SHOULD record
this exception as a [span event](/docs/exceptions/exceptions-spans.md) or a [log record](/docs/exceptions/exceptions-logs.md).
When the instrumented operation failed due to an exception:

It's RECOMMENDED to use the `Span.recordException` API or logging library API that takes exception instance
instead of providing individual attributes. This enables the OpenTelemetry SDK to
control what information is recorded based on application configuration.
- instrumentation SHOULD record this exception as a [log record](/docs/exceptions/exceptions-logs.md),
- instrumentation SHOULD follow [recording errors on spans](#recording-errors-on-spans)
and [recording errors on metrics](#recording-errors-on-metrics)
on capturing exception details on these signals.

It's NOT RECOMMENDED to record the same exception more than once.
It's NOT RECOMMENDED to record exceptions that are handled by the instrumented library.
Comment thread
pellared marked this conversation as resolved.
Expand All @@ -100,22 +100,41 @@ to the caller should be recorded (or logged) once.
```java
public boolean createIfNotExists(String resourceId) throws IOException {
Comment thread
pellared marked this conversation as resolved.
Span span = startSpan();
long startTime = System.nanoTime();
try {
create(resourceId);

recordMetric("acme.resource.create.duration", System.nanoTime() - startTime);

return true;
} catch (ResourceAlreadyExistsException e) {
// not recording exception and not setting span status to error - exception is handled
// but we can set attributes that capture additional details
// we do not set span status to error and the "error.type" attribute
// as the exception is not an error,
// but we still log and set attributes that capture additional details
logger.withEventName("acme.resource.create.error")
.withAttribute("acme.resource.create.status", "already_exists")
.withException(e)
Comment thread
pellared marked this conversation as resolved.
.debug();

span.setAttribute(AttributeKey.stringKey("acme.resource.create.status"), "already_exists");

recordMetric("acme.resource.create.duration", System.nanoTime() - startTime);
Comment thread
lmolkova marked this conversation as resolved.

return false;
} catch (IOException e) {
// recording exception here (assuming it was not recorded inside `create` method)
span.recordException(e);
// or
// logger.warn(e);
// this exception is expected to be handled by the caller
// and could be a transient error
logger.withEventName("acme.resource.create.error")
.withException(e)
.warn();

String errorType = e.getClass().getCanonicalName();
Comment thread
pellared marked this conversation as resolved.

span.setAttribute(AttributeKey.stringKey("error.type"), e.getClass().getCanonicalName())
span.setAttribute(AttributeKey.stringKey("error.type"), errorType);
span.setStatus(StatusCode.ERROR, e.getMessage());
Comment thread
pellared marked this conversation as resolved.

recordMetric("acme.resource.create.duration", System.nanoTime() - startTime,
AttributeKey.stringKey("error.type"), errorType);
throw e;
}
}
Expand Down
Loading