groups:
- name: crrf-rules
  rules:
  - alert: CRRFWorkflowDagInstanceRunFailed
    annotations:
      message: The Workflow {{ $labels.dag_ins_id }} is Failed. business_type is {{ $labels.business_type }}, business_action is {{ $labels.business_action }}, business_id is {{ $labels.business_id }}
    expr: |
      fastflow_executor_dag_ins_failed{worker_key=~"dataflow-workflow.*",business_type=~"crrf"} > 0
    for: 0m
    labels:
      severity: major
      response_class: ticket
      component: br
      oncall_team: tidb_x_tools
  - alert: CRRFEnableTooLong
    annotations:
      message: The TiDB Cluster {{ $labels.cluster_id }} CRRF enable takes too long.
    expr: |
      dataflow_crrf_status{deleted!="true"} == 2
    for: 30m
    labels:
      severity: major
      response_class: ticket
      component: br
      oncall_team: tidb_x_tools
  - alert: CRRFEnableTooLongCritical
    annotations:
      message: The TiDB Cluster {{ $labels.cluster_id }} CRRF enable takes too long.
    expr: |
      dataflow_crrf_status{deleted!="true"} == 2
    for: 1h
    labels:
      severity: critical
      response_class: page
      component: br
      oncall_team: tidb_x_tools
  - alert: CRRFDisableTooLong
    annotations:
      message: The TiDB Cluster {{ $labels.cluster_id }} CRRF disable takes too long.
    expr: |
      dataflow_crrf_status{deleted!="true"} == 4
    for: 30m
    labels:
      severity: major
      response_class: ticket
      component: br
      oncall_team: tidb_x_tools
  - alert: CRRFDisableTooLongCritical
    annotations:
      message: The TiDB Cluster {{ $labels.cluster_id }} CRRF disable takes too long.
    expr: |
      dataflow_crrf_status{deleted!="true"} == 4
    for: 1h
    labels:
      severity: critical
      response_class: page
      component: br
      oncall_team: tidb_x_tools
  - alert: CRRFFailed
    annotations:
      message: The TiDB Cluster {{ $labels.cluster_id }} CRRF operation failed.
    expr: |
      dataflow_crrf_status{deleted!="true"} == 5
    for: 0m
    labels:
      severity: critical
      response_class: page
      component: br
      oncall_team: tidb_x_tools

