World map

 

BM: Baca dalam Bahasa Melayu

World O2: Counters

Instant and range vectors

You will learn: the difference between one value now and a window of values, and which one functions need.

Checked with Prometheus 3 on 1 Nov 2026

The problem

Two questions: “How many customers wait now?” and “What was the most in the last 10 minutes?” Same kind of answer?

Pick one answer.

Try it

One value per series, right now, is an instant vector: One value per series, at one moment. Graphs draw these.. Ask for a window instead.

Add [5m] right after the name, then Run. Count the samples in each row.

Metrics in this data (tap to add):

Time 0 is when the data starts. The query looks back from the eval time.

Predict

That window is a range vector: Every sample per series in a window, like [5m]. Functions like rate() need one.. Prometheus scrapes every 1m here. How many samples are in [5m]?

Pick one answer.

Try it

Run it and read the red message. Then fix it.

Find the most customers waiting in the last 10 minutes.

Metrics in this data (tap to add):

Time 0 is when the data starts. The query looks back from the eval time.

Try it

Instant or range? Sort each query.

Drag a card into a box. Or tap the card, then tap the box.

      Check

      Can the graph draw kedai_customers_waiting[5m]?

      Pick one answer.

      You did it!

      You can now tell instant vectors from range vectors and fix a missing window.

      Go deeper (optional)

      An instant query looks back up to 5 minutes for the newest sample. Prometheus 3 made windows left-open: (now − 5m, now]. The HTTP API names the type too. This answer is real:

      bash
      curl -s 'localhost:9090/api/v1/query?query=up'
      {"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","instance":"node-exporter:9100","job":"node"},"value":[1793537441.393,"1"]},{"metric":{"__name__":"up","instance":"localhost:9090","job":"prometheus"},"value":[1793537441.393,"1"]}]}}
      The query API answers up as JSON. resultType is vector, with one value per target.

      Real mission

      1. docker compose up -d
      2. curl -s 'localhost:9090/api/v1/query?query=up'
      3. docker compose down

      0 of 4 steps done · Your ticks are saved.