메인 콘텐츠로 건너뛰기
TimeSeries 테이블의 데이터를 사용해 prometheus 쿼리를 평가합니다.

구문

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)

인수

  • db_name - TimeSeries 테이블이 있는 데이터베이스 이름입니다.
  • time_series_table - TimeSeries 테이블 이름입니다.
  • promql_query - PromQL 구문으로 작성한 쿼리입니다.
  • evaluation_time - 평가 시각의 타임스탬프입니다. 현재 시각을 기준으로 쿼리를 평가하려면 evaluation_timenow()`를 사용합니다.

반환 값

함수는 promql_query 매개변수에 전달된 쿼리의 결과 유형에 따라 반환하는 컬럼이 달라질 수 있습니다:
결과 유형결과 컬럼예시
vectortags Array(Tuple(String, String)), timestamp TimestampType, value ValueTypeprometheusQuery(mytable, ‘up’)
matrixtags Array(Tuple(String, String)), time_series Array(Tuple(TimestampType, ValueType))prometheusQuery(mytable, ‘up[1m]‘)
scalarscalar ValueTypeprometheusQuery(mytable, ‘1h30m’)
stringstring StringprometheusQuery(mytable, ‘“abc”‘)

지원되는 PromQL 기능

셀렉터

인스턴트 셀렉터, 범위 셀렉터, 레이블 매처(=, !=, =~, !~), offset 수정자, @ 타임스탬프 수정자, 서브쿼리.

함수

범주함수
범위rate, irate, delta, idelta, last_over_time
수학abs, sgn, floor, ceil, sqrt, exp, ln, log2, log10, rad, deg
삼각sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh
DateTimeday_of_week, day_of_month, days_in_month, day_of_year, minute, hour, month, year
유형scalar, vector
히스토그램histogram_quantile
기타time, pi
참고: histogram_quantile은 클래식 히스토그램 버킷(le 레이블로 식별됨)에 선형 보간을 사용합니다. 네이티브 히스토그램은 아직 지원되지 않으며, phi(분위수 수준) 인수는 현재 상수 스칼라여야 합니다. histogram_quantile(time() / 1000, ...)처럼 각 간격마다 달라지는 표현식은 NOT_IMPLEMENTED 오류와 함께 거부됩니다.

연산자

on()/ignoring()group_left()/group_right() 수정자와 함께 사용하는 모든 산술(+, -, *, /, %, ^) 연산자, 비교(==, !=, <, >, <=, >=, 선택적 bool 포함) 연산자, 논리(and, or, unless) 이항 연산자입니다. 단항 연산자 +-.

집계 연산자

sum, avg, min, max, count, stddev, stdvar, group, quantile, topk, bottomk, limitk — 선택적으로 by() 또는 without() 수정자와 함께 사용할 수 있습니다. 아직 지원되지 않습니다: count_values.

예시

SELECT * FROM prometheusQuery(mytable, 'rate(http_requests{job="prometheus"}[10m])[1h:10m]', now())
마지막 수정일 2026년 6월 25일