Skip to content

Conversation

pellared
Copy link
Member

@pellared pellared commented Sep 8, 2025

Changes

  • Introduce of AnyValue type supporting complex data structures (empty value, byte arrays, heterogeneous arrays and maps).
  • Consolidate of attribute definitions across signals to use the unified AnyValue type.
  • Update attribute limits to accommodate new value types.
  • Remove "standard attribute" terminology in favor of general "attribute".

Extend attribute types

Prior-art (this PR guides towards this): #4636

Prototype: open-telemetry/opentelemetry-go#6809

Follows #4614

Related to #4602

Related proto PR: open-telemetry/opentelemetry-proto#707

https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/4485-extending-attributes-to-support-complex-values.md#how describes how languages should add support for new attribute value types.

OTEP changes

Notice that this PR has changed the strategy for https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/4485-extending-attributes-to-support-complex-values.md#api from:

OTel API MAY support setting complex attributes on metrics, resources, instrumentation scope, span events, and as identifying entity attribute

to simply:

OTel API MUST support setting complex attribute.

This is the agreement up to this point: #4651 (comment)

The other change in the OTEP is because of #4651 (comment).

Attribute limit updates

Towards #4487

This also proposes minimal and non-breaking additions for the attribute limits: https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/4485-extending-attributes-to-support-complex-values.md#attribute-limits.

The proposal for attribute count limit is proposed because of #4651 (comment).

  • Predictability: Users can more easily understand and predict when they'll hit the limit. Especially given the existing behavior of attribute count limit.
  • Practical usage: Maps are typically used as cohesive units of related data, so counting them as single attributes aligns with their semantic purpose. Without this rule, a single map attribute with many internal key-value pairs could quickly exhaust the attribute count limit, which would be surprising behavior for users.

The proposal for attribute value length limit seems the most logical to me.

pellared and others added 30 commits July 17, 2025 23:34
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.
Implementation MUST by default ensure that the exported attribute collections
Copy link
Member

Choose a reason for hiding this comment

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

This is partially duplicated above on line 80. Can we have this requirement consolidated in one place?

Copy link
Member Author

@pellared pellared Sep 18, 2025

Choose a reason for hiding this comment

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

We can do it after the part where line 80 is located is stable. Right now it is hard to consolidate.

- **Status**: [Development](../document-status.md) - if it is an array of [AnyValue](#anyvalue),
then apply the limit to each element of the array separately (and recursively),
- **Status**: [Development](../document-status.md) - if it is a [map](#mapstring-anyvalue),
then apply the limit to each value within the map separately (and recursively),
Copy link
Member

Choose a reason for hiding this comment

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

Applies only to the "value" of the map but not the "key" of the map?

Copy link
Member Author

@pellared pellared Sep 18, 2025

Choose a reason for hiding this comment

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

Correct. We were never applying limits for the keys. Moreover, the limit is called "attribute value limit".

@pellared pellared requested a review from Copilot September 24, 2025 11:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- **Status**: [Development](../document-status.md) - a byte array.
- **Status**: [Development](../document-status.md) - an array of `AnyValue`,
- **Status**: [Development](../document-status.md) - a [`map<string, AnyValue>`](#mapstring-anyvalue),
- **Status**: [Development](../document-status.md) - an empty value (e.g. `null`, `undefined` in JavaScript/TypeScript,
Copy link
Member

Choose a reason for hiding this comment

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

Why is this changing to now support null? It isn't able to be represented by the protos still, right? I know below it says to then convert to a value like 0 or false, but why allow it for AnyValue in the first place?

And can it change to say, "if supported by the language"? There is not a true null or undefined in Erlang and as this is written it sounds like there is need to support representing this rather than putting it on the user to do their own mapping to an allowed value like 0 or "" if they don't want a string representation of the atom they used to represent the lack of a value.

Copy link
Member Author

@pellared pellared Oct 6, 2025

Choose a reason for hiding this comment

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

Why is this changing to now support null?

It is currently supported by any from the Logs Data Model.

More context: #3853

And can it change to say, "if supported by the language"?

Personally, I am fine with this.

Copy link
Member Author

@pellared pellared Oct 6, 2025

Choose a reason for hiding this comment

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

@pellared pellared requested a review from tsloughter October 6, 2025 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:api Cross language API specification issue area:data-model For issues related to data model area:sdk Related to the SDK enhancement New feature or request entities spec:logs Related to the specification/logs directory spec:metrics Related to the specification/metrics directory spec:resource Related to the specification/resource directory spec:trace Related to the specification/trace directory
Projects
Status: In Progress
Status: In progress
Development

Successfully merging this pull request may close these issues.

6 participants