Prometheus fundamentally stores all data as time series : a stream of timestamped values belonging to the same metric and the same set of labeled dimensions. In addition to stored time series, Prometheus may generate ad-hoc derived time series as a result of queries.
Indicator (metric) name and label (labels)
Each time series is uniquely identified by a " metric name" and a "label" ( optional key-value pair ) .
Metric name: Specifies a general characteristic of the system being measured (such ashttp_requests_total -
the total number of HTTP requests received).
It may contain ASCII letters and numbers, as well as underscores and colons. It must match a regular expression [a-zA-Z_:][a-zA-Z0-9_:]*
.
Note: The colon is reserved for user-defined recording rules. They should not be used by exporters or direct instruments.
label: Prometheus's dimensional data model: any given label combination of the same metric name identifies a specific dimensional instance of that metric (for example: making all http /api/tracks
requests accessed using the POST method). The query language allows filtering and aggregation based on these dimensions. Changing any label value, including adding or removing labels, creates a new time series.
Tag names may contain ASCII letters, numbers, and underscores. They must match regular expressions [a-zA-Z_][a-zA-Z0-9_]*
. Tag names starting with __
Tag values can contain any Unicode characters.
A tag with an empty tag value is considered equivalent to a non-existent tag.
See also Best Practices for Naming Metrics and Labels .
sample
The samples consist of actual time series data. Each sample includes:
- a float64 value
- Timestamp with millisecond precision
Marking method
Given a metric name and a set of labels, time series are often identified using this notation:
<metric name>{<label name>=<label value>, ...}
For example, a time series with metric namesapi_http_requests_total
and labels can be written like this:method="POST"
handler="/messages"
api_http_requests_total{method="POST", handler="/messages"}