Skip to content

Monitoring & Alerting

OsuRender API exports comprehensive Prometheus metrics and ships with pre-configured alert rules.

Metrics Inventory

Queue Metrics

MetricTypeLabelsDescription
queue_depthGaugestatusCurrent jobs in each state (queued, rendering, downloading)
outbox_pending_eventsGaugePending events awaiting dispatch
outbox_dispatched_eventsGaugeEvents dispatched, awaiting worker confirmation
outbox_failed_eventsGaugeFailed events (Dead Letter Queue)

Render Metrics

MetricTypeLabelsDescription
render_duration_secondsHistogramEnd-to-end render time. Buckets: 30s, 60s, 120s, 180s, 300s, 600s
render_failures_totalCounterreasonFailures by phase (init, download, osu_api, render)
active_render_workersGaugeCurrently active workers
jobs_completed_totalCounterSuccessfully completed jobs
jobs_failed_totalCounterFailed jobs
zombie_jobs_reaped_totalCounterJobs recovered by zombie reaper

Dispatch Metrics

MetricTypeLabelsDescription
outbox_dispatch_totalCounterEvents dispatched to Celery
dispatch_latency_secondsHistogramTime from event creation to dispatch
listener_reconnects_totalCounterreasonDispatcher reconnections
stuck_processing_events_totalCounterEvents rescued by sweeper

API Metrics

MetricTypeLabelsDescription
job_submit_totalCounterJobs accepted by the API
webhook_failures_totalCounterreasonWebhook auth failures
rate_limit_violations_totalCounterRate limit hits
upload_validation_failures_totalCountertypeUpload validation failures

Storage Metrics

MetricTypeLabelsDescription
storage_operation_duration_secondsHistogramoperationStorage operation latency
storage_failures_totalCounteroperationStorage operation failures

HTTP Metrics (auto-instrumented)

The prometheus-fastapi-instrumentator automatically exports standard HTTP metrics:

  • http_requests_total
  • http_request_duration_seconds
  • http_request_size_bytes
  • http_response_size_bytes

Alert Rules

Alerts are defined in monitoring/alerts.yml:

Critical Alerts

AlertConditionDuration
QueueDepthCriticalQueued jobs > 902 min
NoActiveWorkersNo workers + queue > 05 min
SLOApiAvailabilityBreachAPI availability < 99.9%15 min

Warning Alerts

AlertConditionDuration
QueueDepthHighQueued jobs > 505 min
OutboxPendingHighPending events > 105 min
HighRenderFailureRateFailures > 0.5/sec5 min
RenderDurationHighP95 > 300s10 min
HighErrorRate5xx rate > 5%5 min
HighLatencyP95 latency > 5s5 min
StorageFailuresAny storage failures5 min
DeadLetterQueueGrowingFailed events > 015 min

Accessing Metrics

bash
# Raw Prometheus endpoint
curl http://localhost:8727/metrics

# Prometheus UI
open http://localhost:9090

# Grafana dashboards
open http://localhost:3727  # Default: admin/admin

SLO Recording Rules

yaml
# API availability (target: 99.9%)
osurender:api_availability:ratio_5m

# Render success rate
osurender:render_success_rate:ratio_5m

Live Dashboard

Since browser security policies prevent embedding the live dashboard directly in the documentation, you can view the real-time production metrics by opening the public dashboard directly:

Open Live Grafana Dashboard ↗

Built with VitePress