Skip to content

fix(infra): replace classic_condition with reduce+threshold expressions#3530

Draft
manamana32321 wants to merge 1 commit intomainfrom
fix/alert-expressions
Draft

fix(infra): replace classic_condition with reduce+threshold expressions#3530
manamana32321 wants to merge 1 commit intomainfrom
fix/alert-expressions

Conversation

@manamana32321
Copy link
Copy Markdown
Member

Description

Grafana 12.x에서 classic_condition expression 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 type
  • stage 환경에서 배포 후 Discord 알림으로 확인된 문제

Before submitting the PR, please make sure you do the following

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>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Grafana 10 이상에서 도입된 새로운 Alerting 엔진(Unified Alerting)에서는 classic_condition 대신 reducethreshold 표현식을 사용할 때, 알림 메시지(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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Grafana 10 이상에서 도입된 새로운 Alerting 엔진(Unified Alerting)에서는 classic_condition 대신 reducethreshold 표현식을 사용할 때, 알림 메시지(annotations)에서 수치 데이터를 참조하려면 range query인 A 대신 reduction 결과인 B를 사용하는 것이 권장됩니다. $values.A를 사용하면 시계열 데이터 전체가 참조되어 알림 메시지에 값이 정상적으로 표시되지 않을 수 있습니다. 이 변경 사항은 diff에 포함되지 않은 다른 alert rule의 description에도 동일하게 적용하는 것이 좋습니다.

              description: '큐 {{ {{ $labels.queue }} }}에 미확인 메시지 {{ {{ $values.B }} }}개'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant