Expand description
Effect system observability and Cx-aware execution helpers.
This module provides:
- Cx-aware task execution: [
run_task_with_cx] wraps a closure with a [Cx] context for cooperative cancellation and deadline enforcement. - Tracing spans:
effect.commandandeffect.subscriptionspans with structured fields for observability dashboards. - Metrics counters:
effects_executed_total(by type) andeffect_duration_ushistogram approximation.
§bd-37a.6: Command/Subscription effect system with Cx capability threading
Structs§
- Queue
Telemetry - Snapshot of queue telemetry for operator dashboards.
- Runtime
Dynamics - Snapshot of runtime dynamics for operator dashboards and performance analysis.
Functions§
- effects_
command_ total - Total command effects executed (monotonic counter).
- effects_
executed_ total - Combined total of all effects executed.
- effects_
queue_ dropped - Total tasks dropped due to backpressure or shutdown (monotonic counter).
- effects_
queue_ enqueued - Total tasks enqueued to the effect queue (monotonic counter).
- effects_
queue_ high_ water - High-water mark: maximum queue depth observed (ratchet — only increases).
- effects_
queue_ processed - Total tasks processed by the effect queue (monotonic counter).
- effects_
subscription_ total - Total subscription effects started (monotonic counter).
- error_
effect_ panic - Record an effect panic error.
- queue_
telemetry - Snapshot the current queue telemetry counters.
- reconcile_
count - Total reconcile operations (monotonic counter).
- reconcile_
duration_ us_ total - Cumulative reconcile duration in microseconds.
- record_
command_ effect - Record a command effect execution without wrapping (for inline instrumentation).
- record_
dynamics_ reconcile - Record a reconcile operation with its duration.
- record_
dynamics_ shutdown - Record a shutdown completion with its duration and timeout count.
- record_
dynamics_ sub_ panic - Record a subscription panic event.
- record_
dynamics_ sub_ start - Record a subscription start event.
- record_
dynamics_ sub_ stop - Record a subscription stop event.
- record_
queue_ drop - Record a task dropped due to backpressure or shutdown.
- record_
queue_ enqueue - Record a task enqueue, updating counters and high-water mark.
- record_
queue_ processed - Record a task processed by the effect queue.
- record_
subscription_ start - Record a subscription lifecycle event.
- record_
subscription_ stop - Record a subscription stop event.
- runtime_
dynamics - Snapshot the current runtime dynamics counters.
- shutdown_
duration_ us_ last - Most recent shutdown duration in microseconds (0 = no shutdown yet).
- shutdown_
timed_ out_ total - Total subscription join timeouts during shutdown (monotonic counter).
- subscription_
panics_ total - Total subscription panics caught (monotonic counter).
- subscription_
starts_ total - Total subscription starts (monotonic counter).
- subscription_
stops_ total - Total subscription stops (monotonic counter).
- trace_
command_ effect - Execute a command effect with tracing instrumentation.
- warn_
effect_ timeout - Record an effect timeout warning.