Skip to content
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

[WIP] Deprecate exception.escaped attribute, update exception example #4368

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading