Skip to content

Migrate metric-alert mutations (create/edit/delete) to detectors API #1277

Closed

Description

@jared-outpost

Follow-up to #1275, which migrated the metric-alert read path (list / view / rule resolution) to the org-scoped /organizations/{org}/detectors/ endpoint. Metric-alert mutations still hit the legacy /organizations/{org}/alert-rules/ endpoint being retired 2026-08-17:

  • createMetricAlertRule → POST /organizations/{org}/alert-rules/
  • putMetricAlertRule (edit) + getMetricAlertRuleDocument (edit baseline fetch) → /organizations/{org}/alert-rules/{id}/
  • deleteMetricAlertRule → DELETE /organizations/{org}/alert-rules/{id}/

(all in src/lib/api/alerts.ts; commands in src/commands/alert/metrics/{create,edit,delete}.ts.)

Why this is deferred from #1275

The CLI create/edit commands build a flat legacy alert-rule body (name, query, aggregate, dataset, timeWindow, triggers, projects, environment, owner). The detectors write API takes a different nested shape (dataSources / dataConditions / config). Migrating mutations means:

  1. Translating the flat CLI input into the nested detector create/update payload (and back for the edit merge baseline).
  2. Repointing delete to DELETE /organizations/{org}/detectors/{id}/.
  3. New/updated tests for each mutation path.

Per #1274 this is also gated on the monitors/workflows write-API feature gaps tracked in #1142. This mirrors the issue-alert precedent (#1215/#1216), which migrated reads first and deferred mutations.

Scope

  • createMetricAlertRule → detectors POST
  • putMetricAlertRule + edit baseline fetch → detectors PUT/GET
  • deleteMetricAlertRule → detectors DELETE
  • Update create/edit/delete command body builders + tests

Refs #1274, #1275, getsentry/toolkit#1482, #1142

Activity

  1. added
    jaredTrigger the Jared agent to work on stuff
    on Aug 2, 2026
  2. self-assigned this
    on Aug 2, 2026
  3. added a commit that references this issue on Aug 2, 2026
    9a9d39e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

jaredTrigger the Jared agent to work on stuff

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions