• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Logflare / logflare / 3832ded3c54987551eae90e4e86f3647fe3d4fe4

15 Jul 2026 09:22PM UTC coverage: 80.895% (+0.1%) from 80.798%
3832ded3c54987551eae90e4e86f3647fe3d4fe4

push

github

web-flow
feat: add Management API endpoint for alerts (Api.AlertController) (#3682)

* feat: add Management API endpoint for alerts (Api.AlertController)

Add CRUD for Logflare.Alerting.AlertQuery at /api/alerts, mirroring the
existing Api.RuleController pattern:

- Alerting.fetch_alert_query_by_user_access/2: token-based, team-scoped
  fetch analogous to Rules.fetch_rule_by/1.
- Alerting.update_alert_query/2 now accepts backends under either the
  :backends or "backends" key, so API callers (string-keyed JSON) and
  LiveView (atom-keyed) both work without mixing key types in one map.
- Api.AlertController: index/show/create/update/delete. update/2 verifies
  ownership of any backend_ids being attached, blocking cross-tenant
  backend repointing.
- /api/alerts routes and AlertApiSchema for OpenAPI docs.

Implements O11Y-2143.

* fix: expose attached backends on alerts (same read-gap bug as elsewhere)

AlertQuery's Jason.Encoder didn't serialize :backends, even though
Api.AlertController.update/2 lets a client attach backends via
backend_ids -- the same writable-but-unreadable-via-API gap found and
fixed across Rule/Source/Endpoint in O11Y-2144, just in code from this
same PR. Add :backends to the encoder's only: list, preload it in every
controller action before serializing (index/show/create/update), and add
a backends property to AlertApiSchema.

* fix: complete alerts Management API contract

39 of 39 new or added lines in 2 files covered. (100.0%)

1 existing line in 1 file now uncovered.

14083 of 17409 relevant lines covered (80.89%)

12321.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.18
/lib/telemetry.ex


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc