avg_over_time()
Observability

Meaning

Calculates the average value of a time series over a specified time interval. Used in monitoring and alerting to summarize metric behavior.

Primary Function

Time series aggregation

Communicative Purpose

Summarizes metric data over a window to observe trends or trigger alerts.

Pattern

avg_over_time(metric[duration])

Core Structure

avg_over_time([...])

Função primária

Time series aggregation

Propósito comunicativo

Summarizes metric data over a window to observe trends or trigger alerts.

Situações de gatilho

Creating dashboard panels, setting up alert rules, analyzing service latency over the last 5 minutes.

Contextos

Prometheus monitoring stacks, Grafana dashboards, SRE tooling, cloud-native observability.

Padrão

avg_over_time(metric[duration])

Estrutura central

avg_over_time([...])

Slots de substituição

metric: selector string (e.g., http_requests_total), duration: time duration string like '5m', '1h'

Colocados típicos

  • sum_over_time
  • max_over_time
  • rate
  • increase

Substituições comuns

  • avg over time can be approximated by avg without brackets for instant vectors
  • or using recording rules

Erros comuns

Using avg_over_time with an instant vector (missing brackets) causing type errors; confusing with avg aggregation over labels.

Similar / contraste

avg (instant aggregation) – computes average across label dimensions at a single point; avg_over_time averages over time.

Interferências

Coming from traditional SQL: may confuse avg_over_time with SQL AVG over time windows; note the bracket syntax is Prometheus-specific.

Família do chunk

  • time_series_aggregation
  • rate_over_time
  • increase_over_time

Nuance

The duration must be a valid Prometheus duration; the function returns a scalar if the range vector resolves to a single series, otherwise a vector of values per series.

Efeito pragmático

Enables concise expression of temporal trends, reduces need for complex recording rules.

Dica de memória

Think ‘average over time’ – picture a graph line smoothing.

Nota

If the range vector resolves to a single series, the result is a scalar; otherwise a vector of averaged values per series

Upgrade path

Precompute with recording rules for efficiency, or combine with sum_over_time for custom aggregations

Frequência: MediumFormulaicidade: Semi-fixedTipo de construção: aggregation functionPrioridade de aquisição: Recognition firstPrioridade de output: BothTag de espaçamento: Medium-term

Log in to save chunks.