Skip to content

fix(workflow-engine): Only count enabled metric detectors toward the limit - #132096

Open
nora-shap wants to merge 2 commits into
masterfrom
nora/ID-1991
Open

nora-shap wants to merge 2 commits into
masterfrom
nora/ID-1991

Conversation

@nora-shap

Copy link
Copy Markdown
Member

The metric detector limit now counts only enabled, active metric_issue detectors, so disabling a detector frees up room under the plan's limit. Previously disabled detectors counted too, so an org at its limit had to delete detectors to make room.

Because disabled detectors no longer count, every path that enables one now checks the limit, otherwise a user could create detectors disabled and enable them past the limit:

  • Enabling a single detector (PUT on detector details) is rejected at the limit with the same message create uses.
  • Bulk enable (PUT on the org detector index) counts the disabled metric detectors in the selection and rejects the whole request if enabling them would go over. Already-enabled detectors aren't counted.
  • Disabling, and editing a detector while the org is over its limit, still work.

Create is unchanged: it's still rejected at the limit, including when the request sends enabled: false, because create doesn't honor enabled and always makes an enabled detector.

The count and the enable check live in src/sentry/incidents/metric_detector_quota.py so every path uses the same rule.

The plan limit still comes from quotas.backend.get_metric_detector_limit, and the organizations:workflow-engine-metric-detector-limit flag gates it as before.

@nora-shap
nora-shap requested a review from a team November 21, 2026 00:25
@nora-shap
nora-shap requested a review from a team as a code owner November 21, 2026 00:25
@linear-code

linear-code Bot commented Nov 21, 2026

Copy link
Copy Markdown

ID-1991

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 21, 2026
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

decision-model-linter

api

src/sentry/workflow_engine/endpoints/organization_detector_index.py

  • warn makesExistingInputStricter = TRUE (0.82): Rejecting input an endpoint accepted before, or changing a field's default, breaks existing callers, and the API spec often doesn't show it. Make the change backward compatible (keep the field optional, accept the old values, or keep the old default), or treat it as a breaking change and coordinate it.

decision-model-linter: 15 calls on 3 files, 35,253 input tokens, $0.0015, model typesafe/jev-1.13-20260917

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant