Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
WAL loading while old WALs are being deleted or the `/agent/api/v1/targets`
endpoint is called. (@tpaschalis)

- [BUGFIX] Fix panic in prom_sd_processor when address is empty (@mapno)

# v0.22.0 (2022-01-13)

This release has deprecations. Please read [DEPRECATION] entries and consult
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/traces-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ scrape_configs:
#
# By default, all methods are enabled, and evaluated in the order specified above.
# Order of evaluation is honored when multiple methods are enabled.
prom_sd_pod_association:
prom_sd_pod_associations:
- [ <string>... ]

# spanmetrics supports aggregating Request, Error and Duration (R.E.D) metrics
Expand Down
7 changes: 6 additions & 1 deletion pkg/traces/promsdprocessor/prom_sd_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ func stringAttributeFromMap(attrs pdata.AttributeMap, key string) string {
}

func getConnectionIP(ctx context.Context) string {
return client.FromContext(ctx).Addr.String()
c := client.FromContext(ctx)
if c.Addr == nil {
return ""
}

return c.Addr.String()
}

func (p *promServiceDiscoProcessor) getPodIP(ctx context.Context, attrs pdata.AttributeMap) string {
Expand Down
10 changes: 10 additions & 0 deletions pkg/traces/promsdprocessor/prom_sd_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ func TestPodAssociation(t *testing.T) {
attrMapFn: func(*testing.T) pdata.AttributeMap { return pdata.NewAttributeMap() },
expectedIP: ipStr,
},
{
name: "connection IP is empty",
podAssociations: []string{podAssociationConnectionIP},
ctxFn: func(t *testing.T) context.Context {
c := client.FromContext(context.Background())
return client.NewContext(context.Background(), c)
},
attrMapFn: func(*testing.T) pdata.AttributeMap { return pdata.NewAttributeMap() },
expectedIP: "",
},
{
name: "ip attribute",
ctxFn: func(t *testing.T) context.Context { return context.Background() },
Expand Down