docs/metrics.md: document syntax for choosing specific instance/shard

As another useful example of Prometheus syntax, show the syntax of plotting
a graph for one particular node or shard.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Reviewed-by: Botond Denes <bdenes@scylladb.com>
Message-Id: <20190129221607.11813-1-nyh@scylladb.com>
This commit is contained in:
Nadav Har'El
2019-01-30 00:16:07 +02:00
committed by Avi Kivity
parent 9d9ecda619
commit 7b9b7f8ebc

View File

@@ -173,9 +173,12 @@ metric over time (the "Graph" tab).
Prometheus allows querying and graphing not only the metric itself, but
also various functions and aggregates of these metrics. For example, if
a user asks to graph some metric `xyz` the result is a graph with multiple
lines, one line for each shard and node. But asking to graph `sum(xyz)` will
plot just one line, with the total of the metric `xyz` over all shards in
all nodes. The expression `irate(xyz[1m])` graphs the rate of change (i.e.,
lines, one line for each shard and node. The syntax `xyz{instance="..."}`
will limit the lines to all shards of just one node (given the node's IP
address), and the syntax `xyz{instance="...",shard="0"}` will show only
one shard of one node. The syntax `sum(xyz)` will plot just one line, with
the total of the metric `xyz` over all shards in all nodes.
The expression `irate(xyz[1m])` graphs the rate of change (i.e.,
the derivative) of the metric `xyz`. In this last example, the "1m"
selector is ignored by the `irate()` function, but some duration is required
by the Prometheus syntax.