Prometheus - Metrics

Scale Counter Graph

About

This page is about metrics in Prometheus.

Example

Base

api_http_requests_total{method="POST", handler="/messages"}

where:

  • the metric name is api_http_requests_total
  • the labels are:
    • method=“POST”
    • handler=“/messages”

Metrics from the Prometheus server itself

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

Syntax

A metric identifier is composed uniquely of:

  • a name
  • and one or more labels.
<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:

  • metric identifier
  • time
  • value

Name

The metric name specifies the general feature of a system that is measured.

Example for the total number of HTTP requests received:

http_requests_total

The name may contain:

It must match the regex: [a-zA-Z_:][a-zA-Z0-9_:]*.

Management

Conf

See Prometheus - Collector to configure when the metrics are collected.

Location

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
.......

Built-in attributes: Job / instance

When Prometheus scrapes a target, it attaches some labels automatically to the scraped time series which serve to identify the scraped target:

  • job: The configured job name that the target belongs to.
  • instance: The <host>:<port> part of the target's URL that was scraped.

More … Doc

How to get all metrics in the Prometheus server?

With the API

http://localhost:9090/api/v1/label/__name__/values





Discover More
Scale Counter Graph
Prometheus - Collector

A collector is a metrics collector and is embedded in the prometheus server. The scrape_configs block of the prometheus.yml file controls what resources Prometheus monitors. The below example shows...
Scale Counter Graph
Prometheus - Exporter

An exporter is an endpoint that: produces a page with metrics that the collector can scrap. By default, the URL is: Exporters may add filter capabilities via the URL. Example with a name[] URL...
Scale Counter Graph
Prometheus - Label (Dimension)

A label in Prometheus is specified in a metric and allows dimensional data model Any given combination of labels for the same metric name identifies a particular dimensional instantiation of that metric...
Scale Counter Graph
Prometheus - Node Exporter (Linux/Mac)

node exporter is a prometheus exporter for Linux OS Metrics: CPU, System Memory Utilization, and Disk Usage The Prometheus node exporter exports lots of system metrics via HTTP Metrics specific...
Scale Counter Graph
Prometheus - Time Serie

All data stored and manipulated are time series in Prometheus server making it a time serie database. Every time series is uniquely identified by: its metric name and optional key-value pairs called...
Scale Counter Graph
Prometheus - prometheus.yml (conf)

The configuration of prometheus is done via the prometheus.yml file in a Yaml format Global Block Controls the Prometheus server's global configuration rule_files block specifies the location...



Share this page:
Follow us:
Task Runner