fix(infra): replace classic_condition with reduce+threshold expressions#3530
fix(infra): replace classic_condition with reduce+threshold expressions#3530manamana32321 wants to merge 1 commit intomainfrom
Conversation
Grafana 12.x removed classic_condition expression type. Replace all alert rule conditions with reduce (refId B) + threshold (refId C) pattern as required by modern Grafana. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request migrates Grafana alert configurations from classic_condition to the Unified Alerting engine by introducing reduce and threshold expressions across the production and stage environments. While the structural changes are correct, the alert descriptions in the annotations still reference the raw range query ($values.A) instead of the reduced result ($values.B). This could lead to incorrect or missing values in alert notifications, so it is recommended to update these references to ensure proper data reporting.
| annotations: | ||
| summary: 'RabbitMQ unacked messages > 50' | ||
| description: '큐 {{ `{{ $labels.queue }}` }}에 미확인 메시지 {{ `{{ $values.A }}` }}개' | ||
| description: '큐 {{ `{{ $labels.queue }}` }}에 미확인 메시지 {{ `{{ $values.A }}` }}개' No newline at end of file |
There was a problem hiding this comment.
Grafana 10 이상에서 도입된 새로운 Alerting 엔진(Unified Alerting)에서는 classic_condition 대신 reduce와 threshold 표현식을 사용할 때, 알림 메시지(annotations)에서 수치 데이터를 참조하려면 range query인 A 대신 reduction 결과인 B를 사용하는 것이 권장됩니다. $values.A를 사용하면 시계열 데이터 전체가 참조되어 알림 메시지에 값이 정상적으로 표시되지 않을 수 있습니다. 이 변경 사항은 diff에 포함되지 않은 다른 alert rule의 description에도 동일하게 적용하는 것이 좋습니다.
description: '큐 {{ {{ $labels.queue }} }}에 미확인 메시지 {{ {{ $values.B }} }}개'| annotations: | ||
| summary: 'RabbitMQ unacked messages > 50' | ||
| description: '큐 {{ `{{ $labels.queue }}` }}에 미확인 메시지 {{ `{{ $values.A }}` }}개' | ||
| description: '큐 {{ `{{ $labels.queue }}` }}에 미확인 메시지 {{ `{{ $values.A }}` }}개' No newline at end of file |
There was a problem hiding this comment.
Grafana 10 이상에서 도입된 새로운 Alerting 엔진(Unified Alerting)에서는 classic_condition 대신 reduce와 threshold 표현식을 사용할 때, 알림 메시지(annotations)에서 수치 데이터를 참조하려면 range query인 A 대신 reduction 결과인 B를 사용하는 것이 권장됩니다. $values.A를 사용하면 시계열 데이터 전체가 참조되어 알림 메시지에 값이 정상적으로 표시되지 않을 수 있습니다. 이 변경 사항은 diff에 포함되지 않은 다른 alert rule의 description에도 동일하게 적용하는 것이 좋습니다.
description: '큐 {{ {{ $labels.queue }} }}에 미확인 메시지 {{ {{ $values.B }} }}개'
Description
Grafana 12.x에서
classic_conditionexpression type이 제거되어 모든 alert rule이 에러 상태로 firing되는 문제를 수정합니다.모든 alert rule의 condition을
reduce(refId B) +threshold(refId C) 패턴으로 교체합니다.Additional context
invalid command type in expression 'C': 'classic_condition' is not a recognized expression typeBefore submitting the PR, please make sure you do the following
fixes #123).