You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Trade-offs and mitigations](#trade-offs-and-mitigations)
16
+
-[Prior art and alternatives](#prior-art-and-alternatives)
17
+
-[Open questions](#open-questions)
18
+
-[Future possibilities](#future-possibilities)
19
+
20
+
<!-- tocstop -->
21
+
3
22
This OTEP provides guidance on how to record exceptions using OpenTelemetry logs focusing on minimizing duplication and providing context to reduce the noise.
4
23
5
24
## Motivation
@@ -32,12 +51,12 @@ starting point, but they are encouraged to adjust it to their needs.
32
51
This guidance boils down to the following:
33
52
34
53
Instrumentations should record exception information (along with other context) on the log record and
35
-
use appropriate severity - only unhandled exceptions should be recorded as `Error` or higher. They
54
+
use appropriate severity - only unhandled exceptions should be recorded as `Error` or higher. Instrumentations
36
55
should strive to report each exception once.
37
56
38
-
Instrumentation should provide the whole exception instance to the OTel (instead of individual attributes)
39
-
and the OTel SDK should, based on user configuration, decide which information to record. As a default,
40
-
this OTEP proposes to record exception stack traces on log with `Error` or higher severity.
57
+
Instrumentations should provide the whole exception instance to the OTel (instead of individual attributes)
58
+
and the OTel SDK should, based on configuration, decide which information to record. As a default,
59
+
this OTEP proposes to record exception stack traces on logs with `Error` or higher severity.
41
60
42
61
### Details
43
62
@@ -47,7 +66,16 @@ this OTEP proposes to record exception stack traces on log with `Error` or highe
47
66
2. Instrumentations for incoming requests, message processing, background job execution, or others that wrap user code and usually create local root spans, should record logs
48
67
for unhandled exceptions with `Error` severity.
49
68
50
-
Some runtimes and frameworks provide global exception handler that can be used to record exception logs. Priority should be given to the instrumentation point where the operation context is available.
69
+
> [!NOTE]
70
+
>
71
+
> Top-level instrumentations is the only place non-native instrumentations should
72
+
> record exceptions.
73
+
74
+
Some runtimes provide global exception handler that can be used to log exceptions.
75
+
Priority should be given to the instrumentation point where the operation context is available.
76
+
Language SIGs are encouraged to give runtime-specific guidance. For example, here's
See [corresponding Java (tracing) instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/spring/spring-kafka-2.7/library/src/main/java/io/opentelemetry/instrumentation/spring/kafka/v2_7/InstrumentedRecordInterceptor.java) for the details.
285
+
231
286
## Trade-offs and mitigations
232
287
233
288
1. Breaking change for any component following existing [exception guidance](https://github.com/open-telemetry/opentelemetry-specification/blob/a265ae0628177be25dc477ea8fe200f1c825b871/specification/trace/exceptions.md) which recommends recording exceptions as span events in every instrumentation that detects them.
0 commit comments