Status: Deprecated, follow the semantic conventions for recording exceptions instead.
This document defines how to record exceptions and their attributes.
An exception SHOULD be recorded as an Event on the span during which it occurred
if and only if it remains unhandled when the span ends and causes the span status
to be set to ERROR.
The name of the event MUST be "exception".
A typical template for an auto-instrumentation implementing this semantic convention
using an API-provided recordException method
could look like this (pseudo-Java):
Span span = myTracer.startSpan(/*...*/);
try {
// Code that does the actual work which the Span represents
} catch (Throwable e) {
span.recordException(e);
span.setAttribute(AttributeKey.stringKey("error.type"), e.getClass().getCanonicalName())
span.setStatus(StatusCode.ERROR, e.getMessage());
throw e;
} finally {
span.end();
}An event representing an exception MUST have an
event name exception.
Additionally, the following attributes SHOULD be filled out:
exception.messageexception.stacktraceexception.type
The format and semantics of these attributes are defined in semantic conventions.