alert metrics CLI doesn't support detector/workflow log alerts and list/view are inconsistent
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- typescript
- Área
- api, backend-api-design, cli
Línea de trabajo
Comienza por los puntos de entrada de creación, listado y visualización de sentry alert metrics y compara sus solicitudes legacy a /alert-rules/ con los endpoints de detector y workflow descritos en el issue. Reproduce los casos de creación y de listado/visualización de Logs/EAP, define después el modelo compatible y verifica que el texto de ayuda, la creación, el listado y la visualización sean coherentes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
sentry alert metrics currently leads users/agents into legacy metric alert-rule behavior and does not support the new detector/workflow model required for log/EAP alerts.
In a Next.js project (demo/ai-engineer-conf) I tried to create log-based operational alerts for structured logs (trace_item_log). The CLI exposed sentry alert metrics create/list/view, but the behavior was confusing and partially broken for this use case.
Repro / observed behavior
1. create rejects logs as a dataset
sentry alert metrics create demo \
--name 'AI chat failures' \
--project ai-engineer-conf \
--dataset logs \
--query 'action:ai.chat (result:error OR result:stream_error)' \
--aggregate 'count()' \
--time-window 5 \
--trigger '{"alertThreshold":1,"resolveThreshold":0,"label":"critical","actions":[{"id":"sentry.mail.actions.NotifyEmailAction","targetType":"Team","targetIdentifier":"2279506"}]}'
Returns:
Error: dataset must be one of: errors, transactions, sessions, events, spans, metrics.
However, log alerts are supported via the new monitors/alerts API using:
{
"dataset": "events_analytics_platform",
"eventTypes": ["trace_item_log"]
}
2. create trigger shape differs from API shape
The CLI help examples use legacy action ids like:
{"id":"sentry.mail.actions.NotifyEmailAction","targetType":"Team","targetIdentifier":1}
When posting directly to /api/0/organizations/{org}/alert-rules/, the API expects metric alert trigger actions shaped like:
{"type":"email","targetType":"team","targetIdentifier":"2279506"}
3. list does not list log/EAP alert rules that view can view
After creating a legacy EAP/log alert rule via direct API:
sentry alert metrics view demo/441020 --json
worked and returned the alert rule, including:
{
"id": "441020",
"dataset": "events_analytics_platform",
"eventTypes": ["trace_item_log"]
}
But:
sentry alert metrics list demo/ --json --fresh
returned:
{"data":[],"hasMore":false,"hasPrev":false}
Direct API listing did return it:
sentry api '/api/0/organizations/demo/alert-rules/?project=4511626979573760'
4. The command appears to use legacy /alert-rules/, but we should be using detector/workflow
For the actual fix, I had to use the new model directly:
POST /api/0/organizations/demo/projects/ai-engineer-conf/detectors/POST /api/0/organizations/demo/workflows/
Detector data source example that worked:
{
"name": "AI chat failures",
"type": "metric_issue",
"dataSources": [
{
"aggregate": "count()",
"dataset": "events_analytics_platform",
"environment": null,
"eventTypes": ["trace_item_log"],
"query": "action:ai.chat (result:error OR result:stream_error)",
"queryType": 1,
"timeWindow": 300,
"extrapolationMode": "unknown"
}
],
"config": {"detectionType": "static"},
"conditionGroup": {
"logicType": "any",
"conditions": [
{"type": "gt", "comparison": 0, "conditionResult": 75},
{"type": "lte", "comparison": 0, "conditionResult": 0}
],
"actions": []
}
}
Workflow connection example that worked:
{
"name": "AI Engineer operational alerts",
"detectorIds": [7659187],
"triggers": {
"logicType": "any-short",
"conditions": [
{"type": "first_seen_event", "comparison": true, "conditionResult": true},
{"type": "reappeared_event", "comparison": true, "conditionResult": true},
{"type": "regression_event", "comparison": true, "conditionResult": true}
]
},
"actionFilters": [
{
"logicType": "all",
"conditions": [
{"type": "issue_priority_greater_or_equal", "comparison": 75, "conditionResult": true}
],
"actions": [
{
"type": "email",
"integrationId": null,
"data": {},
"config": {
"targetType": "team",
"targetDisplay": null,
"targetIdentifier": "2279506"
},
"status": "active"
}
]
}
]
}
Expected behavior
Either:
sentry alert metricsshould support the new detector/workflow-backed alert model for log/EAP alerts, includinglogsorevents_analytics_platform + trace_item_log, and list/view should be consistent.
or
- The command should clearly state that it manages legacy alert rules only, and the CLI should expose separate commands for new monitors/detectors/workflows.
Environment
sentry --version
# 0.39.0-dev.1782404180
- Lenguaje dominante
- TypeScript
- Estrellas
- 121
- Forks
- 14
- Merge medio
- 23 h 54 min
- PR fusionados (30 d)
- 103
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/cli
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
-
bug jared
-
jared
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
Todos los issues de getsentry/cli
Issues similares
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Crush Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
ElementsProject/cln-application#167 · 1 comentario · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Quantco/pnpm-licenses#17 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100