Migrate to New Operation Name Mappings
Overview
When using OpenTelemetry with Datadog, you might see unclear or lengthy operation names in your traces, and some traces might not appear in your service pages. This happens because of missing mappings between OpenTelemetry SDK information and Datadog operation names, which are span attributes that classify entry points into a service.
Datadog now provides new operation name mappings that improve trace visibility in the service page. This feature requires opt-in configuration now but will become the default in the near future.
Datadog strongly recommends migrating to the new mappings as soon as possible before they become the default.
Prerequisites
Before migrating, remove any existing span name configuration:
Remove span_name_as_resource_name
and span_name_remappings
from your Datadog exporter and connector configurations:
# Remove the highlighted lines if they exist in your configuration
exporters:
datadog:
traces:
span_name_as_resource_name: true
span_name_remappings:
"old_name1": "new_name"
connectors:
datadog/connector:
traces:
span_name_as_resource_name: true
- Remove
span_name_as_resource_name
and span_name_remappings
from your Agent configuration:
# Remove the highlighted lines if they exist in your configuration
otlp_config:
traces:
span_name_as_resource_name: true
span_name_remappings:
"old_name1": "new_name"
- Remove these environment variables:
DD_OTLP_CONFIG_TRACES_SPAN_NAME_AS_RESOURCE_NAME
DD_OTLP_CONFIG_TRACES_SPAN_NAME_REMAPPINGS
Enable new operation name mappings
Launch the OpenTelemetry Collector with the feature gate:
otelcol --config=config.yaml --feature-gates=datadog.EnableOperationAndResourceNameV2
Replace removed configurations
If you previously used span name configurations, replace them with processor configurations:
Replace SpanNameAsResourceName
The span_name_as_resource_name
configuration you removed pulled the span.name
attribute from your OpenTelemetry trace to populate the Datadog operation name. To maintain this functionality, use a transform processor to map span names to the operation.name
attribute:
processors:
transform:
trace_statements:
- context: span
statements:
- set(attributes["operation.name"], name)
Replace SpanNameRemappings
The span_name_remappings
configuration you removed allowed automatic mapping between operation names. To maintain this functionality, use a transform processor to set specific operation names:
processors:
transform:
trace_statements:
- context: span
statements:
- set(attributes["operation.name"], "new_name") where name == "old_name"
Enable the feature using one of these methods:
Replace removed configurations
If you previously used span name configurations and need to maintain similar functionality, set the operation.name
attribute directly in your application code.
Further reading
Additional helpful documentation, links, and articles: