diff --git a/CHANGELOG.md b/CHANGELOG.md index 71ec5ceaeb6..a3ffc2288cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ release. - ⚠️ **IMPORTANT**: Extending the set of standard attribute value types is no longer a breaking change. ([#4614](https://github.com/open-telemetry/opentelemetry-specification/pull/4614)) +- Add empty value attribute. + ([#4595](https://github.com/open-telemetry/opentelemetry-specification/pull/4595)) ### Supplementary Guidelines diff --git a/specification/common/README.md b/specification/common/README.md index 82f634d5dc9..95ad05fbd08 100644 --- a/specification/common/README.md +++ b/specification/common/README.md @@ -8,7 +8,7 @@ path_base_for_github_subdir: # Common specification concepts -**Status**: [Stable](../document-status.md) +**Status**: [Stable](../document-status.md), except where otherwise specified
Table of Contents @@ -38,15 +38,13 @@ An `Attribute` is a key-value pair, which MUST have the following properties: - A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer. - An array of primitive type values. The array MUST be homogeneous, i.e., it MUST NOT contain values of different types. + - **Status**: [Development](../document-status.md) - An empty value (e.g. `null`). For protocols that do not natively support non-string values, non-string values SHOULD be represented as JSON-encoded strings. For example, the expression `int64(100)` will be encoded as `100`, `float64(1.5)` will be encoded as `1.5`, and an empty array of any type will be encoded as `[]`. -Attribute values expressing 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 not valid and attempting to set a `null` value is -undefined behavior. +Attribute values expressing an empty value, 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. `null` values SHOULD NOT be allowed in arrays. However, if it is impossible to make sure that no `null` values are accepted diff --git a/specification/common/attribute-type-mapping.md b/specification/common/attribute-type-mapping.md index e936eb1695c..d41ebc82979 100644 --- a/specification/common/attribute-type-mapping.md +++ b/specification/common/attribute-type-mapping.md @@ -13,6 +13,7 @@ linkTitle: Mapping to AnyValue - [Converting to AnyValue](#converting-to-anyvalue) * [Primitive Values](#primitive-values) + + [Empty Value](#empty-value) + [Integer Values](#integer-values) + [Enumerations](#enumerations) + [Floating Point Values](#floating-point-values) @@ -54,6 +55,12 @@ follow the rules described below. ### Primitive Values +#### Empty Value + +Empty values MUST be converted to AnyValue with no +[value](https://github.com/open-telemetry/opentelemetry-proto/blob/38b5b9b6e5257c6500a843f7fdacf89dd95833e8/opentelemetry/proto/common/v1/common.proto#L28-L30) +field being set. + #### Integer Values Integer values which are within the range of 64 bit signed numbers