Skip to content

Commit 1059a35

Browse files
committed
feat(instrumentation): documented instrumentation options, closes grafana#4696
1 parent 064e474 commit 1059a35

File tree

4 files changed

+46
-6
lines changed

4 files changed

+46
-6
lines changed

conf/defaults.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ global_session = -1
341341

342342
#################################### Internal Grafana Metrics ##########################
343343
[metrics]
344-
enabled = false
345-
interval_seconds = 10
344+
enabled = true
345+
interval_seconds = 60
346346

347-
[metrics.graphite]
348-
address = localhost:2003
349-
prefix = prod.grafana.%(instance_name)s.
347+
; [metrics.graphite]
348+
; address = localhost:2003
349+
; prefix = prod.grafana.%(instance_name)s.
350350

351351

conf/sample.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,5 +272,17 @@ check_for_updates = true
272272
;enabled = false
273273
;path = /var/lib/grafana/dashboards
274274

275+
#################################### Internal Grafana Metrics ##########################
276+
[metrics]
277+
# Disable / Enable internal metrics
278+
;enabled = true
279+
280+
# Publish interval
281+
;interval_seconds = 10
282+
283+
# Send internal metrics to Graphite
284+
; [metrics.graphite]
285+
; address = localhost:2003
286+
; prefix = prod.grafana.%(instance_name)s.
275287

276288

docs/sources/installation/configuration.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ Then you can override them using:
4444

4545
<hr />
4646

47+
## instance_name
48+
Set the name of the grafana-server instance. Used in logging and internal metrics and in
49+
clustering info. Defaults to: `${HOSTNAME}, which will be replaced with
50+
environment variable `HOSTNAME`, if that is empty or does not exist Grafana will try to use
51+
system calls to get the machine name.
52+
4753
## [paths]
4854

4955
### data
@@ -439,3 +445,22 @@ Grafana backend index those json dashboards which will make them appear in regul
439445

440446
### path
441447
The full path to a directory containing your json dashboards.
448+
449+
## [metrics]
450+
451+
### enabled
452+
Enable metrics reporting. defaults true. Available via HTTP API `/api/metrics`.
453+
454+
### interval_seconds
455+
456+
Flush/Write interval when sending metrics to external TSDB. Defaults to 60s.
457+
458+
## [metrics.graphite]
459+
Include this section if you want to send internal Grafana metrics to Graphite.
460+
461+
### address
462+
Format `<Hostname or ip>`:port
463+
464+
### prefix
465+
Graphite metric prefix. Defaults to `prod.grafana.%(instance_name)s.`
466+

pkg/metrics/publish.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ func instrumentationLoop(settings *MetricSettings) chan struct{} {
3939
}
4040

4141
func sendMetrics(settings *MetricSettings) {
42-
metrics := MetricStats.GetSnapshots()
42+
if len(settings.Publishers) == 0 {
43+
return
44+
}
4345

46+
metrics := MetricStats.GetSnapshots()
4447
for _, publisher := range settings.Publishers {
4548
publisher.Publish(metrics)
4649
}

0 commit comments

Comments
 (0)