Skip to content

SLOs And Alerts

Эта страница объясняет operational signals, которые ChokaQ exposes, что они значат и как превращать их в useful alerts. Она написана для двух аудиторий:

  • developers, которым нужно понимать, что делают background jobs;
  • operators, которым нужно решить: scale, investigate, retry или stop.

ChokaQ - background job engine. Его health - не только "process up?". Process может быть alive, пока jobs ждут слишком долго, workers stuck, SQL slow или downstream provider rejects calls. Хороший monitoring начинается с user-visible delay и failure rate.

Terms

TermMeaning
Eligible jobJob, whose scheduled time has arrived and can be fetched by workers.
Queue lagКак долго eligible pending work ждала до execution.
DLQDead Letter Queue: failed, cancelled, zombie или poison work, требующая operator attention.
Worker heartbeatProcess-local signal, что background worker loop alive.
Job heartbeatPer-job signal, что Processing job still alive.
Failure reasonStructured class вроде Fatal, Throttled, Timeout, Zombie или Cancelled.
CircuitPer-job-type breaker, который может block repeated failing execution attempts.

Default objectives

Это starting points, а не universal law. User-facing notification queue и overnight report queue не должны иметь одинаковый objective.

ObjectiveDefault targetWhy it matters
Queue processing latency99% eligible jobs start within 5 secondsБлижайший signal к "users are waiting too long."
DLQ rateLess than 0.1% completed attempts over 5 minutesRising DLQ rate значит, что work уходит из normal path.
Worker livenessAt least one healthy worker loop for active queuesJobs не drain'ятся, если workers stopped или stuck.
SQL storage healthSQL health check remains healthySQL mode зависит от storage для admission, fetch, finalization и dashboard reads.
Queue saturation healthQueue lag stays below unhealthy thresholdSaturated queues могут быть alive, но слишком slow для service expectations.

Для low-priority batch workloads 5-second lag target может быть слишком строгим. Для customer-facing security, payment или notification jobs - слишком мягким. Считайте эти defaults preview baseline и tune per queue.

Primary signals

ChokaQ exposes три слоя signals:

  1. Health checks для yes/no platform decisions.
  2. Metrics для trends и alerting.
  3. The Deck для human triage и recovery.

Health checks

SQL mode registers:

CheckMeaning
chokaq_sqlSQL Server reachable, ChokaQ storage может query expected objects.
chokaq_workerHosted worker loop running и имеет recent heartbeat.
chokaq_queue_saturationPending queue lag ниже configured degraded/unhealthy thresholds.

Используйте health checks для readiness и basic monitoring. Не полагайтесь только на health checks для incident diagnosis; они намеренно summarize detail.

Metrics

Meter ChokaQ exposes:

InstrumentUse it for
chokaq.jobs.enqueuedProducer activity и queue arrival rate.
chokaq.jobs.completedSuccessful throughput.
chokaq.jobs.failedHandler failures before retry or DLQ outcome.
chokaq.jobs.processing_durationSlow handlers и timeout risk.
chokaq.jobs.queue_lagPrimary saturation signal.
chokaq.jobs.dlqFailed work by queue, job type и reason.
chokaq.jobs.retriedRetry pressure и dependency instability.
chokaq.workers.activeActive processing pressure.
chokaq.jobs.heartbeat_failuresSQL/network/host pressure during running jobs.
chokaq.jobs.state_transition_conflictsStale ownership attempts и lease races.
chokaq.idempotency.claimsAccepted, duplicate, completed или rejected idempotency claims.
chokaq.circuits.eventsCircuit open, half-open, close и rejection activity.

Metric labels cardinality-capped через ChokaQ:Metrics. Это защищает monitoring system от unbounded queue names, job type names, error strings или failure reasons. Overflow values grouped into stable bucket вроде other.

The Deck

The Deck - operator console. Используйте его, чтобы ответить:

  • Какие queues lagging?
  • Какие jobs active?
  • Какие failure reasons dominate DLQ?
  • Какие error families repeat?
  • Circuits open?
  • Queue paused или capped?
  • Можно ли failed payload repair и requeue?
  • Что произошло после bulk action?

The Deck SignalR-assisted и периодически reconciles from storage. Он предназначен для operational visibility, а не как единственный source of truth. SQL остается durable state boundary.

Alert matrix

Начните с этих alerts и tune после наблюдения реального workload behavior.

AlertSuggested triggerLikely meaningFirst action
Queue lag highMax queue lag > 10s for 5mWorkers не успевают, queue paused/capped, SQL slow или handlers slow.Откройте The Deck, найдите queue, проверьте worker count и SQL health.
Queue lag high with low failuresLag rising, DLQ rate normalCapacity shortage или slow normal work.Add workers, raise queue MaxWorkers, split queues или reduce producer rate.
Queue lag high with SQL unhealthyLag rising, chokaq_sql unhealthyStorage bottleneck.Inspect SQL connectivity, waits, locks, CPU, disk и command timeouts before adding workers.
DLQ rate highDLQ rate > 1% for 5mWork leaves normal path.Inspect top error families и failure reasons перед requeue.
Fatal DLQ spikechokaq.jobs.dlq{reason="Fatal"} jumpsCode defect, incompatible payload, bad data или unsupported contract.Stop blind retries; fix handler или payload; requeue targeted subset only after repair.
Throttled DLQ spikereason="Throttled" jumpsDownstream rate limit или quota exhaustion.Reduce concurrency, lower queue MaxWorkers, wait for quota recovery, then requeue carefully.
Timeout DLQ spikereason="Timeout" jumpsHandler exceeds execution timeout или dependency latency changed.Check handler duration и dependency latency; raise timeout only if side effects idempotent and long runtime expected.
Worker unhealthyWorker heartbeat staleProcess stopped, host overloaded или worker loop blocked.Check host logs, restart if needed, confirm abandoned Fetched jobs recover.
Heartbeat failureschokaq.jobs.heartbeat_failures increasingSQL writes, network, locks или host resources under pressure.Follow heartbeat pressure runbook; avoid immediate cancellation unless configured intentionally.
State transition conflictsConflicts spikeStale worker tried to finalize work it no longer owns.Check slow handlers, zombie recovery, clock/timeout settings и worker restarts.
Circuit open eventsCircuit open/reject events risingOne job type repeatedly failing.Inspect error family и downstream health перед adding capacity to that job type.

Safe alert response

Когда alert fires, не меняйте все сразу. Используйте порядок:

  1. Определите, проблема в lag, failure, worker liveness или SQL health.
  2. Определите affected queue и job type.
  3. Проверьте, является ли failure reason retry-safe.
  4. Примените минимальный полезный control: scale workers, pause queue, lower queue MaxWorkers, repair payloads или requeue targeted subset.
  5. После изменения смотрите queue lag, DLQ rate, retries и SQL health.

Самая частая unsafe response - blind requeue. Blind requeue может multiply side effects, hammer downstream dependency или hide real payload defect.

Первый полезный dashboard:

PanelGroup byWhy
Queue lag p95/maxqueueShows user-visible waiting time.
Enqueue ratequeue, typeShows producer pressure.
Completed ratequeue, typeShows processing throughput.
DLQ ratequeue, type, reasonShows failed work by class.
Retry ratequeue, typeShows instability before DLQ.
Processing duration p95/maxqueue, typeShows timeout risk and slow handlers.
Active workersqueueShows capacity usage.
Circuit eventstype, stateShows failing job families.
Health check statecheck nameShows platform readiness.

Environment tuning

EnvironmentSuggested posture
Local developmentShort thresholds are fine; goal is fast feedback.
CI/integrationKeep thresholds deterministic enough to avoid flaky timing failures.
User-facing production-previewAlert on lag quickly; users feel delay.
Batch workloadsHigher lag may be acceptable; focus on completion windows and DLQ rate.
Downstream-limited workloadsLower MaxWorkers and alert on throttling before adding workers.
High-volume queuesPrefer queue-specific thresholds and cardinality budgets; avoid alerting on raw depth alone.

What ChokaQ does not decide for you

ChokaQ может сказать, что queue slow, worker stale или failure class spiking. Он не знает business impact. Вы все равно решаете:

  • какие queues user-facing;
  • какие failures safe to retry;
  • какие handlers имеют non-idempotent side effects;
  • какие downstream systems имеют quotas;
  • как долго delayed batch work может wait;
  • когда purge acceptable.

Используйте ChokaQ signals как control plane, а business meaning приложения фиксируйте в alerts и runbooks.

Лицензия Apache 2.0