Skip to content

ref(skills): replace sentry-create-alert with sentry-create-monitor - #323

Open
evanpurkhiser wants to merge 2 commits into
mainfrom
evanpurkhiser/ref-skills-replace-sentry-create-alert-with-sentry-create-monitor
Open

ref(skills): replace sentry-create-alert with sentry-create-monitor#323
evanpurkhiser wants to merge 2 commits into
mainfrom
evanpurkhiser/ref-skills-replace-sentry-create-alert-with-sentry-create-monitor

Conversation

@evanpurkhiser

Copy link
Copy Markdown
Member

sentry-create-alert only covered the response half of Sentry's monitors-and-alerts model. A request like "alert me when p95 latency crosses 800ms" has no answer there — a monitor has to open the issue before an alert can act on it. This replaces it with sentry-create-monitor, covering both stages.

Why it points at the live schema

The old skill froze a copy of the workflow-engine payload schema into itself, and it had already drifted — the condition table was missing event_attribute, latest_release and percent_sessions_*, plus the trigger types real orgs actually use (new_high_priority_issue, seer_activity_trigger).

Sentry serves its API reference as Markdown (docs.sentry.io/api/monitors/<slug>.md), so the skill fetches the endpoint page before building any payload. The alert condition catalog alone is ~20k characters and ships new types without notice; a frozen copy is a liability. The skill carries the procedure and the traps, the reference carries the fields.

Why the reference isn't enough on its own

Verified against getsentry/sentry, several things the reference implies are wrong or incomplete:

The reference suggests Actually
metric_issue is the only creatable monitor type The endpoint accepts any type with a registered detector validator — uptime (uptime_domain_failure), cron (monitor_check_in_failure) and mobile builds (preprod_size_analysis) are all creatable
PUT needs the full payload Detector updates run partial=True; PUT {"enabled": false} is complete. But any array you send is authoritative — "actionFilters": [] deletes every filter and action
config.frequency is one of a list of values {"type": "integer", "minimum": 0}. The list is the UI's presets
Priority 50 is "Low" It's medium. supported_condition_results is {75, 50, 0}25 is rejected outright

The skill also documents four endpoints absent from the reference: /detector-types/, /available-actions/ (the only source for a PagerDuty service targetIdentifier), /test-fire-actions/ for proving a notification route before committing to it, and the legacy-alert-rule ID mappers.

The auth-token trap

OrgAuthTokenAuthentication resolves to AnonymousUser, and organization_detector_index.py guards every method with if not request.user.is_authenticated while organization_workflow_index.py has no such guard. So an organization token creates alerts fine but 401s on listing monitors — which reads as a scope problem and isn't. The skill calls for a user token and spells out that 401 means wrong token type, 403 means missing scope.

Uptime monitors bypass the API

The MCP has create_uptime_monitor / update_uptime_monitor / delete_uptime_monitor, so uptime needs neither a token nor a hand-assembled payload. The skill routes there and only falls back to /detectors/ if the tools are absent.

Also in here

  • references/concepts/monitors.md gains the naming mismatch that makes this API hard to navigate: monitors are detectors in the URL, alerts are workflows, and /organizations/{org}/monitors/ is the legacy Crons API that shouldn't be used. Its coverage and MCP claims are corrected too.
  • sentry-get-started's menu claimed monitors/alerts and OTel weren't built as skills; both now route properly.

Verified with scripts/lint.sh, including built-links against the hydrated tree.

The old skill only covered the response half of Sentry's model, so it had
no answer for "alert me when latency crosses 800ms" -- that needs a
monitor to open the issue before an alert can act on it. It also froze a
copy of the workflow-engine payload schema into the skill, which had
already drifted: the condition table was missing several filter types and
every trigger type real orgs use.

The replacement points at the live API reference instead, which Sentry
serves as Markdown at docs.sentry.io/api/monitors/<slug>.md. The alert
condition catalog alone is ~20k characters and changes without notice, so
a frozen copy is a liability rather than a convenience. The skill now
carries the procedure and the traps; the reference carries the fields.

Both are needed because the reference alone is misleading. It documents
`metric_issue` as though it were the only monitor type, when the endpoint
accepts anything registered with a detector validator -- uptime, cron and
mobile-builds monitors are all creatable. It also implies PUT replaces an
object when detector updates run partial, and lists `frequency`'s UI
presets in a way that reads as an enum when the schema takes any integer.

Uptime monitors skip the API entirely: the MCP has create, update and
delete tools for them, needing neither a token nor a hand-built payload.

Two facts that cost real debugging time are stated up front. An
organization auth token authenticates as an anonymous user, and the
detector endpoints reject anonymous callers while the workflow endpoints
accept them -- so an org token creates alerts fine and 401s on listing
monitors, which looks arbitrary rather than like a bad token. And while
PUT merges at the top level, any array in the body is authoritative, so
sending `actionFilters: []` deletes every filter and action under it.

The monitors/alerts concept doc picks up the naming mismatch that makes
this API hard to navigate -- monitors are `detectors` in the URL, alerts
are `workflows`, and `/monitors/` is the legacy Crons API that shouldn't
be used at all.
@evanpurkhiser
evanpurkhiser requested review from HazAT and dcramer August 5, 2026 19:09

@saponifi3d saponifi3d left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - def moves the ball forward and improves creating alerts, thanks for updating all this!! 🙏 (s/o to the plans and troubleshooting table in the skill.md, i feel like that will be a great way to steer the LLMs too)

| Metric | `metric_issue` | The reference page — `dataSources` (query), `config` (detection type), `conditionGroup` (thresholds) |
| Uptime | `uptime_domain_failure` | **The MCP, not this API** — see Playbook B |
| Cron | `monitor_check_in_failure` | One `dataSources` entry holding the monitor’s `name`/`slug`, `owner`, and cron `config` (schedule, timezone, checkinMargin, maxRuntime, thresholds). The detector `config` is empty |
| Mobile builds | `preprod_size_analysis` | `dataSources` and `config` per its own validator |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a heads up that this detector doesn't use datasources; it's storing everything in the config as well.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants