From f8a22c3e6c1861d783fbbcaf869f0793ce5fa705 Mon Sep 17 00:00:00 2001 From: Nick Ripley Date: Mon, 29 Jul 2024 12:15:38 -0700 Subject: [PATCH] ddtracer/tracer: fix appending 'tracer_version' to the statsd tags (#2801) Co-authored-by: Diana Shevchenko <40775148+dianashevchenko@users.noreply.github.com> --- ddtrace/tracer/option.go | 2 +- ddtrace/tracer/option_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ddtrace/tracer/option.go b/ddtrace/tracer/option.go index 5d02abc1eb..df84a0f8a9 100644 --- a/ddtrace/tracer/option.go +++ b/ddtrace/tracer/option.go @@ -750,7 +750,7 @@ func statsTags(c *config) []string { } } globalconfig.SetStatsTags(tags) - tags = append(tags, version.Tag) + tags = append(tags, "tracer_version:"+version.Tag) if c.serviceName != "" { tags = append(tags, "service:"+c.serviceName) } diff --git a/ddtrace/tracer/option_test.go b/ddtrace/tracer/option_test.go index 835c4177f2..26c5f80343 100644 --- a/ddtrace/tracer/option_test.go +++ b/ddtrace/tracer/option_test.go @@ -1287,6 +1287,7 @@ func TestStatsTags(t *testing.T) { assert.Contains(tags, "service:serviceName") assert.Contains(tags, "env:envName") assert.Contains(tags, "host:hostName") + assert.Contains(tags, "tracer_version:"+version.Tag) st := globalconfig.StatsTags() // all of the tracer tags except `service` and `version` should be on `st` @@ -1295,7 +1296,7 @@ func TestStatsTags(t *testing.T) { assert.Contains(st, "host:hostName") assert.Contains(st, "lang:go") assert.Contains(st, "lang_version:"+runtime.Version()) - assert.NotContains(st, "version:"+version.Tag) + assert.NotContains(st, "tracer_version:"+version.Tag) assert.NotContains(st, "service:serviceName") }