Jump to content

User:Lucas Werkmeister (WMDE)/Grafana

From Wikitech
This page may be outdated or contain incorrect details. Please update it if you can.

I have grafana-admin access these days. (That said, the method here still works, it’s just not very convenient.)

I don’t have grafana-admin access, but I still sometimes want to see new metrics before someone else has added them to an existing Grafana board (or created a new one) for me. Totally possible! Just use the Render URL API of Graphite itself, on the https://graphite.wikimedia.org/render/ endpoint.

For example:

target contains whatever you want to render, and can be any metric expression. (It can also be specified several times.) The simplest case is to just specify a metric name – but beware: there is a MediaWiki. prefix that you don’t see when you use the metric name in PHP ($wgStatsdMetricPrefix), and you also need some suffix to inform Graphite what to do with the metric – for a counter, .count makes sense, for timings, something like .p50 or .p99.

See the Render URL API documentation for the kinds of paths and wildcards you can use in target, as well as for all other URL parameters (width, height, yMax, format, etc.). See the Functions documentation to see what you can do with the metrics (a simple, useful function is alias(metric, "name"), to assign a more readable name, especially if metric is an expression).

Have fun!