> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Modifiers

> Explains PromQL modifiers offset and @ to query and anchor historical metric values and ranges for debugging, incident analysis, and retrospective inspection.

This lesson explains how to query historic metric values with PromQL modifiers. So far we've been returning the most recent value for a metric. PromQL provides two modifiers — `offset` and `@` — to look back in time or anchor queries to a specific timestamp. Use these when you need to inspect values from minutes, hours, or days in the past, or when debugging incidents that happened at a particular time.

## offset — shift relative to “now” or an anchored time

Use the `offset` modifier to retrieve a metric value from some time ago. The modifier accepts a time duration (for example, `5m` for five minutes):

```promql theme={null}
node_memory_Active_bytes{instance="node1"} offset 5m
```

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/g3ob3hoM5yRC7KZS/images/Prep-Course-Prometheus-Certified-Associate-PCA-Certification/PromQL/Modifiers/time-unit-suffixes-meanings-table.jpg?fit=max&auto=format&n=g3ob3hoM5yRC7KZS&q=85&s=9ef48fceacbc46514d2393f98fd2e640" alt="The image is a table showing time unit suffixes with their meanings, including milliseconds, seconds, minutes, hours, days, weeks, and years." width="1920" height="1080" data-path="images/Prep-Course-Prometheus-Certified-Associate-PCA-Certification/PromQL/Modifiers/time-unit-suffixes-meanings-table.jpg" />
</Frame>

Supported time suffixes:

| Suffix | Meaning      |
| ------ | ------------ |
| `ms`   | milliseconds |
| `s`    | seconds      |
| `m`    | minutes      |
| `h`    | hours        |
| `d`    | days         |
| `w`    | weeks        |
| `y`    | years        |

Examples:

```promql theme={null}
# Five days ago
node_memory_Active_bytes{instance="node1"} offset 5d

# Two weeks ago
node_memory_Active_bytes{instance="node1"} offset 2w

# One and a half hours ago (two equivalent forms)
node_memory_Active_bytes{instance="node1"} offset 90m
node_memory_Active_bytes{instance="node1"} offset 1h30m
```

## @ — anchor to an exact timestamp

To evaluate a metric at an exact point in time, use the `@` modifier with a Unix timestamp (seconds since the epoch). This returns the sample closest to that timestamp:

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/g3ob3hoM5yRC7KZS/images/Prep-Course-Prometheus-Certified-Associate-PCA-Certification/PromQL/Modifiers/offset-modifier-at-navigator-slide.jpg?fit=max&auto=format&n=g3ob3hoM5yRC7KZS&q=85&s=990159970162ecafd40353e6c096b2a5" alt="The image is a slide titled &#x22;Offset Modifier,&#x22; explaining how to use the &#x22;@&#x22; modifier to navigate to a specific point in time, with a green label highlighting &#x22;@ modifier.&#x22;" width="1920" height="1080" data-path="images/Prep-Course-Prometheus-Certified-Associate-PCA-Certification/PromQL/Modifiers/offset-modifier-at-navigator-slide.jpg" />
</Frame>

```promql theme={null}
# Value at a specific Unix timestamp
node_memory_Active_bytes{instance="node1"} @1663265188
```

Note: Unix timestamps used with `@` are in seconds. Many tools can convert a human-readable time into the Unix epoch if needed.

## Combining @ and offset

You can combine `@` and `offset`. When both are present, the `@` timestamp serves as the anchor point and `offset` shifts relative to that anchor. The order of `@` and `offset` does not matter — both forms are equivalent:

```promql theme={null}
node_memory_Active_bytes{instance="node1"} @1663265188 offset 5m
node_memory_Active_bytes{instance="node1"} offset 5m @1663265188
```

Both queries return the metric value five minutes before the specified timestamp (for example, if the timestamp corresponds to 06:06, the returned value is from 06:01).

<Callout icon="lightbulb" color="#1CB2FE">
  You can use `offset` and `@` with instantaneous vectors (single-value queries) or with range vectors (time windows). The `@` timestamp anchors the evaluation, and `offset` shifts that anchored timestamp or window.
</Callout>

## Range vectors with anchors and offsets

Range vectors use square brackets to request a window of samples, for example `[2m]`. By default, `[2m]` refers to the most recent two minutes. When combined with `@` and/or `offset`, the range vector is anchored and shifted accordingly:

```promql theme={null}
# Two minutes of data anchored at the timestamp (e.g., covering 06:04–06:06 if the timestamp is 06:06)
node_memory_Active_bytes{instance="node1"}[2m] @1663265188

# Two minutes of data anchored at the timestamp, then offset 10 minutes earlier
node_memory_Active_bytes{instance="node1"}[2m] @1663265188 offset 10m
```

These modifiers let you precisely inspect historical values and sample windows — useful for incident postmortems, trend analysis, and retroactive debugging.

## Additional resources

* Prometheus PromQL documentation: [https://prometheus.io/docs/prometheus/latest/querying/basics/](https://prometheus.io/docs/prometheus/latest/querying/basics/)
* PromQL examples and timestamp usage: [https://prometheus.io/docs/prometheus/latest/querying/expression/](https://prometheus.io/docs/prometheus/latest/querying/expression/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/prometheus-certified-associate-pca/module/b4de09eb-de60-4a9d-a193-b6f74f9889a3/lesson/79b04571-939c-45cb-adf9-7e273e92da79" />
</CardGroup>
