From f07b2ac4463aff5525a3b69678dbd4bd4fb3377f Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 11 Aug 2016 17:00:09 +0200 Subject: [PATCH 1/3] fix(metrics): hide none existing metrics settings --- pkg/metrics/graphite.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/metrics/graphite.go b/pkg/metrics/graphite.go index 2b3da3e490c..20b985e22ed 100644 --- a/pkg/metrics/graphite.go +++ b/pkg/metrics/graphite.go @@ -21,7 +21,7 @@ type GraphitePublisher struct { func CreateGraphitePublisher() (*GraphitePublisher, error) { graphiteSection, err := setting.Cfg.GetSection("metrics.graphite") if err != nil { - return nil, err + return nil, nil } publisher := &GraphitePublisher{} From 2fa97427eb312738bb588ebd7d0a4bfae04b9e6f Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 12 Aug 2016 08:06:54 +0200 Subject: [PATCH 2/3] fix(metrics): add ending dot for graphite prefix --- conf/defaults.ini | 2 +- conf/sample.ini | 2 +- pkg/metrics/graphite.go | 2 +- pkg/metrics/graphite_test.go | 9 +++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/conf/defaults.ini b/conf/defaults.ini index 28c0e509fb4..afa99c701b2 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -358,7 +358,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 80ca033f035..8fffcf9b7c9 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -306,7 +306,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") }) } From 46630df88dae7613b3205e855d9720f901ad448e Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Sat, 13 Aug 2016 14:12:29 +0900 Subject: [PATCH 3/3] Update the number of ways --- docs/sources/plugins/development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/plugins/development.md b/docs/sources/plugins/development.md index 29dcd0568e3..6d2106fad01 100644 --- a/docs/sources/plugins/development.md +++ b/docs/sources/plugins/development.md @@ -32,7 +32,7 @@ will be expected to export different things. You can find what's expected for [d and [apps](./apps.md) plugins in the documentation. ## Start developing your plugin -There are two ways that you can start developing a Grafana plugin. +There are three ways that you can start developing a Grafana plugin. 1. Setup a Grafana development environment. [(described here)](http://docs.grafana.org/project/building_from_source/) and place your plugin in the ```data/plugins``` folder. 2. Install Grafana and place your plugin in the plugins directory which is set in your [config file](../installation/configuration.md). By default this is `/var/lib/grafana/plugins` on Linux systems.