Skip to content

Commit

Permalink
Fix peer tags configuration (#3132)
Browse files Browse the repository at this point in the history
Co-authored-by: Dario Castañé <dario.castane@datadoghq.com>
  • Loading branch information
ichinaski and darccio authored Feb 3, 2025
1 parent b143b60 commit 0a41ffd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions ddtrace/tracer/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ func loadAgentFeatures(agentDisabled bool, agentURL *url.URL, httpClient *http.C
features.DropP0s = info.ClientDropP0s
features.StatsdPort = info.Config.StatsdPort
features.metaStructAvailable = info.SpanMetaStruct
features.peerTags = info.PeerTags
for _, endpoint := range info.Endpoints {
switch endpoint {
case "/v0.6/stats":
Expand Down
3 changes: 2 additions & 1 deletion ddtrace/tracer/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func TestLoadAgentFeatures(t *testing.T) {

t.Run("OK", func(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.Write([]byte(`{"endpoints":["/v0.6/stats"],"feature_flags":["a","b"],"client_drop_p0s":true,"config": {"statsd_port":8999}}`))
w.Write([]byte(`{"endpoints":["/v0.6/stats"],"feature_flags":["a","b"],"client_drop_p0s":true,"peer_tags":["peer.hostname"],"config": {"statsd_port":8999}}`))
}))
defer srv.Close()
cfg := newConfig(WithAgentAddr(strings.TrimPrefix(srv.URL, "http://")), WithAgentTimeout(2))
Expand All @@ -237,6 +237,7 @@ func TestLoadAgentFeatures(t *testing.T) {
assert.True(t, cfg.agent.Stats)
assert.True(t, cfg.agent.HasFlag("a"))
assert.True(t, cfg.agent.HasFlag("b"))
assert.EqualValues(t, cfg.agent.peerTags, []string{"peer.hostname"})
})

t.Run("discovery", func(t *testing.T) {
Expand Down

0 comments on commit 0a41ffd

Please sign in to comment.