Skip to content

Commit 110aed2

Browse files
pellaredMrAliasCopilotlmolkovamartincostello
authored
Extend the set of attribute value types (#4651)
## 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. - Allow attribute collections to contain duplicate keys via an opt-in configuration (as this is [allowed for log attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#type-mapstring-any)). - 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. Closes #4460 (no longer needed - feature is removed) ### 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. ## Comments to be addressed as followups I am going to create issues to be created after this is PR merged: - #4651 (comment) - #4651 (comment) - #4651 (comment) --------- Co-authored-by: Tyler Yahn <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Liudmila Molkova <[email protected]> Co-authored-by: Martin Costello <[email protected]>
1 parent e9e1665 commit 110aed2

22 files changed

+125
-97
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ release.
3131

3232
### Common
3333

34+
- Extend the set of attribute value types to support more complex data structures.
35+
([#4651](https://github.com/open-telemetry/opentelemetry-specification/pull/4651))
36+
3437
### Supplementary Guidelines
3538

3639
### OTEPs

oteps/4485-extending-attributes-to-support-complex-values.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* [Configurable OTLP exporter behavior (both SDK and Collector)](#configurable-otlp-exporter-behavior-both-sdk-and-collector)
2424
* [Record pointer to repetitive data](#record-pointer-to-repetitive-data)
2525
- [Backend research](#backend-research)
26+
- [Appendix](#appendix)
2627

2728
<!-- tocstop -->
2829

@@ -94,7 +95,7 @@ extending the standard attributes provides a more seamless and user-friendly API
9495

9596
Currently, the SDK specification has a clause that says extending
9697
the set of standard attribute would be
97-
[considered a breaking change](/specification/common/README.md#standard-attribute).
98+
[considered a breaking change](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/common/README.md#standard-attribute).
9899

99100
We believe that removing this clause and extending standard
100101
attributes can be done gracefully across the OpenTelemetry ecosystem
@@ -309,3 +310,9 @@ for additional details.
309310

310311
> [!NOTE]
311312
> This list only reflects the behavior at the time of writing and may change in the future.
313+
314+
## Appendix
315+
316+
The [Extend the set of attribute value types #4651](https://github.com/open-telemetry/opentelemetry-specification/pull/4651) PR implements part of this OTEP by requiring that both the OTel API and SDK MUST support complex attributes.
317+
Some languages aim to support complex attributes for all kinds of telemetry.
318+
To maintain consistency across languages, we agreed that all languages should provide the same level of support for complex attributes.

oteps/entities/0256-entities-data-model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ MAY change over the lifetime of the entity. MAY be empty. These
139139
attributes are not part of entity's identity.
140140
<p>
141141
Follows <a
142-
href="../../specification/logs/data-model.md#type-any">any</a>
142+
href="https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/logs/data-model.md#type-any">any</a>
143143
value definition in the OpenTelemetry spec - it can be a scalar value,
144144
byte array, an array or map of values. Arbitrary deep nesting of values
145145
for arrays and maps is allowed.
@@ -682,7 +682,7 @@ There are a couple of reasons:
682682
### Attribute Data Type
683683

684684
The data model requires the Attributes field to use the extended
685-
[any](../../specification/logs/data-model.md#type-any)
685+
[any](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/logs/data-model.md#type-any)
686686
attribute values, that allows more complex data types. This is different from the data
687687
type used by the Id field, which is more restricted in the shape.
688688

spec-compliance-matrix.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ Disclaimer: this list of features is still a work in progress, please refer to t
199199
| LoggerProvider.Shutdown | | | + | | + | + | | + | | + | - | |
200200
| LoggerProvider.ForceFlush | | | + | | + | + | | + | | + | - | |
201201
| Logger.Emit(LogRecord) | | | + | | + | + | | + | | + | - | |
202-
| Reuse Standard Attributes | X | + | | | | | | | | | | |
203202
| LogRecord.Set EventName | | + | | | | | | | + | + | | |
204203
| Logger.Enabled | X | + | | | | | | + | + | + | | |
205204
| SimpleLogRecordProcessor | | | + | | + | + | | + | | + | | |

spec-compliance-matrix/cpp.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@ sections:
357357
status: '+'
358358
- name: Logger.Emit(LogRecord)
359359
status: '+'
360-
- name: Reuse Standard Attributes
361-
status: '?'
362360
- name: LogRecord.Set EventName
363361
status: '+'
364362
- name: Logger.Enabled

spec-compliance-matrix/dotnet.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@ sections:
357357
status: '-'
358358
- name: Logger.Emit(LogRecord)
359359
status: '-'
360-
- name: Reuse Standard Attributes
361-
status: '?'
362360
- name: LogRecord.Set EventName
363361
status: '?'
364362
- name: Logger.Enabled

spec-compliance-matrix/erlang.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@ sections:
357357
status: '?'
358358
- name: Logger.Emit(LogRecord)
359359
status: '?'
360-
- name: Reuse Standard Attributes
361-
status: '?'
362360
- name: LogRecord.Set EventName
363361
status: '?'
364362
- name: Logger.Enabled

spec-compliance-matrix/go.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@ sections:
357357
status: '?'
358358
- name: Logger.Emit(LogRecord)
359359
status: '?'
360-
- name: Reuse Standard Attributes
361-
status: '+'
362360
- name: LogRecord.Set EventName
363361
status: '+'
364362
- name: Logger.Enabled

spec-compliance-matrix/java.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@ sections:
357357
status: '+'
358358
- name: Logger.Emit(LogRecord)
359359
status: '+'
360-
- name: Reuse Standard Attributes
361-
status: '?'
362360
- name: LogRecord.Set EventName
363361
status: '?'
364362
- name: Logger.Enabled

spec-compliance-matrix/js.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@ sections:
357357
status: '?'
358358
- name: Logger.Emit(LogRecord)
359359
status: '?'
360-
- name: Reuse Standard Attributes
361-
status: '?'
362360
- name: LogRecord.Set EventName
363361
status: '?'
364362
- name: Logger.Enabled

0 commit comments

Comments
 (0)