Skip to content

Commit 2fa9742

Browse files
committed
fix(metrics): add ending dot for graphite prefix
1 parent f07b2ac commit 2fa9742

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

conf/defaults.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ interval_seconds = 60
358358
# Send internal Grafana metrics to graphite
359359
; [metrics.graphite]
360360
; address = localhost:2003
361-
; prefix = service.grafana.%(instance_name)s
361+
; prefix = service.grafana.%(instance_name)s.
362362

363363
[grafana_net]
364364
url = https://grafana.net

conf/sample.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ enabled = true
306306
# Send internal metrics to Graphite
307307
; [metrics.graphite]
308308
; address = localhost:2003
309-
; prefix = service.grafana.%(instance_name)s
309+
; prefix = service.grafana.%(instance_name)s.
310310

311311
#################################### Internal Grafana Metrics ##########################
312312
# Url used to to import dashboards directly from Grafana.net

pkg/metrics/graphite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func CreateGraphitePublisher() (*GraphitePublisher, error) {
3333
prefix := graphiteSection.Key("prefix").Value()
3434

3535
if prefix == "" {
36-
prefix = "service.grafana.%(instance_name)s"
36+
prefix = "service.grafana.%(instance_name)s."
3737
}
3838

3939
publisher.prefix = strings.Replace(prefix, "%(instance_name)s", safeInstanceName, -1)

pkg/metrics/graphite_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ func TestGraphitePublisher(t *testing.T) {
1919
So(err, ShouldBeNil)
2020

2121
sec, err := setting.Cfg.NewSection("metrics.graphite")
22-
sec.NewKey("prefix", "service.grafana.%(instance_name)s")
23-
sec.NewKey("address", "localhost:2003")
22+
sec.NewKey("prefix", "service.grafana.%(instance_name)s.")
23+
sec.NewKey("address", "localhost:2001")
2424

2525
So(err, ShouldBeNil)
2626

@@ -30,7 +30,8 @@ func TestGraphitePublisher(t *testing.T) {
3030
So(err, ShouldBeNil)
3131
So(publisher, ShouldNotBeNil)
3232

33-
So(publisher.prefix, ShouldEqual, "service.grafana.hostname_with_dots_com")
33+
So(publisher.prefix, ShouldEqual, "service.grafana.hostname_with_dots_com.")
34+
So(publisher.address, ShouldEqual, "localhost:2001")
3435
})
3536

3637
Convey("Test graphite publisher default values", t, func() {
@@ -49,7 +50,7 @@ func TestGraphitePublisher(t *testing.T) {
4950
So(err, ShouldBeNil)
5051
So(publisher, ShouldNotBeNil)
5152

52-
So(publisher.prefix, ShouldEqual, "service.grafana.hostname_with_dots_com")
53+
So(publisher.prefix, ShouldEqual, "service.grafana.hostname_with_dots_com.")
5354
So(publisher.address, ShouldEqual, "localhost:2003")
5455
})
5556
}

0 commit comments

Comments
 (0)