Skip to content

Commit 0a41ffd

Browse files
ichinaskidarccio
andauthored
Fix peer tags configuration (#3132)
Co-authored-by: Dario Castañé <[email protected]>
1 parent b143b60 commit 0a41ffd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

ddtrace/tracer/option.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ func loadAgentFeatures(agentDisabled bool, agentURL *url.URL, httpClient *http.C
774774
features.DropP0s = info.ClientDropP0s
775775
features.StatsdPort = info.Config.StatsdPort
776776
features.metaStructAvailable = info.SpanMetaStruct
777+
features.peerTags = info.PeerTags
777778
for _, endpoint := range info.Endpoints {
778779
switch endpoint {
779780
case "/v0.6/stats":

ddtrace/tracer/option_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func TestLoadAgentFeatures(t *testing.T) {
224224

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

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

0 commit comments

Comments
 (0)