> ## 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.

> TimeSeries 테이블의 데이터를 사용해 prometheus 쿼리를 평가합니다.

# prometheusQuery

TimeSeries 테이블의 데이터를 사용해 prometheus 쿼리를 평가합니다.

<div id="syntax">
  ## 구문
</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">
  ## 인수
</div>

* `db_name` - TimeSeries 테이블이 있는 데이터베이스 이름입니다.
* `time_series_table` - TimeSeries 테이블 이름입니다.
* `promql_query` - [PromQL 구문](https://prometheus.io/docs/prometheus/latest/querying/basics/)으로 작성한 쿼리입니다.
* `evaluation_time - 평가 시각의 타임스탬프입니다. 현재 시각을 기준으로 쿼리를 평가하려면 `evaluation\_time`에 `now()\`를 사용합니다.

<div id="returned_value">
  ## 반환 값
</div>

함수는 `promql_query` 매개변수에 전달된 쿼리의 결과 유형에 따라 반환하는 컬럼이 달라질 수 있습니다:

| 결과 유형  | 결과 컬럼                                                                                  | 예시                                  |
| ------ | -------------------------------------------------------------------------------------- | ----------------------------------- |
| 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">
  ## 예시
</div>

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