Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define null as a valid attribute value #971

Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Updates:
and `RECORD_AND_SAMPLE` for consistency
([#938](https://github.com/open-telemetry/opentelemetry-specification/pull/938),
[#956](https://github.com/open-telemetry/opentelemetry-specification/pull/956))
- Define `null` as a valid span attribute value
([#971](https://github.com/open-telemetry/opentelemetry-specification/pull/971))

## v0.6.0 (07-01-2020)

Expand Down
1 change: 1 addition & 0 deletions spec-compliance-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ status of the feature is not known.
|Boolean type | + | + | + | + | + | + | + | + | + | + |
|Double floating-point type | + | + | + | + | + | + | - | + | + | + |
|Signed int64 type | + | + | + | + | + | + | - | + | + | + |
|Null values are recorded | | | | | | | | | | |
|Array of primitives (homogeneous) | + | + | + | + | + | - | + | + | + | + |
|Unicode support for keys and string values | + | + | + | + | + | + | + | + | + | + |
|[Span linking](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#add-links)|
Expand Down
17 changes: 10 additions & 7 deletions specification/common/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,26 @@ Attributes are a list of zero or more key-value pairs. An `Attribute` MUST have

- The attribute key, which MUST be a non-`null` and non-empty string.
- The attribute value, which is either:
- A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer.
- A primitive type: string, boolean, double precision floating point (IEEE 754-1985), signed 64 bit integer, or null
- An array of primitive type values. The array MUST be homogeneous,
i.e. it MUST NOT contain values of different types. For protocols that do
not natively support array values such values SHOULD be represented as JSON strings.

arminru marked this conversation as resolved.
Show resolved Hide resolved
Attributes SHOULD preserve the order in which they're set.

Attribute values expressing a numerical value of zero, an empty string, or an
Attribute values expressing `null`, a numerical value of zero, an empty string, or an
empty array are considered meaningful and MUST be stored and passed on to
processors / exporters. Attribute values of `null` are considered to be not set
and get discarded as if that `Attribute` has never been created.
As an exception to this, if overwriting of values is supported, this results in
removing the attribute.
processors / exporters.

If exporters do not support exporting `null` values, they SHOULD discard the attribute as if it was
never there in the first place.
They SHOULD NOT replace it with any value that would be valid for some non-null attribute type (using
default values like an empty string, `0` or a `false`, for example, could cause wrong interpretations
on the consumer side more likely than not sending the attribute at all).

`null` values within arrays MUST be preserved as-is (i.e., passed on to span
processors / exporters as `null`). If exporters do not support exporting `null`
values, they MAY replace those values by 0, `false`, or empty strings.
values in arrays, they MAY replace those values by 0, `false`, or empty strings.
This is required for map/dictionary structures represented as two arrays with
indices that are kept in sync (e.g., two attributes `header_keys` and `header_values`,
both containing an array of strings to represent a mapping
Expand Down