Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ release.
- Add in-development guidance recommending a JSON object as the string
representation for an attribute in non-OTLP protocols.
([#5028](https://github.com/open-telemetry/opentelemetry-specification/pull/5028))
- Add in-development guidance recommending a JSON object as the string
representation for an attribute collection in non-OTLP protocols.
([#5110](https://github.com/open-telemetry/opentelemetry-specification/pull/5110))

### OpenTelemetry Protocol

Expand Down
29 changes: 27 additions & 2 deletions specification/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ path_base_for_github_subdir:
+ [Maps](#maps)
- [Attribute](#attribute)
* [Attribute representation for non-OTLP](#attribute-representation-for-non-otlp)
* [Attribute Collections](#attribute-collections)
- [Attribute Collections](#attribute-collections)
* [Attribute Collection representation for non-OTLP](#attribute-collection-representation-for-non-otlp)
- [Attribute Limits](#attribute-limits)
* [Configurable Parameters](#configurable-parameters)
* [Exempt Entities](#exempt-entities)
Expand Down Expand Up @@ -233,7 +234,7 @@ Examples: `{"http.request.method": "GET"}`, `{"retries": 3}`,
> (particularly for floating point numbers and large integers that exceed the
> precision capabilities of the receiving system's string-to-number conversion).

### Attribute Collections
## Attribute Collections

[Resources](../resource/sdk.md),
[Instrumentation Scopes](instrumentation-scope.md),
Expand Down Expand Up @@ -284,6 +285,30 @@ Collection of attributes are equal when they contain the same attributes,
irrespective of the order in which those elements appear
(unordered collection equality).

### Attribute Collection representation for non-OTLP

**Status**: [Development](../document-status.md)

For non-OTLP protocols that need to represent an Attribute Collection as a
string, the RECOMMENDED form is a
[JSON object](https://datatracker.ietf.org/doc/html/rfc8259#section-4).

Each attribute key SHOULD be represented as a JSON object member name.

Each attribute value SHOULD be represented as the corresponding JSON object
member value and follow the encoding rules defined in
[AnyValue representation for non-OTLP protocols](#anyvalue-representation-for-non-otlp-protocols),
as it would be represented as an element in an [array](#arrays) and a value in
a [map](#maps).

This representation follows the same JSON object form as [maps](#maps), but
applies to top-level Attribute Collections rather than nested
[`map<string, AnyValue>`](#mapstring-anyvalue) values.

Examples: `{}`, `{"http.request.method": "GET", "retries": 3}`,
`{"payload": "aGVsbG8gd29ybGQ=", "session.id": null}`,
`{"colors": ["red", "blue"], "context": {"nested": true}}`

## Attribute Limits

Execution of erroneous code can result in unintended attributes. If there are no
Expand Down
Loading