>_ IzzyLab

Hands-on task

This task is step 7 of the course “Monitoring and metrics”

Prometheus: metric with labels

easy~5 min

Create a file /root/metrics.prom in Prometheus textfile format with the metric http_requests_total, labeled with: method="get", code="200" with value 42 and method="post", code="500" with value 3.

The file is handy to type in the Editor tab: create metrics.prom in /root (Ctrl+S saves it).

What you'll practise:
  • prometheus
  • metrics format
  • labels
  • time series
  • text export

Topic breakdown

The Prometheus textfile format is simple: one line — one metric of the form name{label="value",...} number. Labels in curly braces refine the measurement (method, response code), and their values must be in double quotes. The same metric name with different sets of labels is a different time series, so a separate line is composed for each set from the task.

What's checked

  1. there's a get/200 series with value 42
  2. there's a post/500 series with value 3

What it looks like