open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.1k stars 2.39k forks source link

[exporter/datadog] Add feature flag for updated operation and resourc… #36419

Open IbraheemA opened 3 days ago

IbraheemA commented 3 days ago

…e name logic

Description

Datadog associates two name fields with each span: "resource name" and "operation name." Resource name is analogous to span.name in OTel, but operation name has no 1:1 correspondence with any OTel fields. (Read more about what operation name respresents here: https://docs.datadoghq.com/tracing/guide/configuring-primary-operation/)

Previously, the datadog exporter would compute operation name as {scope name}.{span kind}. This would result in long, difficult to read operation names in the Datadog UI - a prior discussion on this issue can be found here.

In this PR, add a feature gate exporter.datadogexporter.EnableOperationAndResourceNameV2. This gate enables new logic for operation and resource name that improves readability of these fields by producing shorter names and better aligning with the OTel spec.

The names computed in the new logic follow those computed in dd-trace-go.

Testing

Unit tests and E2E tests for the new logic are done in the datadog-agent repo. Added a test in this repo that verifies that setting the feature gate enables the new logic; also ran the collector with the feature flag and verified new logic manually.

Documentation

Changelog added