You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support maps and heterogeneous arrays as attribute values
Resolvesopen-telemetry#376
Use cases where this is necessary or useful:
1. Specify more than one resource in the telemetry: open-telemetry#579
2. Data coming from external source, e.g. AWS Metadata: open-telemetry#596 (comment)
or open-telemetry#376 (comment)
3. Capturing HTTP headers: open-telemetry#376 (comment)
4. Structured stack traces: open-telemetry#2841
5. Payloads as attributes: open-telemetry/oteps#219 (comment)
This is a draft PR to see what the change looks like.
If this PR is merged it will be nice to follow it up with:
- A standard way of flattening maps and nested objects when converting from OTLP
to formats that don't support maps/nested objects.
- Recommendations for semantic conventions to use/not use complex objects.
|[Span linking](specification/trace/api.md#specifying-links)| Optional | Go | Java | JS | Python | Ruby | Erlang | PHP | Rust | C++ | .NET | Swift |
@@ -206,6 +207,7 @@ formats is required. Implementing more than one format is optional.
206
207
| The metrics SDK provides an `AlignedHistogramBucketExemplarReservoir` that is used by default for `ExplicitBucketHistogram` aggregation. ||| + || - |||||| - ||
207
208
| The metrics SDK provides an `ExemplarFilter` interface or extension point. | X || - || - ||| + ||| - ||
208
209
| An `ExemplarFilter` has access to the measurement value, attributes, `Context` and timestamp. | X || - || - ||| + ||| - ||
210
+
| Non-homogeneous arrays and maps (including nested) |||||||||||||
209
211
210
212
## Logs
211
213
@@ -234,6 +236,7 @@ Disclaimer: this list of features is still a work in progress, please refer to t
234
236
| Feature | Optional | Go | Java | JS | Python | Ruby | Erlang | PHP | Rust | C++ | .NET | Swift |
An `Attribute` is a key-value pair, which MUST have the following properties:
28
28
29
29
- The attribute key MUST be a non-`null` and non-empty string.
30
-
- The attribute value is either:
30
+
- The attribute value can be of `any` type, where any is defined as one of the following:
31
31
- A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer.
32
-
- An array of primitive type values. The array MUST be homogeneous,
33
-
i.e., it MUST NOT contain values of different types.
34
-
35
-
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 `[]`.
32
+
- A homogeneous array of values of primitive type [before 1.19.0].
33
+
- An array of `any` values [since 1.19.0].
34
+
- A key/value map, where key is string and value is `any` value [since 1.19.0].
35
+
36
+
Complex attribute types (such as homogenous arrays, arrays of any, and maps) SHOULD be
37
+
used sparingly, in situations where their use minimizes manipulation of the data’s
38
+
original structure.
39
+
40
+
When exporting to protocols that do not natively support a particular non-string
41
+
value type the value should be converted to a string JSON-encoding of the value.
42
+
43
+
For example, the expression `int64(100)` will be encoded as `100`, `float64(1.5)` will
44
+
be encoded as `1.5`, and an empty array of any type will be encoded as `[]`.
36
45
37
46
Attribute values expressing a numerical value of zero, an empty string, or an
38
47
empty array are considered meaningful and MUST be stored and passed on to
0 commit comments