This page is about metrics in Prometheus.
api_http_requests_total{method="POST", handler="/messages"}
where:
prometheus_http_requests_total{code="200",handler="/"} 0
prometheus_http_requests_total{code="200",handler="/-/healthy"} 0
prometheus_http_requests_total{code="200",handler="/-/quit"} 0
prometheus_http_requests_total{code="200",handler="/-/ready"} 0
prometheus_http_requests_total{code="200",handler="/-/reload"} 0
prometheus_http_requests_total{code="200",handler="/alerts"} 0
prometheus_http_requests_total{code="200",handler="/api/v1/*path"} 0
prometheus_http_requests_total{code="200",handler="/api/v1/admin/tsdb/clean_tombstones"} 0
prometheus_http_requests_total{code="200",handler="/api/v1/admin/tsdb/delete_series"} 0
prometheus_http_requests_total{code="200",handler="/api/v1/admin/tsdb/snapshot"} 0
prometheus_http_requests_total{code="200",handler="/api/v1/alertmanagers"} 0
A metric identifier is composed uniquely of:
<metric name>{<label name>=<label value>, ...}
# equivalent to
{name="metric name", <label name>=<label value>, ...}
This is the same notation that OpenTSDB uses.
The metrics identifier is also known as time serie because when they are read/scraped, they create a time series with the following values:
The metric name is a built-in label that identifies a metrics uniquely (ie a serie)
Example for the total number of HTTP requests received:
http_requests_total
is equivalent to
{ name="http_requests_total" }
The name may contain:
It must match the regex: [a-zA-Z_:][a-zA-Z0-9_:]*.
It must comply to the convention. For example:
See Prometheus - Collector to configure when the metrics are collected.
By default, the metrics are made available at a URL endpoint known as a target with /metrics as path
Example:
Example of metrics for the prometheus server.
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0.0010366
go_gc_duration_seconds_sum 0.0020374
go_gc_duration_seconds_count 15
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 41
.......
When Prometheus scrapes a target, it attaches some labels automatically to the scraped time series which serve to identify the scraped target:
More … Doc
With the API
http://localhost:9090/api/v1/label/__name__/values