From 85f736b09261860bb83795a89cb3c119f0165212 Mon Sep 17 00:00:00 2001 From: David Goffredo Date: Tue, 3 Oct 2023 15:21:06 -0400 Subject: [PATCH 1/4] tracing: fix Datadog span name Signed-off-by: David Goffredo --- source/extensions/tracers/datadog/tracer.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/extensions/tracers/datadog/tracer.cc b/source/extensions/tracers/datadog/tracer.cc index 180a2c5a3c36e..ac898f317b481 100644 --- a/source/extensions/tracers/datadog/tracer.cc +++ b/source/extensions/tracers/datadog/tracer.cc @@ -86,7 +86,12 @@ Tracing::SpanPtr Tracer::startSpan(const Tracing::Config&, Tracing::TraceContext // The OpenTracing implementation ignored the `Tracing::Config` argument, // so we will as well. datadog::tracing::SpanConfig span_config; - span_config.name = operation_name; + // The `operation_name` parameter to this function more closely matches + // Datadog's concept of "resource name." Datadog's "span name," or "operation + // name," instead describes the category of operation being performed, which + // here we hard-code. + span_config.name = "envoy.proxy"; + span_config.resource = operation_name; span_config.start = estimateTime(stream_info.startTime()); datadog::tracing::Tracer& tracer = *thread_local_tracer.tracer; From d0fe835b5e4ff86f24496592d53698f3916b753f Mon Sep 17 00:00:00 2001 From: David Goffredo Date: Tue, 3 Oct 2023 16:07:24 -0400 Subject: [PATCH 2/4] tracing: fix Datadog unit test Signed-off-by: David Goffredo --- test/extensions/tracers/datadog/tracer_test.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/extensions/tracers/datadog/tracer_test.cc b/test/extensions/tracers/datadog/tracer_test.cc index 1247b8a44f28a..8a4e276fd3daa 100644 --- a/test/extensions/tracers/datadog/tracer_test.cc +++ b/test/extensions/tracers/datadog/tracer_test.cc @@ -116,9 +116,13 @@ TEST_F(DatadogTracerTest, SpanProperties) { ASSERT_TRUE(maybe_dd_span); const datadog::tracing::Span& dd_span = *maybe_dd_span; - // Verify that the span has the expected service name, operation name, start - // time, and sampling decision. - EXPECT_EQ("do.thing", dd_span.name()); + // Verify that the span has the expected service name, operation name, + // resource name, start time, and sampling decision. + // Note that the `operation_name` we specified above becomes the + // `resource_name()` of the resulting Datadog span, while the Datadog span's + // `name()` (operation name) is hard-coded to "envoy.proxy." + EXPECT_EQ("envoy.proxy", dd_span.name()); + EXPECT_EQ("do.thing", dd_span.resource_name()); EXPECT_EQ("envoy", dd_span.service_name()); ASSERT_TRUE(dd_span.trace_segment().sampling_decision()); EXPECT_EQ(int(datadog::tracing::SamplingPriority::USER_DROP), From aab4aaeaa67d03a2ba7e0c67eb61c4b1e997f612 Mon Sep 17 00:00:00 2001 From: David Goffredo Date: Tue, 3 Oct 2023 16:22:58 -0400 Subject: [PATCH 3/4] tracing: add change to changelogs/current.yaml Signed-off-by: David Goffredo --- changelogs/current.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelogs/current.yaml b/changelogs/current.yaml index 336ee98e2baed..e004659b9728a 100644 --- a/changelogs/current.yaml +++ b/changelogs/current.yaml @@ -156,6 +156,9 @@ bug_fixes: - area: redis change: | Fixed a bug where redis key with % in the key is failing with a validation error. +- area: tracing + change: | + Fixed a bug in the Datadog tracer where Datadog's "operation name" would contain what should be in the "resource name." removed_config_or_runtime: # *Normally occurs at the end of the* :ref:`deprecation period ` From 41f5d5b1961e0e27a947582ccbac082e778d03ff Mon Sep 17 00:00:00 2001 From: David Goffredo Date: Tue, 3 Oct 2023 18:10:36 -0400 Subject: [PATCH 4/4] changelogs/current.yaml entries end with a period Co-authored-by: Stephan Zuercher Signed-off-by: David Goffredo --- changelogs/current.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/current.yaml b/changelogs/current.yaml index e004659b9728a..c14f7369eddb7 100644 --- a/changelogs/current.yaml +++ b/changelogs/current.yaml @@ -158,7 +158,7 @@ bug_fixes: Fixed a bug where redis key with % in the key is failing with a validation error. - area: tracing change: | - Fixed a bug in the Datadog tracer where Datadog's "operation name" would contain what should be in the "resource name." + Fixed a bug in the Datadog tracer where Datadog's "operation name" field would contain what should be in the "resource name" field. removed_config_or_runtime: # *Normally occurs at the end of the* :ref:`deprecation period `