Rename plugin Prometheus metrics

Rename Prometheus metrics exported by plugins to follow the
clusterio_<plugin_name>_<metric_name> naming scheme.
This commit is contained in:
Hornwitser committed 2020-04-03 21:14:30 +02:00
1 parent 706ffd9ed2
commit 59758f1576
5 files changed
+39 -27

No files matched your search

+8 -5
View File
@@ -459,21 +459,24 @@ the metric and updating it somewhere in the plugin code. For example:
const { Counter } = require('lib/prometheus');
const fooMetric = new Counter(
'clusterio_foo_metric', "Measures the level of foo",
'clusterio_foo_frobber_foo_metric', "Measures the level of foo",
);
// Somewhere in the master plugin code
fooMetric.inc();
This works for master plugins, and the metric will be automatically
available through the /metric HTTP endpoint. For metrics that are
per-instance you must define an `instance_id` label and set it
accordingly, for example:
available through the /metric HTTP endpoint. It's recommended that
plugin metrics follow `clusterio_<plugin_name>_<metric_name>` as the
naming scheme.
For metrics that are per-instance you must define an `instance_id` label and
set it accordingly, for example:
const { Counter } = require('lib/prometheus');
const barMetric = new Gauge(
'clusterio_bar_metric', "Bar instance level",
'clusterio_foo_frobber_bar_metric', "Bar instance level",
{ labels: ['instance_id'] }
);