Skip to content
Closed
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ release.

### Common

- Add empty value attribute.
([#4595](https://github.com/open-telemetry/opentelemetry-specification/pull/4595))

### Supplementary Guidelines

### OTEPs
Expand Down
27 changes: 5 additions & 22 deletions specification/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<details>
<summary>Table of Contents</summary>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -83,21 +81,6 @@ reflects that LogRecord attributes are expected to model data produced from
external log APIs, which do not necessarily have the same value type
restrictions as the standard attribute definition.

Note: Extending the set of standard attribute value types is a breaking change.
Copy link
Member

@lmolkova lmolkova Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to start with proto changes and replace comments like https://github.com/open-telemetry/opentelemetry-proto/blob/be5d58470429d0255ffdd49491f0815a3a63d6ef/opentelemetry/proto/trace/v1/trace.proto#L209-L213

// The OpenTelemetry API specification further restricts the allowed value types:
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).

(as per https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/4485-extending-attributes-to-support-complex-values.md#proto)

we probably need to replace it with comment that they are going to be allowed in 6 months

- Stable exporters will be prohibited from emitting complex attributes by default on signals
other than Logs until at least 6 months after this OTEP is merged.


Or, at least, leave a note here that complex attributes are coming and their support is in development, nobody should stabilize them in the next 6 month.

Copy link
Member Author

@pellared pellared Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably need to replace it with comment that they are going to be allowed in 6 months

I feel like this is an orthogonal PR given the changes of https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute are marked with Development status.

Moreover, this PR does not make the existing comment invalid and should block this PR.

Therefore, I think a PR in proto repo can be done in parallel.
I am not sure how we want to update the comment in proto repo as of today.
Are you able to help with it?

EDIT: I tried to come up with a PR in the proto repo. PTAL:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in the SIG meeting, we agreed to reintroduce this "note" in this PR, since it’s clearer to handle the broader change in a separate PR. That separate PR will:

  • communicate that we’ve revised the decision and will now allow the addition of new attribute types (which is not considered a major change),
  • clarify that introducing new attribute types will require a minor version bump in the OTLP (proto) repository.

This PR will be blocked until that separate PR is merged.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created #4602 for tracking.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lmolkova, can you please block this PR (request changes) with e.g. following comment:

Blocked by:
- https://github.com/open-telemetry/opentelemetry-specification/issues/4602

so that it is not accidentally merged?

This was decided after extensive debate, with arguments as follows:

* Limiting the types of attribute values to a set which has proved sufficient
during several years of OpenTelemetry's development is a useful guardrail for
design. In taking additional value types off the table, we narrow the solution
space and have more productive design conversations.
* Upon proposing to extend support for complex value types, we received significant
pushback. Limiting attribute value types to primitives and arrays of primitives
simplifies data consumers' efforts to create search indexes and perform statistical
analysis.
* To address concerns over restricting standard attributes to primitive types, it was
called out that complex types can be encoded as existing primitive types, such as
representing datetime as a string or 64 bit integer.

### Attribute Limits

Execution of erroneous code can result in unintended attributes. If there are no
Expand Down
7 changes: 7 additions & 0 deletions specification/common/attribute-type-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Loading