Skip to content

Commit 72a59ef

Browse files
fix(seer-embeds): Describe alert and monitor embeds in current terms (#127914)
Seer's `alert` and `monitor` embed descriptions used the old "metric / issue / uptime / cron alert" model. When asked to create a Monitor that emails on trigger, Seer tagged the new Alert's workflow ID as `kind: "metric"`, so the card fetched `/detectors/<workflow id>/` and showed "Unable to load alert details." This rewrites both descriptions in current [Monitors and Alerts](https://docs.sentry.io/product/monitors-and-alerts/) terms: a Monitor (detector) decides when data becomes an issue, and an Alert (workflow) acts on those issues. Alerts always use their workflow ID with `kind: "issue"`. The `metric`/`uptime`/`cron` values stay in the enum so saved conversations still render, but they're marked legacy and removed from the examples. Text-only: `schemas.ts` plus the regenerated `embed_widgets.generated.json`; renderers are unchanged. Conversations already saved with the wrong `kind` still show the error, and Seer's evals don't include these embeds yet. <!-- junior-request-attribution:start --> via **matt.duncan**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0C8Z02BG5Q%3A1792193306.342849 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C8Z02BG5Q%3A1792193306.342849) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C8Z02BG5Q%3A1792193306.342849/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Matt Duncan <matt.duncan@sentry.io> Co-authored-by: Matt Duncan <14761+mrduncan@users.noreply.github.com>
1 parent 700fb8b commit 72a59ef

2 files changed

Lines changed: 42 additions & 46 deletions

File tree

‎src/sentry/seer/agent/embed_widgets.generated.json‎

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@
574574
},
575575
{
576576
"name": "alert",
577-
"description": "The ONLY way to reference a Sentry alert. Use `id` exactly as the alerts API returns it, and set `kind` to match: \"metric\" for a metric alert, \"issue\" for an issue alert, \"uptime\" for an uptime alert, \"cron\" for a cron alert. Include the API-provided name when available. Inline: renders a compact link. Block: renders alert conditions and configured actions, plus the underlying rule configuration for metric, uptime, and cron alerts. Do not duplicate those details as text. Never use a markdown link for alert references.",
577+
"description": "The ONLY way to reference a Sentry Alert. Monitors decide when data becomes an issue; an Alert is the rule that runs actions (email, Slack, tickets, webhooks) when issues from its projects or connected Monitors match its triggers and filters. Use the Alert's id from the workflows API (`/workflows/`, get_organization_workflow / list_organization_workflows) with `kind` \"issue\". This holds for every Alert, including one connected to a metric, cron, or uptime Monitor. Reference the Monitor itself with the `monitor` embed, never with this one. Include the API-provided name when available. Inline: renders a compact link. Block: renders the Alert's settings, conditions, and actions. Do not duplicate those details as text. Never use a markdown link for alert references.",
578578
"level": ["inline", "block"],
579579
"body": {
580580
"$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -586,7 +586,8 @@
586586
},
587587
"kind": {
588588
"type": "string",
589-
"enum": ["metric", "issue", "uptime", "cron"]
589+
"enum": ["metric", "issue", "uptime", "cron"],
590+
"description": "Always \"issue\" for an Alert. \"metric\", \"uptime\", and \"cron\" are legacy values that expect a Monitor (detector) id; do not use them."
590591
},
591592
"name": {
592593
"type": "string",
@@ -597,41 +598,26 @@
597598
},
598599
"examples": [
599600
{
600-
"label": "Metric alert",
601-
"data": {
602-
"id": "4521",
603-
"kind": "metric",
604-
"name": "Checkout p95 latency"
605-
}
606-
},
607-
{
608-
"label": "Issue alert",
601+
"label": "Alert",
609602
"data": {
610603
"id": "881",
611-
"kind": "issue"
604+
"kind": "issue",
605+
"name": "New checkout issues to #checkout"
612606
}
613607
},
614608
{
615-
"label": "Uptime alert",
609+
"label": "Alert connected to a metric Monitor",
616610
"data": {
617-
"id": "774",
618-
"kind": "uptime",
619-
"name": "Checkout availability"
620-
}
621-
},
622-
{
623-
"label": "Cron alert",
624-
"data": {
625-
"id": "9931",
626-
"kind": "cron",
627-
"name": "nightly-sync"
611+
"id": "6120",
612+
"kind": "issue",
613+
"name": "High error rate email"
628614
}
629615
}
630616
]
631617
},
632618
{
633619
"name": "monitor",
634-
"description": "The ONLY way to reference a Sentry monitor (error, metric, cron, uptime, or mobile build detector). Use the numeric id from the detectors API (get_organization_detector / list_organization_detectors) — do NOT use the \"id\" field from the monitors API, which is a GUID and will not work here. Include the API-provided name when available. Inline: renders a compact link. Block: loads the live monitor and renders its type-specific configuration/rules. Never use a markdown link for monitor references.",
620+
"description": "The ONLY way to reference a Sentry Monitor. A Monitor decides when data becomes an issue: a metric, cron, uptime, or mobile builds Monitor, or a project's default Error or Issue Stream Monitor. Use the numeric id from the detectors API (`/detectors/`, get_organization_detector / list_organization_detectors). Do NOT use the GUID `id` from the Crons API (`/monitors/`, list_organization_monitors); look up the cron Monitor in the detectors API instead. To reference an Alert that acts on issues from a Monitor, use the `alert` embed. Include the API-provided name when available. Inline: renders a compact link. Block: loads the live Monitor and renders its type-specific configuration. Never use a markdown link for monitor references.",
635621
"level": ["inline", "block"],
636622
"body": {
637623
"$schema": "https://json-schema.org/draft/2020-12/schema",

‎static/app/components/seer/markdown/embeds/schemas.ts‎

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -441,47 +441,57 @@ export const SEER_EMBED_SCHEMAS = {
441441
},
442442
alert: {
443443
description:
444-
'The ONLY way to reference a Sentry alert. ' +
445-
'Use `id` exactly as the alerts API returns it, and set `kind` to match: ' +
446-
'"metric" for a metric alert, "issue" for an issue alert, "uptime" for an ' +
447-
'uptime alert, "cron" for a cron alert. ' +
444+
'The ONLY way to reference a Sentry Alert. ' +
445+
'Monitors decide when data becomes an issue; an Alert is the rule that runs ' +
446+
'actions (email, Slack, tickets, webhooks) when issues from its projects or ' +
447+
'connected Monitors match its triggers and filters. ' +
448+
"Use the Alert's id from the workflows API (`/workflows/`, " +
449+
'get_organization_workflow / list_organization_workflows) with `kind` ' +
450+
'"issue". This holds for every Alert, including one connected to a metric, ' +
451+
'cron, or uptime Monitor. ' +
452+
'Reference the Monitor itself with the `monitor` embed, never with this one. ' +
448453
'Include the API-provided name when available. ' +
449454
'Inline: renders a compact link. ' +
450-
'Block: renders alert conditions and configured actions, plus the ' +
451-
'underlying rule configuration for metric, uptime, and cron alerts. ' +
455+
"Block: renders the Alert's settings, conditions, and actions. " +
452456
'Do not duplicate those details as text. ' +
453457
'Never use a markdown link for alert references.',
454458
level: ['inline', 'block'],
455459
schema: z.object({
456460
id: z.string().min(1),
457-
kind: z.enum(['metric', 'issue', 'uptime', 'cron']),
461+
kind: z
462+
.enum(['metric', 'issue', 'uptime', 'cron'])
463+
.describe(
464+
'Always "issue" for an Alert. "metric", "uptime", and "cron" are legacy ' +
465+
'values that expect a Monitor (detector) id; do not use them.'
466+
),
458467
name: z.string().min(1).optional(),
459468
}),
460469
examples: [
461470
{
462-
label: 'Metric alert',
463-
data: {id: '4521', kind: 'metric', name: 'Checkout p95 latency'},
464-
},
465-
{label: 'Issue alert', data: {id: '881', kind: 'issue'}},
466-
{
467-
label: 'Uptime alert',
468-
data: {id: '774', kind: 'uptime', name: 'Checkout availability'},
471+
label: 'Alert',
472+
data: {id: '881', kind: 'issue', name: 'New checkout issues to #checkout'},
469473
},
470474
{
471-
label: 'Cron alert',
472-
data: {id: '9931', kind: 'cron', name: 'nightly-sync'},
475+
label: 'Alert connected to a metric Monitor',
476+
data: {id: '6120', kind: 'issue', name: 'High error rate email'},
473477
},
474478
],
475479
},
476480
monitor: {
477481
description:
478-
'The ONLY way to reference a Sentry monitor (error, metric, cron, uptime, ' +
479-
'or mobile build detector). Use the numeric id from the detectors API ' +
480-
'(get_organization_detector / list_organization_detectors) — do NOT use the ' +
481-
'"id" field from the monitors API, which is a GUID and will not work here. ' +
482+
'The ONLY way to reference a Sentry Monitor. ' +
483+
'A Monitor decides when data becomes an issue: a metric, cron, uptime, or ' +
484+
"mobile builds Monitor, or a project's default Error or Issue Stream Monitor. " +
485+
'Use the numeric id from the detectors API (`/detectors/`, ' +
486+
'get_organization_detector / list_organization_detectors). ' +
487+
'Do NOT use the GUID `id` from the Crons API (`/monitors/`, ' +
488+
'list_organization_monitors); look up the cron Monitor in the detectors API ' +
489+
'instead. ' +
490+
'To reference an Alert that acts on issues from a Monitor, use the `alert` ' +
491+
'embed. ' +
482492
'Include the API-provided name when available. ' +
483493
'Inline: renders a compact link. ' +
484-
'Block: loads the live monitor and renders its type-specific configuration/rules. ' +
494+
'Block: loads the live Monitor and renders its type-specific configuration. ' +
485495
'Never use a markdown link for monitor references.',
486496
level: ['inline', 'block'],
487497
schema: z.object({

0 commit comments

Comments
 (0)