Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 37 ยท Concepts and Setup

Time Series Data, Time Ranges and Time Zones

Understand time series data in Grafana: timestamps, intervals, min step, max data points, relative and absolute time ranges, time zones, refresh and the $__interval variable.

Almost everything in Grafana revolves around time. A time series is a list of (timestamp, value) pairs, usually with labels that say which thing the numbers describe. This lesson explains how Grafana picks the time window, how many points it asks for, and why a graph looks different at different zoom levels.

What is a time series?

Consider a web server's request counter, sampled every 15 seconds:

time value labels
10:00:00 1200 host="web-1"
10:00:15 1236 host="web-1"
10:00:30 1291 host="web-1"

Each distinct label set is a separate series. Two servers produce two series, drawn as two lines. Timestamps are stored in UTC (usually as Unix epoch seconds or milliseconds), and Grafana converts them for display.

The dashboard time range

The picker in the top right defines from and to:

  • Relative: now-6h to now (Last 6 hours). The window moves as time passes.
  • Absolute: fixed start and end, e.g. 2026-03-01 08:00 to 2026-03-01 09:00; good for reviewing an incident.
  • Rounded: now/d means "start of today", now-1d/d "start of yesterday", now/w "start of week". Syntax: now, units s m h d w M y, and /unit to round down.

Examples: now-7d to now; now/M to now (month to date); now-1M/M to now-1M/M (the whole previous month when you use the end-of-period behavior in the UI).

Panels can override the range under Query options (Relative time, Time shift) to compare "now" with "a week ago".

How many points?

The browser cannot draw millions of points, so Grafana sends the data source two helper values:

  • Max data points (default roughly the panel width in pixels).
  • Interval (or min interval): the time step between returned points.

Grafana computes $__interval as roughly range / maxDataPoints, rounded to a "nice" duration, and never lower than the data source's min interval (the scrape interval for Prometheus). Queries use it to group samples, for example avg_over_time(cpu[$__interval]).

The stand-in below reproduces the calculation and shows how a one-hour and a 30-day range lead to different steps.

JS Stand-in: compute an interval

Press Run (or Ctrl + Enter) to see the console output here.

No output.

(The real algorithm is similar in spirit; exact rounding rules differ between data sources, so treat this as an explanation of the idea.)

Interval variables

Grafana provides built-in variables you can use inside queries:

Variable Meaning
$__interval Step computed from the range and max data points
$__interval_ms Same in milliseconds
$__rate_interval Prometheus: safe window for rate(), at least 4 x scrape interval
$__from, $__to Range bounds as epoch milliseconds
$__range Length of the range, e.g. 3600s

For Prometheus counters prefer rate(http_requests_total[$__rate_interval]).

Time zones

Grafana can show times in the browser's zone, in UTC, or in a named zone. Set it per dashboard (settings) or per user (profile). Because teams often span zones, many choose UTC for incident dashboards. Data stored without a zone (a SQL DATETIME) is assumed to be UTC unless the data source says otherwise, a frequent source of "data is off by 2 hours" bugs.

JS Stand-in: epoch to local time

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Refresh and live data

Auto-refresh re-runs queries every N seconds. Be kind to your data source: a refresh of 5s on a heavy dashboard multiplies load. Typical choices are 30s to 1m for operations, and none for historical analysis. Some sources support live streaming where data is pushed to the browser.

Zooming and sharing

Click and drag on a graph to zoom into that range; the whole dashboard follows. Use the browser back button or the zoom out button to return. A dashboard URL contains from= and to=, so sharing a link shares the exact window, for example ?from=now-1h&to=now or absolute epoch milliseconds.

Resolution matters

When you zoom out, Grafana asks for coarser steps, so peaks can disappear because an average smooths them. Use max aggregation for spike detection and avg for trends. The stand-in shows the same data at two resolutions.

JS Stand-in: averaging hides spikes

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the time range now-6h to now mean?

    Relative ranges are recalculated against the current time.
  2. 2. What does now/d represent?

    The / rounds down to the start of the unit: day, week (w), month (M), year (y).
  3. 3. Which variable is recommended for Prometheus rate() windows?

    $__rate_interval accounts for the scrape interval so rate() always has enough samples.
  4. 4. Why can a spike disappear when you zoom out with avg aggregation?

    Coarser buckets average values together; use max to keep peaks visible.

Summary

  • A time series is timestamped values plus labels; one label set = one series.
  • Relative, absolute and rounded ranges control the window.
  • Max data points and min interval decide the step; $__interval exposes it.
  • Pick the right time zone and use UTC for shared incident views.
  • Aggregation affects what you see; choose avg, max or sum deliberately.

Next: Data Sources Overview