-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add blog covering complex attributes #8127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tiffany76
merged 19 commits into
open-telemetry:main
from
lmolkova:complex-attributes-blog
Nov 5, 2025
Merged
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b6e03ff
Complex attributes blog
lmolkova 2f10a42
up
lmolkova cc45ca5
up
lmolkova bcd412d
Apply suggestions from code review
lmolkova 7cdc94d
address review feedback
lmolkova baf54a1
Merge branch 'main' into complex-attributes-blog
lmolkova cebea1c
lint
lmolkova ddbb4d7
Apply suggestions from code review
lmolkova 41aabb0
review
lmolkova b94cf11
Apply suggestions from code review
lmolkova 1666c8b
more review
lmolkova 9536b4e
Merge branch 'main' into complex-attributes-blog
lmolkova b34ea03
format
lmolkova 39f8bad
Results from /fix directive
otelbot[bot] 49b30fe
Apply suggestion from @tiffany76
lmolkova 394fd3f
Apply suggestion from @tiffany76
lmolkova 5b7d8fd
Apply suggestion from @tiffany76
lmolkova 8312c6b
Apply suggestion from @tiffany76
lmolkova 20d9d8c
Merge branch 'main' into complex-attributes-blog
lmolkova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| --- | ||
| title: Announcing Support for Complex Attribute Types in OTel | ||
| linkTitle: Announcing Support for Complex Attribute Types in OTel | ||
| date: 2025-10-20 | ||
| author: >- | ||
| [Liudmila Molkova](https://github.com/lmolkova) (Grafana Labs), [Robert | ||
| Pajak](https://github.com/pellared) (Splunk), [Trask | ||
| Stalnaker](https://github.com/trask) (Microsoft), [Austin | ||
| Parker](https://github.com/austinlparker) (honeycomb.io) | ||
| cSpell:ignore: Liudmila Molkova Pajak | ||
| --- | ||
|
|
||
| It’s common to use simple key-value properties as attributes in telemetry. Most | ||
| telemetry backends are optimized for this pattern, making it efficient to store, | ||
| index, and query data. | ||
|
|
||
| OpenTelemetry is designed with this in mind. Semantic conventions and | ||
| instrumentations aim to provide useful attributes that can be easily filtered | ||
| and aggregated. | ||
|
|
||
| But what happens when the data itself is complex? OpenTelemetry also strives to | ||
| capture observability for real systems, libraries, and applications that | ||
| naturally expose complex properties. | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
|
|
||
| In this post, we’re announcing support for capturing complex data across all | ||
| OTel signals via the OTel APIs and SDKs. We’ll cover when and how to use complex | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
| data, when to avoid it, and how backends can start supporting it. | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Announcing support for complex attribute types in OTel | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
|
|
||
| OpenTelemetry APIs and SDKs are adding support for the following attribute types | ||
| on all signals: | ||
|
|
||
| - Maps | ||
| - Heterogeneous arrays | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
| - Byte arrays | ||
| - Empty values | ||
|
|
||
| Until recently, these types were supported only on logs - attributes on other | ||
| signals were limited to primitives and arrays of primitives. | ||
|
|
||
| Following | ||
| [OTEP 4485: Extending attributes to support complex values](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.49.0/oteps/4485-extending-attributes-to-support-complex-values.md) | ||
| this support is being extended to all OTel signals. | ||
|
|
||
| Use the new attribute types, especially maps and heterogeneous arrays, with | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
| care. Many observability backends are not optimized to query, index, or | ||
| aggregate complex attributes. Semantic conventions will assume complex | ||
| attributes are not indexable and will avoid using them on metrics or in other | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
| scenarios where efficient querying is important. | ||
|
|
||
| When possible, stick to primitives and arrays of primitives. | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Why are we doing this? | ||
|
|
||
| As we work on semantic conventions and instrumentations, we increasingly | ||
| encounter cases where flat attributes cannot reasonably capture the complexity | ||
| of real-world scenarios. | ||
|
|
||
| Examples include: | ||
|
|
||
| - **[LLM operations](/docs/specs/semconv/gen-ai/non-normative/examples-llm-calls)** | ||
| — input parameters like tool definitions and input/output messages are | ||
| inherently structured | ||
| - **GraphQL** — responses may include | ||
| [lists of structured errors](https://graphql.org/learn/response/#errors) | ||
| - **[Database operations](/docs/specs/semconv/database/database-spans)** | ||
| — batch operations have properties that flat attributes cannot adequately | ||
| capture | ||
|
|
||
| Before extending support for complex attributes to all signals, we explored | ||
| several alternatives: | ||
|
|
||
| **Limiting support to logs (and spans).** Having different attribute collection | ||
| types for different signals affects API ergonomics, making it less convenient | ||
| and efficient to work with attributes. | ||
|
|
||
| **Flattening.** | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
|
|
||
| Flattening works well for maps of primitives but breaks down for arrays. For | ||
| example, structured data like: | ||
|
|
||
| ```json | ||
| { | ||
| "data": [ | ||
| { | ||
| "foo": "bar", | ||
| "baz": 42 | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| is reported as either: | ||
|
|
||
| ```text | ||
| data.0.foo = "bar" | ||
| data.0.baz = 42 | ||
| ``` | ||
|
|
||
| or: | ||
|
|
||
| ```text | ||
| data.foo = ["bar"] | ||
| data.baz = [ 42 ] | ||
| ``` | ||
|
|
||
| Both approaches are limited and lead to a poor user experience. | ||
|
|
||
| **String serialization.** | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
|
|
||
| Another option is requiring users or instrumentations to serialize complex data | ||
| into strings. While workable, this risks inconsistencies and errors. It also | ||
| limits post-processing and leads to poor truncation strategies. Ultimately, it | ||
| should be the backend’s decision whether to preserve the structure or serialize | ||
| the data. Handling serialization at the backend side provides greater | ||
| consistency and convenience for end users. | ||
|
|
||
| ## As a backend, how should I support complex attributes? | ||
|
|
||
| We encourage backends to build user experiences that leverage structured | ||
| attribute values, allowing users to query data based on nested properties. | ||
|
|
||
| In the meantime, we recommend serializing complex attributes to JSON (or another | ||
| suitable format) at ingestion time. | ||
|
|
||
| The OTel Specification, Semantic Conventions, and API documentation will clearly | ||
| communicate to instrumentation authors that complex attribute support may be | ||
| limited and will continue to recommend flat attributes whenever possible. | ||
|
|
||
| ## When reporting telemetry, when should I use complex attributes? | ||
|
|
||
| When you can reasonably express data using flat attributes, use flat attributes. | ||
|
|
||
| Use complex attributes only when the data is too complex to express with flat | ||
| attributes — for example, when recording lists of complex objects. | ||
|
|
||
| For semantic conventions and instrumentation libraries, we don't recommend | ||
| changing anything existing in response to this announcement. This should only | ||
| affect new features. | ||
|
lmolkova marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Comments? | ||
|
|
||
| We’ve opened a | ||
| [GitHub issue to discuss this post](https://github.com/open-telemetry/community/issues/TODO), | ||
|
lmolkova marked this conversation as resolved.
Outdated
pellared marked this conversation as resolved.
Outdated
|
||
| and we’d love your feedback. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.