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

InfluxDB 메트릭 (InfluxDB Metrics)

원문 보기 위키 갱신

Argo Rollouts에서 Flux를 사용한 InfluxDB 쿼리로 분석용 측정값을 얻는 방법을 설명해 드릴게요. 쿼리 결과 포맷과 접근 프로필(secret) 설정까지 옆에서 차근차근 설명할게요.

출처: 문서

본문

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)