From 1e986d4f4f34a59eb295bcb799fb0bb4cd4e3377 Mon Sep 17 00:00:00 2001 From: Tigran Najaryan Date: Wed, 14 Dec 2022 16:27:06 -0500 Subject: [PATCH] Support maps and heterogeneous arrays as attribute values Resolves https://github.com/open-telemetry/opentelemetry-specification/issues/376 Use cases where this is necessary or useful: 1. Specify more than one resource in the telemetry: https://github.com/open-telemetry/opentelemetry-specification/issues/579 2. Data coming from external source, e.g. AWS Metadata: https://github.com/open-telemetry/opentelemetry-specification/pull/596#issuecomment-628983680 or https://github.com/open-telemetry/opentelemetry-specification/issues/376#issuecomment-1227501082 3. Capturing HTTP headers: https://github.com/open-telemetry/opentelemetry-specification/issues/376#issuecomment-908493520 4. Structured stack traces: https://github.com/open-telemetry/opentelemetry-specification/pull/2841 5. Payloads as attributes: https://github.com/open-telemetry/oteps/pull/219#discussion_r971065645 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. --- specification/common/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/specification/common/README.md b/specification/common/README.md index 0c1eb50c0be..cf6e5eaf138 100644 --- a/specification/common/README.md +++ b/specification/common/README.md @@ -27,12 +27,12 @@ aliases: [/docs/reference/specification/common/common] An `Attribute` is a key-value pair, which MUST have the following properties: - The attribute key MUST be a non-`null` and non-empty string. -- The attribute value is either: +- The attribute value can be of `any` type, where any is defined as one of the following: - A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer. - - A homogeneous array of values of primitive type. - - An array of any attribute values [since 1.15.0]. - - A key/value map, where key is string and value is any attribute value [since 1.15.0]. - + - A homogeneous array of values of primitive type [before 1.19.0]. + - An array of `any` values [since 1.19.0]. + - A key/value map, where key is string and value is `any` value [since 1.19.0]. + When exporting to protocols that do not natively support a particular non-string value type the following conversion SHOULD be performed: