Skip to content

Commit 4f71c16

Browse files
authored
Prohibit attribute value from evolving to contain complex types (#3858)
If we aren't going to accept complex attribute types (#2888) we should explicitly rule them out of future designs. Doing so cements the idea that attributes are "metadata" instead of "data", since if attributes were data, we would not want to artificially limit their structure. Once its clear that attributes are metadata and restricted to a limited set of types, its easy to determine that use cases which require complex types (like event payloads) should seek to put the data elsewhere (like in a log record body). While I was in favor of supporting complex attribute types (#2888) I believe its more important that we commit one way or the other. The uncertainty around the question of whether this type of evolution will occur has muddied the waters of several related conversations. There was consensus on codifying this in the 1/30/24 spec SIG meeting. We should capitalize on this momentum and get this over the finish line. Stalling out just to revisit this same debate in the future is a bad use of time.
1 parent 3cfd5ad commit 4f71c16

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

specification/common/README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ path_base_for_github_subdir:
1616
<!-- toc -->
1717

1818
- [Attribute](#attribute)
19+
* [Standard Attribute](#standard-attribute)
1920
* [Attribute Limits](#attribute-limits)
2021
+ [Configurable Parameters](#configurable-parameters)
2122
+ [Exempt Entities](#exempt-entities)
@@ -33,7 +34,7 @@ An `Attribute` is a key-value pair, which MUST have the following properties:
3334

3435
- The attribute key MUST be a non-`null` and non-empty string.
3536
- Case sensitivity of keys is preserved. Keys that differ in casing are treated as distinct keys.
36-
- The attribute value is either:
37+
- The attribute value is either[1]:
3738
- A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer.
3839
- An array of primitive type values. The array MUST be homogeneous,
3940
i.e., it MUST NOT contain values of different types.
@@ -65,6 +66,38 @@ See [Requirement Level](https://github.com/open-telemetry/semantic-conventions/b
6566
See [this document](attribute-type-mapping.md) to find out how to map values obtained
6667
outside OpenTelemetry into OpenTelemetry attribute values.
6768

69+
**[1]**: NOTE: extending the set of attribute value types is a breaking change.
70+
This was decided after extensive debate, with arguments as follows:
71+
72+
* Limiting the types of attribute values to a set which has proved sufficient
73+
during several years of OpenTelemetry's development is a useful guardrail for
74+
design. In taking additional value types off the table, we narrow the solution
75+
space and have more productive design conversations.
76+
* We proposed extending support for complex value types and received significant
77+
pushback. Removing the bounds significantly increases the burden on data
78+
consumers. Adding additional simple value types doesn't cause the same level
79+
of burden, but these can be encoded using existing primitive types. For
80+
example, datetime can be encoded as a string or 64 bit integer.
81+
* Limiting attribute value types to primitives and arrays of primitives supports
82+
OpenTelemetry's intent that attributes are metadata, and facilitates the
83+
ability for data consumers to create search indexes and perform other
84+
statistical analysis.
85+
86+
### Standard Attribute
87+
88+
Attributes are used in various places throughout the OpenTelemetry data model.
89+
We designate the [previous attribute section](#attribute) as the standard
90+
attribute definition, in order to facilitate more intuitive and consistent API /
91+
SDK design.
92+
93+
The standard attribute definition SHOULD be used to represent attributes in data
94+
modeling unless there is a strong justification to diverge. For example, the Log
95+
Data Model has an extended [attributes](../logs/data-model.md#field-attributes)
96+
definition allowing values of [type `Any`](../logs/data-model.md#type-any). This
97+
reflects that LogRecord attributes are expected to model data produced from
98+
external log APIs, which do not necessarily have the same value type
99+
restrictions as the standard attribute definition.
100+
68101
### Attribute Limits
69102

70103
Execution of erroneous code can result in unintended attributes. If there are no

0 commit comments

Comments
 (0)