Skip to content

Commit cf6736d

Browse files
committed
fix(metrics): add ending dot for graphite prefix
1 parent 41790c6 commit cf6736d

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
@@ -355,7 +355,7 @@ interval_seconds = 60
355355
# Send internal Grafana metrics to graphite
356356
; [metrics.graphite]
357357
; address = localhost:2003
358-
; prefix = service.grafana.%(instance_name)s
358+
; prefix = service.grafana.%(instance_name)s.
359359

360360
[grafana_net]
361361
url = https://grafana.net

conf/sample.ini

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

310310
#################################### Internal Grafana Metrics ##########################
311311
# 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)