> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.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.

# prometheusQuery

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

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

```sql theme={null}
prometheusQuery('db_name', 'time_series_table', 'promql_query', evaluation_time)
prometheusQuery(db_name.time_series_table, 'promql_query', evaluation_time)
prometheusQuery('time_series_table', 'promql_query', evaluation_time)
```

<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/).
* `evaluation_time - O timestamp de avaliação. Para avaliar uma consulta no momento atual, use `now()`como`evaluation\_time\`.

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

A função pode retornar colunas diferentes, dependendo do tipo de resultado da consulta fornecida 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 prometheusQuery(mytable, 'rate(http_requests{job="prometheus"}[10m])[1h:10m]', now())
```
