WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@goakley
Copy link

@goakley goakley commented Dec 5, 2025

What does this PR do?

Currently, when converting OpenTelemetry attributes to Datadog tags, all attribute values are converted as-is to strings. For simple types (strings, ints, etc) this works as expected, but OpenTelemetry also supports more complex types as attribute values. Array values in particular are a useful attribute value type, as both OpenTelemetry (e.g. container.image.repo_digests) and Datadog (e.g. kube_service) support having multiple values on the same key for the same data point. To support these cases, this change gives the OTLP Translator the ability to covert top-level array attribute values into multiple Datadog tags (instead of a single tag formatted like a JSON array).

Motivation

This has been a particular pain point when using the OpenTelemetry collector's datadogexporter plugin to ingest metrics into Datadog. The collector plugin depends on the opentelemetry-mapping-go package updated in this change. By exposing this new setting, metrics sent from the collector can more fully use Datadog's rich tag slicing feature with OpenTelemetry-based metrics.

Describe how you validated your changes

Unit tests test that both the old behaviour still works as expected. I also built a version of the OpenTelemetry Collector that uses this change, and it exports metrics with the expected tags.

Currently, when converting OpenTelemetry attributes to Datadog tags, all attribute values are converted as-is to strings.
For simple types (strings, ints, etc) this works as expected, but OpenTelemetry also supports [more complex types](https://opentelemetry.io/docs/specs/otel/common/#anyvalue) as attribute values.
Array values in particular are a useful attribute value type, as both OpenTelemetry (e.g. [`container.image.repo_digests`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/container/)) and Datadog (e.g. [`kube_service`](https://docs.datadoghq.com/containers/kubernetes/tag/)) support having multiple values on the same key for the same data point.
To support these cases, this change gives the OTLP `Translator` the ability to covert top-level array attribute values into multiple Datadog tags (instead of a single tag formatted like a JSON array).

This has been a particular pain point when using the OpenTelemetry collector's [`datadogexporter`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/datadogexporter) plugin to ingest metrics into Datadog.
The collector plugin depends on the `opentelemetry-mapping-go` package updated in this change.
By exposing this new setting, metrics sent from the collector can more fully use Datadog's rich tag slicing feature with OpenTelemetry-based metrics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant