Skip to content

Commit 847e1a0

Browse files
author
Liudmila Molkova
committed
Deprecate �xception.escaped attribute, update exception example, clean up semconv doc
1 parent 6d1e420 commit 847e1a0

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

specification/semantic-conventions.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,29 @@ OpenTelemetry defines its semantic conventions in a separate repository:
1111

1212
Semantic conventions MUST provide the following attributes:
1313

14-
- Resource
15-
- `service.name`
16-
- `telemetry.sdk.language`
17-
- `telemetry.sdk.name`
18-
- `telemetry.sdk.version`
19-
- Event
20-
- `exception.escaped`
21-
- `exception.message`
22-
- `exception.stacktrace`
23-
- `exception.type`
14+
- [`error.type`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/error.md#error-type)
15+
- [`exception.message`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/exception.md#exception-message)
16+
- [`exception.stacktrace`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/exception.md#exception-stacktrace)
17+
- [`exception.type`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/exception.md#exception-type)
18+
- [`server.address`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/server.md#server-address)
19+
- [`server.port`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/server.md#server-port)
20+
- [`service.name`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/service.md#service-name)
21+
- [`telemetry.sdk.language`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/telemetry.md#telemetry-sdk-language)
22+
- [`telemetry.sdk.name`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/telemetry.md#telemetry-sdk-name)
23+
- [`telemetry.sdk.version`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/telemetry.md#telemetry-sdk-version)
24+
- [`url.scheme`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/url.md#url-scheme)
25+
26+
Semantic conventions MUST provide the following events:
27+
28+
- [`exception`](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/exceptions/exceptions-spans.md)
2429

2530
## In-development Reserved Attributes
2631

2732
Semantic conventions MUST provide the following attributes:
2833

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

3536
## Reserved Namespace
3637

3738
The `otel.*` namespace is reserved for defining compatibility with
38-
non-opentelemetry technologies.
39+
non-OpenTelemetry technologies.

specification/trace/exceptions.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Exceptions
22

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

5-
This document defines how to record exceptions and
6-
their required attributes.
5+
This document defines how to record exceptions and their attributes.
76

87
<!-- toc -->
98

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

19+
<!-- TODO: update to semconv tag once merged and released -->
20+
**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.
21+
2022
A typical template for an auto-instrumentation implementing this semantic convention
2123
using an [API-provided `recordException` method](api.md#record-exception)
2224
could look like this (pseudo-Java):
@@ -26,7 +28,9 @@ Span span = myTracer.startSpan(/*...*/);
2628
try {
2729
// Code that does the actual work which the Span represents
2830
} catch (Throwable e) {
29-
span.recordException(e, Attributes.of("exception.escaped", true));
31+
span.recordException(e);
32+
span.setAttribute(AttributeKey.stringKey("error.type"), e.getClass().getCanonicalName())
33+
span.setStatus(StatusCode.ERROR, e.getMessage());
3034
throw e;
3135
} finally {
3236
span.end();
@@ -41,7 +45,7 @@ event name `exception`.
4145
Additionally, the following attributes SHOULD be
4246
filled out:
4347

44-
- `exception.escaped`
48+
- [Deprecated](../document-status.md) `exception.escaped`
4549
- `exception.message`
4650
- `exception.stacktrace`
4751
- `exception.type`

0 commit comments

Comments
 (0)