nats.yml 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. groups:
  2. - name: nats_resource_limits
  3. interval: 30s
  4. rules:
  5. # F2 (M11 NATS investigation): alert when NATS JetStream storage
  6. # gets close to the server-level max_storage cap. The M11 2026-06-16
  7. # finding was that storage silently filled to the cap (5.46 GiB
  8. # default) and the broker started rejecting publishes, but the
  9. # receive metric kept showing green. This alert would have fired
  10. # well before the system went red.
  11. #
  12. # Threshold: 80% of max_storage for 5 min. F1 raised max_storage
  13. # to 10 GiB (deploy/nats/nats.conf), so 80% = 8 GiB used. Real
  14. # usage after F1 should be ~1.1 GiB (ALERTS 1 GiB + DELIVERIES
  15. # 100 MiB + DLQ 10 MiB).
  16. - alert: NatsJetStreamStorageHigh
  17. expr: |
  18. (jetstream_stats_storage / on() jetstream_config_max_storage) > 0.80
  19. for: 5m
  20. labels:
  21. severity: warning
  22. annotations:
  23. summary: "NATS JetStream storage > 80% of max_storage"
  24. description: |
  25. NATS JetStream storage is at {{ $value | humanizePercentage }} of
  26. max_storage. With stream-level MaxBytes caps from F1, the
  27. streams self-trim, so anything above 80% indicates either
  28. unexpected growth or a misconfigured stream. Check the
  29. ALERTS / DELIVERIES / DLQ stream state via the NATS
  30. monitoring endpoint (http://nats:8222/jsz?streams=true).
  31. - alert: NatsJetStreamStorageCritical
  32. expr: |
  33. (jetstream_stats_storage / on() jetstream_config_max_storage) > 0.95
  34. for: 1m
  35. labels:
  36. severity: critical
  37. annotations:
  38. summary: "NATS JetStream storage > 95% of max_storage"
  39. description: |
  40. NATS is about to enter the 'resource limits exceeded' state and
  41. start rejecting publishes. The M11 NATS investigation documents
  42. this failure mode in detail (M11_NATS_INVESTIGATION.md).
  43. - name: nats_publish_path
  44. interval: 30s
  45. rules:
  46. # F2: alert when ingestd's NATS publish success rate is materially
  47. # below the receive rate. This catches the "system looks healthy
  48. # but publishes are silently failing" class of bug that the M11
  49. # 10-min soak missed.
  50. - alert: IngestdNatsPublishErrorsHigh
  51. expr: |
  52. (
  53. sum(rate(ba_ingestd_nats_publish_total{result="error"}[5m]))
  54. /
  55. sum(rate(ba_ingestd_nats_publish_total[5m]))
  56. ) > 0.05
  57. for: 2m
  58. labels:
  59. severity: warning
  60. annotations:
  61. summary: "ingestd NATS publish error rate > 5%"
  62. description: |
  63. More than 5% of ingestd NATS publish attempts are failing.
  64. Check the ingestd logs and the NATS server logs. The M11
  65. NATS investigation is the playbook for diagnosing this.
  66. - alert: IngestdReceivePublishMismatch
  67. expr: |
  68. (
  69. sum(rate(ba_ingestd_alerts_received_total{transport="grpc",result="accepted"}[5m]))
  70. -
  71. sum(rate(ba_ingestd_nats_publish_total{result="ok"}[5m]))
  72. ) > 100
  73. for: 2m
  74. labels:
  75. severity: warning
  76. annotations:
  77. summary: "ingestd receive rate > publish OK rate"
  78. description: |
  79. The gRPC receive path is accepting alerts at a rate more than
  80. 100/s higher than the NATS publish path is acknowledging. This
  81. indicates the publish path is broken even if individual publish
  82. failures are within tolerance. The M11 10-min soak was a false
  83. positive because it only checked the receive rate.