opentelemetry-specification
opentelemetry-specification copied to clipboard
Clarify acceptable values for span status ERROR descriptions
In particular, is it ok for instrumentation to populate span status ERROR description with exception.message
or exception.type
?
This is the current specification text:
When the status is set to
Error
by Instrumentation Libraries, theDescription
SHOULD be documented and predictable. The status code should only be set toError
according to the rules defined within the semantic conventions. For operations not covered by the semantic conventions, Instrumentation Libraries SHOULD publish their own conventions, including possible values ofDescription
and what they mean.
Based on this, I would interpret both exception.message
and exception.type
as generally not ok in most cases (where the specific values depend on the application being instrumented and so cannot be listed out ahead of time by the instrumentation).
However, as @Oberon00 points out in https://github.com/open-telemetry/opentelemetry-specification/issues/3198#issuecomment-1529506487 and https://github.com/open-telemetry/opentelemetry-specification/issues/3198#issuecomment-1541516656, there are existing SDKs and Instrumentations which are populating the exception.message
into the span status description, e.g.
- https://github.com/open-telemetry/opentelemetry-python/blob/v1.17.0/opentelemetry-sdk/src/opentelemetry/sdk/trace/init.py#L951
- https://github.com/open-telemetry/opentelemetry-dotnet/blob/fea6793a5590a18ff6d5e99460f9dfd8cf4c95b2/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs#L248