Skip to content

Commit cfdec0d

Browse files
CodeBlanchcijothomasyurishkuro
authored
Map Error Status to error tag in Zipkin & Jaeger (open-telemetry#1257)
* Added mapping of Error Status to error flag in Zipkin & Jaeger exporters. * Zipkin error flag is now an empty string. * Restored uppercase for status enum values. * Removed the error text under attributes. * Casing fix. * Review feedback. * Added back information about removing error flag when false. * Updated CHANGELOG. * Update specification/trace/sdk_exporters/jaeger.md Co-authored-by: Yuri Shkuro <[email protected]> * Review feedback. Co-authored-by: Cijo Thomas <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
1 parent 8cb9414 commit cfdec0d

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Updates:
1717
([#1219](https://github.com/open-telemetry/opentelemetry-specification/pull/1219))
1818
- Add RPC semantic conventions for metrics
1919
([#1162](https://github.com/open-telemetry/opentelemetry-specification/pull/1162))
20+
- Clarify `Description` usage on `Status` API
21+
([#1257](https://github.com/open-telemetry/opentelemetry-specification/pull/1257))
22+
- Add/Update `Status` + `error` mapping for Jaeger & Zipkin Exporters
23+
([#1257](https://github.com/open-telemetry/opentelemetry-specification/pull/1257))
2024

2125
## v0.7.0 (11-18-2020)
2226

spec-compliance-matrix.md

+3
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ status of the feature is not known.
158158
|Boolean attributes | + | + | + | + | | + | + | + | | + |
159159
|Array attributes | + | + | + | [-](https://github.com/open-telemetry/opentelemetry-python/issues/1110) | | + | + | + | | + |
160160
|Status mapping | + | + | + | + | | + | + | + | | + |
161+
|Error Status mapping | | | | | | | | | | + |
161162
|Event attributes mapping to Annotations | + | + | + | + | | + | + | + | | + |
162163
|Integer microseconds in timestamps | | + | | + | | | | | | + |
163164
|[Jaeger](specification/trace/sdk_exporters/jaeger.md)|
@@ -167,6 +168,8 @@ status of the feature is not known.
167168
|Service name mapping | | | | + | | | | | | + |
168169
|Resource to Process mapping | | | | [-](https://github.com/open-telemetry/opentelemetry-python/issues/1436) | | | | | | + |
169170
|InstrumentationLibrary mapping | | | | + | | | | | | + |
171+
|Status mapping | | | | | | | | | | + |
172+
|Error Status mapping | | | | | | | | | | + |
170173
|Events converted to Logs | | | | + | | | | | | + |
171174
|OpenCensus|
172175
|TBD|

specification/trace/api.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ status, which is `Unset`.
516516

517517
- `StatusCode`, one of the values listed below.
518518
- Optional `Description` that provides a descriptive message of the `Status`.
519+
`Description` MUST only be used with the `Error` `StatusCode` value.
519520

520521
`StatusCode` is one of the following values:
521522

@@ -529,10 +530,11 @@ status, which is `Unset`.
529530

530531
The Span interface MUST provide:
531532

532-
- An API to set the `Status`. This SHOULD be called `SetStatus`.
533-
This API takes the `StatusCode`, and an optional `Description`, either as
534-
individual parameters or as an immutable object encapsulating them, whichever
535-
is most appropriate for the language.
533+
- An API to set the `Status`. This SHOULD be called `SetStatus`. This API takes
534+
the `StatusCode`, and an optional `Description`, either as individual
535+
parameters or as an immutable object encapsulating them, whichever is most
536+
appropriate for the language. `Description` MUST be IGNORED for `StatusCode`
537+
`Ok` & `Unset` values.
536538

537539
The status code SHOULD remain unset, except for the following circumstances:
538540

specification/trace/sdk_exporters/jaeger.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,20 @@ TBD
4040

4141
### Status
4242

43-
TBD
43+
Span `Status` MUST be reported as a key-value pair in `tags` to Jaeger, unless it is `UNSET`.
44+
In the latter case it MUST NOT be reported.
45+
46+
The following table defines the OpenTelemetry `Status` to Jaeger `tags` mapping.
47+
48+
| Status|Tag Key| Tag Value |
49+
|--|--|--|
50+
|Code | `otel.status_code` | Name of the code, either `OK` or `ERROR`. MUST NOT be set if the code is `UNSET`. |
51+
|Description | `otel.status_description` | Description of the `Status` if it has a value otherwise not set. |
52+
53+
### Error flag
54+
55+
When Span `Status` is set to `ERROR` an `error` tag MUST be added with the
56+
Boolean value of `true`. The added `error` tag MAY override any previous value.
4457

4558
### Events
4659

specification/trace/sdk_exporters/zipkin.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ convention](../semantic_conventions/README.md)
127127
document maps to the strongly-typed fields of Zipkin spans.
128128

129129
Primitive types MUST be converted to string using en-US culture settings.
130-
Boolean values must use lower case strings `"true"` and `"false"`, except an
131-
attribute named `error`. In case if value of the attribute is `false`, Zipkin
132-
tag needs to be omitted.
130+
Boolean values MUST use lower case strings `"true"` and `"false"`.
133131

134132
Array values MUST be serialized to string like a JSON list as mentioned in
135133
[semantic conventions](../../overview.md#semantic-conventions).
@@ -146,7 +144,11 @@ The following table defines the OpenTelemetry `Status` to Zipkin `tags` mapping.
146144
| Status|Tag Key| Tag Value |
147145
|--|--|--|
148146
|Code | `otel.status_code` | Name of the code, either `OK` or `ERROR`. MUST NOT be set if the code is `UNSET`. |
149-
|Message *(optional)* | `otel.status_description` | `{message}` |
147+
|Description| `error` | Description of the `Status`. MUST be set if the code is `ERROR`, use an empty string if Description has no value. MUST NOT be set for `OK` and `UNSET` codes. |
148+
149+
Note: The `error` tag should only be set if `Status` is `Error`. If a boolean
150+
version (`{"error":false}` or `{"error":"false"}`) is present, it SHOULD be
151+
removed. Zipkin will treat any span with `error` sent as failed.
150152

151153
### Events
152154

0 commit comments

Comments
 (0)