Observability: Cron enhancements
Mantenedores costumam responder em até 1 dia
@vprashrex já está trabalhando nisso.
Desde 23/10/2026.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 18
- Forks
- 11
- Merge médio
- 2d 2h
- PRs com merge (30d)
- 33
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de ProjectTech4DevAI/kaapi-backend
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
ProjectTech4DevAI/kaapi-backend#889 ·
Mantenedores costumam responder em até 1 dia
-
Storage Management: Delete S3 audio filesTalvez já em andamento @Prajna1999 assumiu hoje. Aberta
ProjectTech4DevAI/kaapi-backend#1308 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Sentry: Add module and version tagsTalvez já em andamento @vprashrex assumiu há 2 dias. Aberta
ProjectTech4DevAI/kaapi-backend#1305 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Otel: Standardize key constantsTalvez já em andamento @vprashrex assumiu há 5 dias. Aberta
ProjectTech4DevAI/kaapi-backend#1294 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Chabot: Server-side chatbot state managementTalvez já em andamento @Ayush8923 assumiu há 6 dias. Aberta
ProjectTech4DevAI/kaapi-backend#1278 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de ProjectTech4DevAI/kaapi-backend
Issues semelhantes
-
link-rot
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 67/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
developmentseed/titiler-cmr#265 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Insecure Brotli version <1.2.1Talvez já em andamento @jamescw19 assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
stac-utils/stac-fastapi-pgstac#438 · 1 reação ·
-
bug triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 1 dia