Hive Hive
Sign in

feat(forage): add Grafana alert ingestion via per-product webhooks

GitHub issue · Closed

Metadata
Source
tuist/hive #23
Updated
Jun 24, 2026
Domains
Hive
Details

Summary

  • Add a per-product inbound webhook system (/webhooks/products/:product_id/:source/:token). Tokens are generated once at creation, shown via a Noora <.alert> callout, and persisted only as SHA-256 hashes; lookup at ingest is constant-time. Source is currently :grafana; the schema and routing are ready for additional sources.
  • Ingest Grafana Unified Alerting payloads into a new forage_grafana_alerts table keyed on (product_id, fingerprint), so firing and resolved deliveries thread into a single row with status transitions instead of stacking duplicates.
  • Replace the Grafana alerts placeholder forage page with a real LiveView that lists ingested alerts (status + product badges, “Open in Grafana” link), gated to organization members through the existing Hive.Forage.Policy.
  • Settings → Products → product gains a Noora-modal-based webhook manager: pick source via <.dropdown>, generate, see the URL revealed once, delete to rotate. Seeds insert two webhooks and four illustrative alerts so the forage page is populated out of the box.
  • Document the operator workflow in README.md (### Inbound webhooks (Grafana alerts)), and add an AGENTS.md convention requiring the README to stay in sync with user-facing feature changes.

Testing

  • mix compile --warnings-as-errors
  • mix test (275 passing)
  • mix run priv/repo/seeds.exs (idempotent; verified two webhooks + four alerts inserted)
  • Manual: created/deleted a webhook through the modal, observed the one-shot URL banner, confirmed the Grafana alerts forage page renders the seeded firing/resolved items.
Comments

No GitHub comments yet.