← Back to docs
Recipe

Recipe: Prometheus alerting rules writer

Generate production-grade Prometheus alerting rules from natural language descriptions of SLOs and failure modes.

Overview

This recipe takes a plain-English description of a service reliability target and emits a complete Prometheus rule group with correct expr,for,labels, and annotations fields.

Input

Describe the alert you need. Include the metric name, threshold, evaluation window, and desired severity. Example:

"Alert when the error rate of the checkout service
exceeds 1% over a 5-minute window. Severity: critical.
Route to the on-call team via PagerDuty."

Output

The model returns a complete rule group:

groups:
  - name: checkout_service_alerts
    rules:
      - alert: HighErrorRate
        expr: |
          rate(http_requests_total{
            service="checkout",status=~"5.."
          }[5m]) / rate(http_requests_total{
            service="checkout"
          }[5m]) > 0.01
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Checkout error rate > 1%"
          description: "Checkout error rate is
            {{ $value | humanizePercentage }}"
          runbook_url: "https://wiki.example.com/
            runbooks/checkout-errors"

Best practices

  • Always specify a runbook_url annotation.
  • Use for to avoid flapping on transient spikes.
  • Prefer rate-over-rate expressions for error budgets.
  • Group related alerts under a single rule group name.

This recipe is available on all Meridian plans. See pricing for rate limits.