본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

InfluxDB 메트릭

원문 보기 위키 갱신

Argo Rollouts의 분석에서 InfluxDB를 메트릭 공급자로 사용하면 Flux 쿼리로 측정값을 얻을 수 있습니다. 이 문서에서는 InfluxDB 기반의 AnalysisTemplate을 구성하는 방법과 접근 프로필(access profile)을 설정하는 방법을 안내해 드릴게요.

출처: Argo Rollouts 문서

본문

Flux를 사용한 InfluxDB 쿼리를 이용해 분석의 측정값을 얻을 수 있습니다.

apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
  name: error-rate
spec:
  args:
  - name: application-name
  metrics:
  - name: error-rate
    # NOTE: To be consistent with the prometheus metrics provider InfluxDB query results are returned as an array.
    # In the example we're looking at index 0 of the returned array to obtain the value we're using for the success condition
    successCondition: result[0] <= 0.01
    provider:
      influxdb:
        profile: my-influxdb-secret  # optional, defaults to 'influxdb'
        query: |
          from(bucket: "app_istio")
            |> range(start: -15m)
            |> filter(fn: (r) => r["destination_workload"] == "{{ args.application-name }}")
            |> filter(fn: (r) => r["_measurement"] == "istio:istio_requests_errors_percentage:rate1m:5xx")

InfluxDB 접근 프로필은 argo-rollouts 네임스페이스의 Kubernetes secret을 사용해 구성할 수 있습니다. 같은 형식의 secret을 더 만들어 두고 메트릭 공급자 구성에서 profile 필드로 어떤 secret을 사용할지 지정하면 여러 계정을 사용할 수 있습니다.

apiVersion: v1
kind: Secret
metadata:
  name: influxdb
type: Opaque
stringData:
  address: <infuxdb-url>
  authToken: <influxdb-auth-token>
  org: <influxdb-org>

더 알아보기 (Learn more)

  • Prometheus 메트릭 공급자를 활용한 카나리 분석
  • AnalysisTemplate의 성공/실패 조건 설정
  • 메트릭 공급자별 측정값 처리 방식 (배열 인덱스, NaN, 무한대)
  • InfluxDB Flux 쿼리를 이용한 애플리케이션 지표 수집