diff --git a/conf/defaults.ini b/conf/defaults.ini index 2c70d039e6b..8c3fb36dded 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -355,7 +355,7 @@ interval_seconds = 60 # Send internal Grafana metrics to graphite ; [metrics.graphite] ; address = localhost:2003 -; prefix = service.grafana.%(instance_name)s +; prefix = service.grafana.%(instance_name)s. [grafana_net] url = https://grafana.net diff --git a/conf/sample.ini b/conf/sample.ini index ab6c125e848..d82412fa26e 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -305,7 +305,7 @@ enabled = true # Send internal metrics to Graphite ; [metrics.graphite] ; address = localhost:2003 -; prefix = service.grafana.%(instance_name)s +; prefix = service.grafana.%(instance_name)s. #################################### Internal Grafana Metrics ########################## # Url used to to import dashboards directly from Grafana.net diff --git a/pkg/metrics/graphite.go b/pkg/metrics/graphite.go index 20b985e22ed..bbd5696c85d 100644 --- a/pkg/metrics/graphite.go +++ b/pkg/metrics/graphite.go @@ -33,7 +33,7 @@ func CreateGraphitePublisher() (*GraphitePublisher, error) { prefix := graphiteSection.Key("prefix").Value() if prefix == "" { - prefix = "service.grafana.%(instance_name)s" + prefix = "service.grafana.%(instance_name)s." } publisher.prefix = strings.Replace(prefix, "%(instance_name)s", safeInstanceName, -1) diff --git a/pkg/metrics/graphite_test.go b/pkg/metrics/graphite_test.go index 31620bdd161..8ecee9449a5 100644 --- a/pkg/metrics/graphite_test.go +++ b/pkg/metrics/graphite_test.go @@ -19,8 +19,8 @@ func TestGraphitePublisher(t *testing.T) { So(err, ShouldBeNil) sec, err := setting.Cfg.NewSection("metrics.graphite") - sec.NewKey("prefix", "service.grafana.%(instance_name)s") - sec.NewKey("address", "localhost:2003") + sec.NewKey("prefix", "service.grafana.%(instance_name)s.") + sec.NewKey("address", "localhost:2001") So(err, ShouldBeNil) @@ -30,7 +30,8 @@ func TestGraphitePublisher(t *testing.T) { So(err, ShouldBeNil) So(publisher, ShouldNotBeNil) - So(publisher.prefix, ShouldEqual, "service.grafana.hostname_with_dots_com") + So(publisher.prefix, ShouldEqual, "service.grafana.hostname_with_dots_com.") + So(publisher.address, ShouldEqual, "localhost:2001") }) Convey("Test graphite publisher default values", t, func() { @@ -49,7 +50,7 @@ func TestGraphitePublisher(t *testing.T) { So(err, ShouldBeNil) So(publisher, ShouldNotBeNil) - So(publisher.prefix, ShouldEqual, "service.grafana.hostname_with_dots_com") + So(publisher.prefix, ShouldEqual, "service.grafana.hostname_with_dots_com.") So(publisher.address, ShouldEqual, "localhost:2003") }) }