Skip to content

Commit 81bb598

Browse files
author
Sergio Moya
committed
fix(metriks): force empty Datadog sink hostname. Service name always in prefix.
`Name` maps to Datadog sink `hostname` field. It is only used by armon/go-metrics lib and in a really non-well documented way. It is basically used for removing from the metrics key the hostname in favor of adding it (manually by the user) as tag. The library creator explains that it makes sense since Datadog is multidimensional so the tags should be used instead. See https://github.com/armon/go-metrics/blob/master/datadog/dogstatsd.go#L63-L82 We totally disagree.
1 parent 9c62d23 commit 81bb598

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

metriks/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ type Config struct {
44
Host string `default:"localhost"`
55
Port int `default:"8125"`
66

7-
// Name is typically the local hostname or pod name
8-
Name string `default:"local"`
97
Tags map[string]string
8+
9+
// Deprecated: Name is not needed anymore.
10+
Name string
1011
}

metriks/metriks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func Init(serviceName string, conf Config) error {
2020

2121
// InitTags behaves like Init but allows appending extra tags
2222
func InitTags(serviceName string, conf Config, extraTags []string) error {
23-
sink, err := createDatadogSink(statsdAddr(conf), conf.Name, conf.Tags, extraTags)
23+
sink, err := createDatadogSink(statsdAddr(conf), "", conf.Tags, extraTags)
2424
if err != nil {
2525
return err
2626
}

0 commit comments

Comments
 (0)