Observability: Cron enhancements
I maintainer di solito rispondono entro 1 giorno
@vprashrex ci sta già lavorando.
Dal 23/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Is your feature request related to a problem?
The current design excludes /cron/* endpoints from tracing, making it difficult to track what a cron run processes since Celery tasks appear as separate root traces. Additionally, failing runs incorrectly report as successful due to the handling of exceptions in process_all_pending_evaluations.
Describe the solution you'd like
- Trace only when there's actual work, opening spans after polling for pending runs while keeping
/cronexcluded. - Implement error monitoring for runs that end with
status: errorto correctly report failures in Sentry. - Include span attributes like pending run count and processing status for clarity.
- Ensure consistent timezone settings across monitor configurations.
- Create tests to validate span existence with pending runs and error reporting for failed runs.
Original issue
Problem
/cron/* endpoints are excluded from tracing on purpose, so an idle cron run doesn't create a trace every minute. The downside is that Celery tasks the cron enqueues (send_eval_completion_notification, fast-eval barriers, iteration resumes) have no parent span and each one shows up as its own root trace. You can't see in one place what a cron run actually processed.
There's a second gap: process_all_pending_evaluations catches every exception and returns {"status": "error"}, so the @sentry_sdk.monitor check-in still reports OK when the run failed.
What we'll do
- Trace only when there's real work. Keep
/cronexcluded. Open a span (evaluation.cron.poll,evaluation.cron.poll_stt/poll_tts, plus fast-barrier and iteration-resume dispatch) only after a poll finds pending runs. Tasks enqueued inside nest under it; idle runs produce no trace.crud/evaluations/processing.py→poll_all_pending_evaluationscrud/evaluations/cron_utils.py→poll_all_pending_evaluations_by_typecrud/evaluations/cron.py→ fast-eval barrier and iteration-resume dispatch
- Report real failures to the cron monitor. When a run ends with
status: error, send an error check-in (re-raise, orcapture_checkin(..., status=MonitorStatus.ERROR)), so Sentry marks the run failed instead of OK. - Span attributes worth having: pending run count, processed / failed / still-processing counts, so a cron trace explains itself.
- Consistent timezone across monitor configs (evaluations uses
UTC, the othersAsia/Kolkata). - Tests: span exists only when there are pending runs; failed run sends an error check-in.
What Sentry Crons gives us (besides uptime)
@monitor/with monitor(...)withmonitor_configto create or update the monitor from code (already used inapi/routes/cron.py).monitor_config:schedule(crontab or interval),checkin_margin,max_runtime,failure_issue_threshold,recovery_threshold,timezone.- Check-in statuses
in_progress/ok/error, plus manualcapture_checkin(monitor_slug, check_in_id, status)for jobs that can't use the decorator. - Missed, failed and timed-out runs become Issues, with per-monitor alerting.
- Monitor environments: check-ins are tracked per environment (production / staging).
CeleryIntegration(monitor_beat_tasks=True, exclude_beat_tasks=[...])auto-monitors Celery Beat tasks. Not used today because our crons are HTTP-triggered, but an option if they move to Beat.
Out of scope
Uptime monitors, and moving crons to Celery Beat.
- Lingua principale
- Python
- Stelle
- 18
- Fork
- 11
- Merge medio
- 2g 2h
- PR unite (30g)
- 33
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ProjectTech4DevAI/kaapi-backend
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ProjectTech4DevAI/kaapi-backend#889 ·
I maintainer di solito rispondono entro 1 giorno
-
Sentry: Add module and version tagsForse già presa @vprashrex l’ha presa 1 giorno fa. Aperta
ProjectTech4DevAI/kaapi-backend#1305 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Otel: Standardize key constantsForse già presa @vprashrex l’ha presa 5 giorni fa. Aperta
ProjectTech4DevAI/kaapi-backend#1294 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Chabot: Server-side chatbot state managementForse già presa @Ayush8923 l’ha presa 5 giorni fa. Aperta
ProjectTech4DevAI/kaapi-backend#1278 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Monitoring: Enhance alerting and securityForse già presa @Ayush8923 l’ha presa 8 giorni fa. Apertainfrastructure
ProjectTech4DevAI/kaapi-backend#1271 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ProjectTech4DevAI/kaapi-backend
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
GoogleCloudPlatform/gce-rescue#195 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
intake mcp-intake needs-ac needs-human-review priority:medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
Ikalus1988/MisakaNet#3848 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
521xueweihan/HelloGitHub#4105 ·
-
bug size:XS
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno