Grafana Time Ranges and Intervals
Every chart in Grafana answers a question about a window of time. Which hour do you want to see? How finely should the line be drawn? The time range and the interval control those two choices. Learning both prevents blurry charts, missing spikes, and slow panels.
The Camera Analogy
Think of a camera. The time range works like zoom: a wide shot shows a whole week, a close shot shows five minutes. Interval acts like resolution: a high-resolution photo shows every detail, a low-resolution photo shows only rough shapes. Good monitoring balances both settings.
Time range = how much history you see
Interval = how thick each slice of history is
Range 6 hours, interval 5 minutes --> 72 data points
Range 6 hours, interval 1 minute --> 360 data points
The Time Picker
The time picker sits in the top right corner of every dashboard. Click it to open a menu with quick choices such as Last 5 minutes, Last 1 hour, and Last 7 days.
Relative Ranges
A relative range moves with the clock. now-6h to now always shows the most recent six hours. Use relative ranges for live monitoring.
Absolute Ranges
An absolute range uses fixed dates, such as 1 March 09:00 to 1 March 12:00. Use absolute ranges to study an outage after it ended.
Handy Shortcuts
- Drag across any chart to zoom into that slice of time.
- Click the zoom-out button to widen the range.
- Press t followed by z to zoom out with the keyboard.
- Press t followed by the left arrow to shift backward in time.
Refresh Rate
The refresh picker, next to the time picker, tells Grafana how often to reload the panels. Options run from five seconds to one day. Choose a rate that matches how fast the data changes. A refresh every five seconds for data that updates once a minute wastes resources and adds load to the data source.
Time Zones
Dashboards show time in the browser zone by default. Open Settings to switch a dashboard to UTC or a named zone. Teams spread across countries often agree on UTC, so everyone talks about the same moment.
Understanding the Interval
The interval is the width of each data bucket. Grafana calculates it from two values: the time range and the Max data points setting, which defaults to the pixel width of the panel.
Interval = Time Range / Max Data Points
Range 6 hours = 21,600 seconds
Max data points = 1,000
Interval = 21,600 / 1,000 = about 22 seconds
Grafana rounds the result to a clean step such as 30 seconds. A wider range produces a larger interval, so the line stays readable and never draws millions of points.
Interval Variables in Queries
Query languages use special variables that carry the interval value. These variables keep queries accurate at every zoom level.
| Variable | Meaning |
|---|---|
| $__interval | The calculated bucket width |
| $__interval_ms | The same width in milliseconds |
| $__rate_interval | A safe window for Prometheus rate functions |
| $__range | The full length of the selected time range |
rate(http_requests_total[$__rate_interval])This Prometheus query adjusts its window automatically. The window shrinks when you zoom in and grows when you zoom out.
Min Interval
Your data source collects samples at a fixed pace, such as every 15 seconds. Asking for smaller buckets gives you empty gaps. Set Min interval in the data source settings or in the query options to match the collection pace. A value of 15s stops Grafana from using anything finer.
Panel Time Overrides
Each panel accepts its own time rules under Query options.
Relative Time
Set Relative time to 1h and the panel always shows the last hour, even when the dashboard displays a full week. A stat panel showing the current value benefits from this setting.
Time Shift
Set Time shift to 1d and the panel shows data from exactly one day earlier. Place a shifted panel beside a normal one to compare today with yesterday.
Today ____/\____/\___
Yesterday ___/\____/\____ (time shift 1d)
Choosing Settings That Fit
| Situation | Suggested Range | Suggested Refresh |
|---|---|---|
| Live wall display | Last 30 minutes | 10 seconds |
| Daily health check | Last 24 hours | 1 minute |
| Weekly review | Last 7 days | Off |
| Outage investigation | Absolute range around the incident | Off |
