|
1 | 1 | --- |
2 | | -title: Metric and label naming |
| 2 | +title: Metric naming |
3 | 3 | sort_rank: 1 |
4 | 4 | --- |
5 | 5 |
|
6 | | -The metric and label conventions presented in this document are not required |
| 6 | +The metric conventions presented in this document are not required |
7 | 7 | for using Prometheus, but can serve as both a style-guide and a collection of |
8 | 8 | best practices. Individual organizations may want to approach some of these |
9 | 9 | practices, e.g. naming conventions, differently. |
@@ -80,37 +80,6 @@ the underlying metric type and unit you work with. |
80 | 80 | * **Metric collisions**: With growing adoption and metric changes over time, there are cases where lack |
81 | 81 | of unit and type information in the metric name will cause certain series to collide (e.g. `process_cpu` for seconds and milliseconds). |
82 | 82 |
|
83 | | -## Labels |
84 | | - |
85 | | -Prometheus labels can come from both the target and from [relabeling in discovery](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) as well as from the target itself. |
86 | | - |
87 | | -By default Prometheus configures two primary discovery target labels. |
88 | | - |
89 | | -* `job` |
90 | | - * The `job` label is one of the few ubiquitious labels, set at scrape time, and is used to identify metrics scraped from the same target/exporter. |
91 | | - * If not specified in PromQL expressions, they will match unrelated metrics with the same name. This is especially true in a multi system or multi tenant installation |
92 | | - |
93 | | -WARNING: When using `without`, be careful not to strip out the `job` label accidentally. |
94 | | - |
95 | | -* `instance` |
96 | | - * The `instance` label will include the `ip:port` what was scraped, providing a crucial breadcrumb for debugging scrape time issues |
97 | | - |
98 | | -### General Labelling Advice |
99 | | - |
100 | | -Use labels to differentiate the characteristics of the thing that is being measured: |
101 | | - |
102 | | - * `api_http_requests_total` - differentiate request types: `operation="create|update|delete"` |
103 | | - * `api_request_duration_seconds` - differentiate request stages: `stage="extract|transform|load"` |
104 | | - |
105 | | -Do not put the label names in the metric name, as this introduces redundancy |
106 | | -and will cause confusion if the respective labels are aggregated away. |
107 | | - |
108 | | -CAUTION: Remember that every unique combination of key-value label |
109 | | -pairs represents a new time series, which can dramatically increase the amount |
110 | | -of data stored. Do not use labels to store dimensions with high cardinality |
111 | | -(many different label values), such as user IDs, email addresses, or other |
112 | | -unbounded sets of values. |
113 | | - |
114 | 83 | ## Base Units |
115 | 84 |
|
116 | 85 | Prometheus does not have any units hard coded. For better compatibility, base |
|
0 commit comments