> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Avalia uma consulta do Prometheus usando dados de uma tabela TimeSeries.

# prometheusQueryRange

Avalia uma consulta do Prometheus usando dados de uma tabela TimeSeries em um intervalo de momentos de avaliação.

<div id="syntax">
  ## Sintaxe
</div>

```sql theme={null}
prometheusQueryRange('db_name', 'time_series_table', 'promql_query', start_time, end_time, step)
prometheusQueryRange(db_name.time_series_table, 'promql_query', start_time, end_time, step)
prometheusQueryRange('time_series_table', 'promql_query', start_time, end_time, step)
```

<div id="arguments">
  ## Argumentos
</div>

* `db_name` - O nome do banco de dados em que uma tabela TimeSeries está localizada.
* `time_series_table` - O nome de uma tabela TimeSeries.
* `promql_query` - Uma consulta escrita em [sintaxe PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/).
* `start_time` - O horário de início do intervalo de avaliação.
* `end_time` - O horário de término do intervalo de avaliação.
* `step` - O passo usado para percorrer o tempo de avaliação de `start_time` até `end_time` (inclusive).

<div id="returned_value">
  ## Valor retornado
</div>

A função pode retornar colunas diferentes, dependendo do tipo de resultado da consulta passada no parâmetro `promql_query`:

| Tipo de resultado | Colunas retornadas                                                                     | Exemplo                             |
| ----------------- | -------------------------------------------------------------------------------------- | ----------------------------------- |
| vector            | tags Array(Tuple(String, String)), timestamp TimestampType, value ValueType            | prometheusQuery(mytable, 'up')      |
| matrix            | tags Array(Tuple(String, String)), time\_series Array(Tuple(TimestampType, ValueType)) | prometheusQuery(mytable, 'up\[1m]') |
| scalar            | scalar ValueType                                                                       | prometheusQuery(mytable, '1h30m')   |
| string            | string String                                                                          | prometheusQuery(mytable, '"abc"')   |

<div id="example">
  ## Exemplo
</div>

```sql theme={null}
SELECT * FROM prometheusQueryRange(mytable, 'rate(http_requests{job="prometheus"}[10m])[1h:10m]', now() - INTERVAL 10 MINUTES, now(), INTERVAL 1 MINUTE)
```
