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