groups:
- name: tiproxy-control-plane
  rules:
  - alert: TiProxyRestartedUnexpectedly
    expr: (increase(kube_pod_container_status_restarts_total{container="tiproxy"}[5m])>0) * ignoring (reason) group_left(reason) (kube_pod_container_status_last_terminated_reason{reason!='Completed', container="tiproxy"}==1)
    labels:
      severity: major
      response_class: ticket
      expr: (increase(kube_pod_container_status_restarts_total{container="tiproxy"}[5m])>0) * ignoring (reason) group_left(reason) (kube_pod_container_status_last_terminated_reason{reason!='Completed', container="tiproxy"}==1)
      component: tiproxy
      oncall_team: tiproxy
      tier: next-gen
    annotations:
      description: 'TiProxy container {{ $labels.namespace }}/{{ $labels.pod }} in cluster {{ $labels.cluster }} has restarted unexpectedly due to {{ $labels.reason }}. Unexpected container restarts may indicate resource issues, configuration problems, or application errors. Please investigate the root cause to prevent further disruptions to connection routing.'
      summary: tiproxy container just restarted unexpectedly
