]> git.proxmox.com Git - ceph.git/blame - ceph/src/seastar/doc/prometheus.md
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / seastar / doc / prometheus.md
CommitLineData
11fdf7f2
TL
1# The Prometheus Protocol
2
3Seastar supports the Prometheus protocol for metrics reporting.
4Supported exposition formats are the 0.0.4 text and protocol buffer formats.
5
6More on the formats can be found at the [Prometheus documentations](https://prometheus.io/docs/instrumenting/exposition_formats/)
7
8By default, Seastar would listen on port `9180` and the `localhost`.
9
10See the Seastar configuration documentation on how to change the default configuration.
11
12Seastar would reply based on the content type header, so pointing your browser to:
13`http://localhost:9180/metrics/` will return a text representation of the metrics with their documentation.
14
1e59de90
TL
15Starting from Prometheus 2.0, the binary protocol is no longer supported.
16While seastar still supports the binary protocol, it would be deprecated in a future release.
11fdf7f2 17
1e59de90
TL
18## Querying subset of the metrics
19Seastar supports querying for a subset of the metrics by their names and labels.
11fdf7f2 20
1e59de90
TL
21### Filtering by a metric name
22Use the `__name__` query parameter to select according to a metric name or a prefix.
11fdf7f2 23
1e59de90
TL
24For example, to get all the http metrics, point your browser to:
25`http://localhost:9180/metrics?__name__=http*` note the asterisk symbol following the http.
26Filtering by name only supports prefix matching.
27
28To query for only the http requests served metric, point your browser to `http://localhost:9180/metrics?__name__=httpd_requests_served`
29
30### Filtering by a label value
31The Prometheus protocol uses labels to differentiate the characteristics of the thing that is being measured.
32For example, in Seastar, it is common to report each metric per shard and add a `shard` label to the metric.
33
34You can filter by any label using regular expressions. If you use multiple labels in your query, all conditions should be met.
35A missing label is considered an empty string. The expression should match the entire label value,
36to match a missing label, you can use `label=` or `label=^$`.
37
38Here are a few examples:
39
40To return all metrics from shard 1 or shard 0:
41http://localhost:9180/metrics?shard=1|0
42
43To get all metrics without a `service` label:
44http://localhost:9180/metrics?service=
45
46To get all metrics with a `service` label equals `prometheus` and from shard `0`:
47http://localhost:9180/service=prometheus&shard=0
48
49## Remove the help lines
50Sending the help associated with each metric on each request is an overhead.
51Prometheus itself does not use those help lines.
52Seastar supports an option to remove those lines from the metrics output using the `__help__` query parameter.
53To remove the help lines set `__help__=false`
54for example:
55`http://localhost:9180/metrics?__help__=false`
11fdf7f2
TL
56
57### Configuring the Prometheus server for picking specific metrics
58The [Prometheus configuration](https://prometheus.io/docs/prometheus/1.8/configuration/configuration/) describes the general Prometheus configuration.
59
60To specify a specific metric or metrics add a `metrics_path` to the scrap config in the prometheue.yml file
61
62For example, the following scrap config, will query for all the http metrics:
63
64```
65 scrape_configs:
66 - job_name: http
67 honor_labels: true
20effc67
TL
68 metrics_path: /metrics
69 params:
1e59de90 70 __name__: ['http*']
11fdf7f2
TL
71```
72