diff --git a/debian/changelog b/debian/changelog index a4ba7d2d76bfd71931995e9492eb32adedb1032f..84b624ebff1e5510163c7812d023dde71614d033 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +autoradio (0.3.2p1) unstable; urgency=medium + + * Instrumentation fix. + + -- ale <ale@incal.net> Thu, 09 Oct 2014 08:45:50 +0100 + autoradio (0.3.2) unstable; urgency=medium * Add statsd instrumentation. diff --git a/instrumentation/stats.go b/instrumentation/stats.go index adcfb65bf6218e9c13977c35c417fe4a9b717a90..333d0b6cb86567e81f99b8731d9254fb41a1ece5 100644 --- a/instrumentation/stats.go +++ b/instrumentation/stats.go @@ -2,7 +2,9 @@ package instrumentation import ( "flag" + "fmt" "log" + "os" "sync" "github.com/cactus/go-statsd-client/statsd" @@ -15,11 +17,21 @@ var ( clientInit sync.Once client *statsd.Client + + prefix string ) +func init() { + hostname, err := os.Hostname() + if err != nil { + log.Fatal("Could not determine hostname: %v", err) + } + prefix = fmt.Sprintf("autoradio.%s.", hostname) +} + func getClient() *statsd.Client { clientInit.Do(func() { - c, err := statsd.New(*statsdServer, "autoradio.") + c, err := statsd.New(*statsdServer, prefix) if err != nil { log.Fatal("Error initializing instrumentation: %v", err) }