confluent cloud metrics api 에서 겪은 오류

마가·2022년 8월 12일
0

trial-error

목록 보기
4/19

https://docs.confluent.io/cloud/current/monitoring/metrics-api.html#query-for-average-consumer-lag-over-the-last-hour-grouped-by-topic-and-consumer-group
를 따라하는데 데이터가 [] 으로만 나오는 것이다!

{
  "aggregations": [
    {
      "metric": "io.confluent.kafka.server/consumer_lag_offsets"
    }
  ],
  "filter": {
    "field": "resource.kafka.id",
    "op": "EQ",
    "value": "lkc-XXXXX"
  },
  "granularity": "PT1H",
  "group_by": [
    "metric.consumer_group_id",
    "metric.topic"
  ],
  "intervals": [
    "PT1M/now"
  ],
  "limit": 25
}

저기 적혀있는대로 복붙을 했는데 말이다.

문의를 해 보았더니 답변은 아래와 같다.

Your query has 1 Hour granularity but you fetch only last minute data. That is why you have empty data.
You can find the details of the metrics API in this link: https://api.telemetry.confluent.cloud/docs#tag/Version-2/paths/~1v2~1metrics~1%7Bdataset%7D~1query/post

Please run the below API call and check the results.
{
  "aggregations": [
    {
      "metric": "io.confluent.kafka.server/consumer_lag_offsets"
    }
  ],
  "filter": {
    "field": "resource.kafka.id",
    "op": "EQ",
    "value": "lkc-xxxxxx"
  },
  "granularity": "PT1M",
  "group_by": [
    "metric.consumer_group_id",
    "metric.topic"
  ],
  "intervals": [
    "PT2M/now"
  ],
  "limit": 25
}

즉 granularity 가 intervals 보다 작아야 한다는 것이다.

profile
마음 가는 길은 죽 곧은 길

0개의 댓글