9.8 KiB
Runbooks
This document captures the operational readiness artifact for plan item Runbooks.
Scope:
- API and worker incidents for
video-clipping-service - Database-backed queue behavior
- Current dashboard and alert coverage
- Cleanup and retention job behavior
Primary references:
- Dashboard:
dashboards/video-clipping-overview-grafana.json - Dashboard notes:
docs/dashboards.md - Alert rules:
docs/alerts.md - Autoscaling policy:
docs/autoscaling-policies.md - Queue timeout tuning:
docs/queue-visibility-timeout-tuning.md
Service Model
Current implementation assumptions:
- Metrics are exposed at
/actuator/prometheus. - Health endpoints are exposed through Spring Boot Actuator.
- Queue mode may be
memoryordb, but operational queue metrics and retry behavior documented here assumevideo-clipping.queue=db. - Database-backed queue messages move through
PENDING,PROCESSING,COMPLETED, orDLQ. - Worker retries are driven by:
video-clipping.database-queue.max-attemptsvideo-clipping.database-queue.retry-backoff-msvideo-clipping.database-queue.visibility-timeout-ms
- Cleanup jobs are driven by:
video-clipping.cleanup.enabledvideo-clipping.cleanup.local-artifact-poll-interval-msvideo-clipping.cleanup.retention-poll-interval-ms
Quick Triage
When an alert fires:
- Identify whether the impact is API availability, worker throughput, or data cleanup.
- Check the Grafana dashboard for:
- pending queue depth
- oldest pending age
- DLQ count
- API request rate
- API p95 latency
- CPU usage
- heap usage
- Check
/actuator/healthfor general service status. - Correlate logs using
jobId,assetId,tenantId, andtraceIdif available. - Determine whether the issue is isolated to one pod or systemic across API and worker replicas.
Runbook: Queue Age High
Signals:
VideoClippingQueueOldestPendingHighVideoClippingQueueOldestPendingCritical- Dashboard shows elevated
Oldest Pending Ageand risingPending Queue Depth
Likely causes:
- Worker capacity is too low for current workload.
- Workers are crash-looping or not polling.
- Source staging, FFmpeg, or clip upload is slow.
- Database queue messages are stuck until visibility timeout reclaim.
What the code does:
- The database queue poller claims
PENDINGmessages and marks themPROCESSING. - Expired
PROCESSINGmessages are reclaimed aftervideo-clipping.database-queue.visibility-timeout-ms. - Retry scheduling uses
video-clipping.database-queue.retry-backoff-ms.
Immediate actions:
- Confirm queue mode is
db. This runbook does not apply as written tomemorymode. - Check worker replica health and restart status.
- Check whether CPU is saturated on workers.
- Check whether pending depth is growing faster than processing count.
- Check recent deploys, node pressure, object storage reachability, and FFmpeg availability.
Mitigation:
- Scale worker replicas up within the bounds in
docs/autoscaling-policies.md. - If workers are healthy but backlog remains, inspect whether
EXACTjobs or slower object storage throughput are dominating runtime. - If many jobs appear stuck in
PROCESSING, compare observed runtime tovideo-clipping.database-queue.visibility-timeout-ms. - If the timeout is too small for production runtime, raise it before increasing concurrency aggressively.
Exit criteria:
video_clipping_queue_oldest_pending_age_secondstrends down- pending depth stabilizes or shrinks
- no new DLQ growth caused by the mitigation
Runbook: DLQ Messages Present
Signals:
VideoClippingDlqPresent- Dashboard
DLQ Messagesstat is nonzero
What the code does:
- A failed message is retried until
video-clipping.database-queue.max-attempts. - On final failure, the queue message is marked
DLQ. - The clip job is marked
FAILED. - Job events include
DLQandFAILED.
Likely causes:
- FFmpeg processing failure
- invalid or corrupt source media
- object storage materialization or upload failure
- persistent code regression affecting all retries
Immediate actions:
- Determine whether DLQ growth is isolated or systemic.
- Inspect failed job records and recent job events for representative
jobIdvalues. - Check whether failures began after a deploy or configuration change.
- Verify object storage, database, and worker runtime dependencies.
Mitigation:
- If the issue is a bad deployment, roll back or stop worker rollout.
- If the issue is data-specific, isolate affected tenants or assets and avoid mass redrive.
- If the issue is dependency-related, restore storage, FFmpeg, or database health first.
- Redrive only after the root cause is fixed.
Redrive guidance:
- There is no dedicated automated redrive artifact yet in the repo.
- Redrive must preserve idempotency and avoid replaying into an unresolved failure condition.
- Use representative sample jobs first before bulk replay.
Exit criteria:
- DLQ count stops increasing
- new jobs succeed normally
- redriven sample jobs no longer fail for the same reason
Runbook: API 5xx Rate High
Signals:
VideoClippingApi5xxRateHighVideoClippingDownloadUrl5xxRateHigh- Rising API p95 latency or reduced request success rate
Likely causes:
- storage signing or retrieval issues
- unexpected server exception
- dependency degradation
- hot path regression after deploy
Immediate actions:
- Check whether all endpoints are failing or only a specific route such as
/v1/clips/{clipId}/download-url. - Review recent application logs for exception bursts.
- Check
/actuator/health. - Compare API symptoms with worker and queue signals to decide whether the issue is upstream, downstream, or local to the API.
Mitigation:
- If failures are isolated to
download-url, verify storage adapter health and signing configuration. - If failures affect create/upload/job endpoints broadly, verify repository and queue dependency health.
- If failures correlate to a new release, roll back the API deployment.
- If latency is high before 5xx increases, consider scaling API replicas while root cause analysis continues.
Exit criteria:
- 5xx ratio returns below alert threshold
- p95 latency returns to expected baseline
- no recurring exception burst in logs
Runbook: Instance Down
Signals:
VideoClippingInstanceDown- missing target in Prometheus
- Kubernetes readiness or liveness failures
Immediate actions:
- Determine whether the issue affects API pods, worker pods, or both.
- Check pod phase, restart count, and last termination reason.
- Check readiness and liveness probe failures.
- Verify whether the issue is caused by node loss, crash loop, bad config, or scrape misconfiguration.
Mitigation:
- If the service is crash-looping after deploy, roll back.
- If only one target is affected, replace the pod and monitor the rest of the replica set.
- If Prometheus scraping changed but the app is healthy, fix scrape config and keep incident scope narrow.
Exit criteria:
- target is consistently scraped again
- pod restarts stop increasing
- related queue or API alerts clear
Runbook: Process CPU High
Signals:
VideoClippingProcessCpuHigh- dashboard CPU panel shows sustained
process_cpu_usage
Likely causes:
- worker saturation due to
EXACTjobs - insufficient worker replica count
- node oversubscription
- runaway request or processing loop
Immediate actions:
- Determine whether high CPU is on API or worker pods.
- Compare CPU saturation with queue age and pending depth.
- Check whether workload mix changed toward more CPU-intensive jobs.
Mitigation:
- If workers are saturated and queue backlog is growing, scale workers first.
- If API pods are saturated, scale API pods and inspect hot endpoints.
- If a specific deployment introduced the condition, roll back.
- If the node is pressured, rebalance or move workloads.
Exit criteria:
- CPU drops below sustained threshold
- queue age and latency normalize
Runbook: Cleanup Or Retention Not Keeping Up
Signals:
- local disk usage continues to grow
- old generated artifacts remain under
tmp/ - expired clips or source objects are not being removed on schedule
What the code does:
LocalArtifactCleanupJobremoves expired files under:- configured FFmpeg input directory
- configured FFmpeg output directory
tmp/in-memory-storagetmp/stub-output
RetentionCleanupJobdeletes expired clips and expired source objects, then marks assets deleted.
Immediate actions:
- Verify
video-clipping.cleanup.enabled=true. - Confirm poll intervals and retention hours are set as expected.
- Check whether the service instance that owns scheduled jobs is running.
- Verify object storage delete operations are succeeding.
Mitigation:
- If cleanup was disabled accidentally, re-enable it and monitor deletion progress.
- If local artifacts are too large for current retention windows, temporarily scale down worker throughput or increase local storage while cleanup catches up.
- If object deletion is failing, fix storage access first before manually deleting metadata.
Exit criteria:
- local artifact growth stops
- expired assets and clips are removed on schedule
Escalation Rules
Escalate immediately if:
- DLQ count is growing and new jobs continue to fail after rollback
- queue age stays above critical threshold after scaling workers
- API 5xx affects upload completion, job creation, or clip download across tenants
- cleanup lag risks disk exhaustion or unbounded storage growth
Known Gaps
- No dedicated first-class metric exists yet for clip-job failure rate.
- No dedicated FFmpeg exit-code metrics exist yet.
- No dedicated object storage failure counter exists yet.
- No dedicated runbook automation exists yet for DLQ redrive.
These gaps are consistent with docs/alerts.md and should be closed before treating the operational surface as fully production-complete.