Skip to content

Commit f768e9c

Browse files
authored
[pkg/datadog] Switch EnableOperationAndResourceNameV2 to Beta (#39895)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Switch datadog.EnableOperationAndResourceNameV2 to Beta. This changes how Datadog exporter and connector compute the proprietary Datadog operation name from attributes on OTLP spans. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes <!--Describe what testing was performed and which tests were added.--> #### Testing Ran collector locally, verified new logic enabled by default <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.-->
1 parent 49a05ab commit f768e9c

File tree

5 files changed

+41
-8
lines changed

5 files changed

+41
-8
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: pkg/datadog
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Switch feature gate datadog.EnableOperationAndResourceNameV2 to beta. This gate affects exporter/datadog and connector/datadog. It modifies the logic for computing operation names from OTLP spans to produce shorter, more readable names and improve alignment with OpenTelemetry specifications.
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [39895]
14+
15+
subtext: Please see the migration guide for more details. https://docs.datadoghq.com/opentelemetry/migrate/migrate_operation_names/?tab=opentelemetrycollector

connector/datadogconnector/connector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func getTraceAgentCfg(logger *zap.Logger, cfg datadogconfig.TracesConnectorConfi
126126
if datadog.OperationAndResourceNameV2FeatureGate.IsEnabled() {
127127
acfg.Features["enable_operation_and_resource_name_logic_v2"] = struct{}{}
128128
} else {
129-
logger.Info("Please enable feature gate datadog.EnableOperationAndResourceNameV2 for improved operation and resource name logic. This feature will be enabled by default in the future - if you have Datadog monitors or alerts set on operation/resource names, you may need to migrate them to the new convention.")
129+
logger.Info("Please enable feature gate datadog.EnableOperationAndResourceNameV2 for improved operation and resource name logic. This flag will be made stable in a future release. If you have Datadog monitors or alerts set on operation/resource names, you may need to migrate them to the new convention. See the migration guide at https://docs.datadoghq.com/opentelemetry/guide/migrate/migrate_operation_names/")
130130
}
131131
if v := cfg.BucketInterval; v > 0 {
132132
acfg.BucketInterval = v

exporter/datadogexporter/traces_exporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func newTraceAgentConfig(ctx context.Context, params exporter.Settings, cfg *dat
238238
if datadog.OperationAndResourceNameV2FeatureGate.IsEnabled() {
239239
acfg.Features["enable_operation_and_resource_name_logic_v2"] = struct{}{}
240240
} else {
241-
params.Logger.Info("Please enable feature gate datadog.EnableOperationAndResourceNameV2 for improved operation and resource name logic. This feature will be enabled by default in the future - if you have Datadog monitors or alerts set on operation/resource names, you may need to migrate them to the new convention.")
241+
params.Logger.Info("Please enable feature gate datadog.EnableOperationAndResourceNameV2 for improved operation and resource name logic. This flag will be made stable in a future release. If you have Datadog monitors or alerts set on operation/resource names, you may need to migrate them to the new convention. See the migration guide at https://docs.datadoghq.com/opentelemetry/guide/migrate/migrate_operation_names/")
242242
}
243243
if v := cfg.Traces.GetFlushInterval(); v > 0 {
244244
acfg.TraceWriter.FlushPeriodSeconds = v

exporter/datadogexporter/traces_exporter_test.go

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,24 @@ func testPushTraceDataNewEnvConvention(t *testing.T, enableReceiveResourceSpansV
444444
assert.Equal(t, "new_env", traces.TracerPayloads[0].GetEnv())
445445
}
446446

447-
func TestPushTraceData_OperationAndResourceNameV2(t *testing.T) {
448-
err := featuregate.GlobalRegistry().Set("datadog.EnableOperationAndResourceNameV2", true)
449-
if err != nil {
450-
t.Fatal(err)
447+
func TestPushTraceDataOperationAndResourceName(t *testing.T) {
448+
t.Run("OperationAndResourceNameV1", func(t *testing.T) {
449+
subtestPushTraceDataOperationAndResourceName(t, false)
450+
})
451+
452+
t.Run("OperationAndResourceNameV2", func(t *testing.T) {
453+
subtestPushTraceDataOperationAndResourceName(t, true)
454+
})
455+
}
456+
457+
func subtestPushTraceDataOperationAndResourceName(t *testing.T, enableOperationAndResourceNameV2 bool) {
458+
t.Helper()
459+
if !enableOperationAndResourceNameV2 {
460+
prevVal := pkgdatadog.OperationAndResourceNameV2FeatureGate.IsEnabled()
461+
require.NoError(t, featuregate.GlobalRegistry().Set("datadog.EnableOperationAndResourceNameV2", false))
462+
defer func() {
463+
require.NoError(t, featuregate.GlobalRegistry().Set("datadog.EnableOperationAndResourceNameV2", prevVal))
464+
}()
451465
}
452466
tracesRec := &testutil.HTTPRequestRecorderWithChan{Pattern: testutil.TraceEndpoint, ReqChan: make(chan []byte)}
453467
server := testutil.DatadogServerMock(tracesRec.HandlerFunc)
@@ -486,7 +500,11 @@ func TestPushTraceData_OperationAndResourceNameV2(t *testing.T) {
486500
require.NoError(t, proto.Unmarshal(slurp, &traces))
487501
assert.Len(t, traces.TracerPayloads, 1)
488502
assert.Equal(t, "new_env", traces.TracerPayloads[0].GetEnv())
489-
assert.Equal(t, "server.request", traces.TracerPayloads[0].Chunks[0].Spans[0].Name)
503+
if enableOperationAndResourceNameV2 {
504+
assert.Equal(t, "server.request", traces.TracerPayloads[0].Chunks[0].Spans[0].Name)
505+
} else {
506+
assert.Equal(t, "opentelemetry.server", traces.TracerPayloads[0].Chunks[0].Spans[0].Name)
507+
}
490508
}
491509

492510
func TestResRelatedAttributesInSpanAttributes_ReceiveResourceSpansV2Enabled(t *testing.T) {

pkg/datadog/gates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var ReceiveResourceSpansV2FeatureGate = featuregate.GlobalRegistry().MustRegiste
1717
// OperationAndResourceNameV2FeatureGate is a feature gate that enables enhanced span operation name and resource names in Datadog exporter and connector
1818
var OperationAndResourceNameV2FeatureGate = featuregate.GlobalRegistry().MustRegister(
1919
"datadog.EnableOperationAndResourceNameV2",
20-
featuregate.StageAlpha,
20+
featuregate.StageBeta,
2121
featuregate.WithRegisterDescription("When enabled, datadogexporter and datadogconnector use improved logic to compute operation name and resource name."),
2222
featuregate.WithRegisterFromVersion("v0.118.0"),
2323
)

0 commit comments

Comments
 (0)