Skip to content

Commit

Permalink
Deprecate �xception.escaped attribute, update exception example, clea…
Browse files Browse the repository at this point in the history
…n up semconv doc
  • Loading branch information
lmolkova committed Jan 16, 2025
1 parent 6d1e420 commit 847e1a0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
33 changes: 17 additions & 16 deletions specification/semantic-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,29 @@ OpenTelemetry defines its semantic conventions in a separate repository:

Semantic conventions MUST provide the following attributes:

- Resource
- `service.name`
- `telemetry.sdk.language`
- `telemetry.sdk.name`
- `telemetry.sdk.version`
- Event
- `exception.escaped`
- `exception.message`
- `exception.stacktrace`
- `exception.type`
- [`error.type`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/error.md#error-type)
- [`exception.message`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/exception.md#exception-message)
- [`exception.stacktrace`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/exception.md#exception-stacktrace)
- [`exception.type`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/exception.md#exception-type)
- [`server.address`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/server.md#server-address)
- [`server.port`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/server.md#server-port)
- [`service.name`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/service.md#service-name)
- [`telemetry.sdk.language`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/telemetry.md#telemetry-sdk-language)
- [`telemetry.sdk.name`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/telemetry.md#telemetry-sdk-name)
- [`telemetry.sdk.version`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/telemetry.md#telemetry-sdk-version)
- [`url.scheme`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/url.md#url-scheme)

Semantic conventions MUST provide the following events:

- [`exception`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/exceptions/exceptions-spans.md)

## In-development Reserved Attributes

Semantic conventions MUST provide the following attributes:

- Resource
- `server.address`
- `server.port`
- `service.instance.id`
- `url.scheme`
- [`service.instance.id`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/service.md#service-instance-id)

## Reserved Namespace

The `otel.*` namespace is reserved for defining compatibility with
non-opentelemetry technologies.
non-OpenTelemetry technologies.
14 changes: 9 additions & 5 deletions specification/trace/exceptions.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Exceptions

**Status**: [Stable](../document-status.md)
**Status**: [Stable](../document-status.md), Unless otherwise specified.

This document defines how to record exceptions and
their required attributes.
This document defines how to record exceptions and their attributes.

<!-- toc -->

Expand All @@ -17,6 +16,9 @@ their required attributes.
An exception SHOULD be recorded as an `Event` on the span during which it occurred.
The name of the event MUST be `"exception"`.

<!-- TODO: update to semconv tag once merged and released -->
**Status**: [Development](../document-status.md) - Refer to the [Recording Errors](https://github.com/open-telemetry/semantic-conventions/blob/c77c7d7866c943b357d1d26ffa2fa89b092f2b9f/docs/general/recording-errors.md) document for the details on how to report errors across signals.

A typical template for an auto-instrumentation implementing this semantic convention
using an [API-provided `recordException` method](api.md#record-exception)
could look like this (pseudo-Java):
Expand All @@ -26,7 +28,9 @@ Span span = myTracer.startSpan(/*...*/);
try {
// Code that does the actual work which the Span represents
} catch (Throwable e) {
span.recordException(e, Attributes.of("exception.escaped", true));
span.recordException(e);
span.setAttribute(AttributeKey.stringKey("error.type"), e.getClass().getCanonicalName())
span.setStatus(StatusCode.ERROR, e.getMessage());
throw e;
} finally {
span.end();
Expand All @@ -41,7 +45,7 @@ event name `exception`.
Additionally, the following attributes SHOULD be
filled out:

- `exception.escaped`
- [Deprecated](../document-status.md) `exception.escaped`
- `exception.message`
- `exception.stacktrace`
- `exception.type`
Expand Down

0 comments on commit 847e1a0

Please sign in to comment.