Add support for tagging StatsD metrics
Before raising this MR, consider whether the following are required, and complete if so:
-
Unit tests -
Metrics -
Documentation update(s)
If not required, please explain in brief why not.
Description
This MR adds a way to configure BuildGrid's monitoring to publish tagged StatsD metrics. The tag format is configurable, and currently Influx StatsD, Graphite, and DogStatsD are all supported.
Changes proposed in this merge request:
- Add support for various tag formats to MonitoringBus
- Make the MonitoringBus' tag format configurable
Validation
Update data/config/monitoring-controller.yml
to enable tagging, and then add a new panel to a dashboard using seriesByTag
.
For example, making the Bots Count panel on the Bots example dashboard use tags.
diff --git a/data/config/grafana/dashboards/buildgrid/bots.json b/data/config/grafana/dashboards/buildgrid/bots.json
index a2811e52..4a2516fc 100644
--- a/data/config/grafana/dashboards/buildgrid/bots.json
+++ b/data/config/grafana/dashboards/buildgrid/bots.json
@@ -332,7 +332,8 @@
"targets": [
{
"refId": "A",
- "target": "aliasByMetric(stats.gauges.buildgrid.bots-count.*)"
+ "target": "seriesByTag(\"name=~stats.gauges.buildgrid.bots-count.*\") | aliasByTags(\"bot-status\")",
+ "textEditor": true
}
],
"thresholds": [],
diff --git a/data/config/monitoring-controller.yml b/data/config/monitoring-controller.yml
index adabec2e..6c8142b1 100644
--- a/data/config/monitoring-controller.yml
+++ b/data/config/monitoring-controller.yml
@@ -20,6 +20,7 @@ monitoring:
endpoint-location: statsd:8125
serialization-format: statsd
metric-prefix: buildgrid
+ tag-format: graphite
instances:
- name: ''
Issues addressed
Closes #177 (closed)
Edited by Adam Coldrick