Product knowledge · Advanced · Monitoring

Observe the runtime without turning the request path into a logging callback.

Health and fresh liveness are direct observations. Optional Monitor collection adds bounded aggregates/events; an exporter copies facts out through an application-owned queue and deadline.

01 · Choose the observation

Four questions use four different surfaces

QuestionCorrect surfaceDo not infer
Which lifecycle state is the service in, and does it still admit requests?Direct health snapshotReady does not prove the event loop made fresh progress.
Did the runtime acknowledge a fresh probe within its deadline?Bounded fresh-liveness probeA passing probe does not prove a dependency or business handler is healthy.
Which configuration/capability did Core accept?Runtime information + effective configurationBuilder input is not an observed fact.
How are traffic/exchange/control/latency evolving?Optional bounded MonitorDisabling Monitor does not remove direct health; waiting never enables collection.

02 · Ownership model

Core issues facts; the application chooses where to export them

CoAkka HTTP Runtime

Owns health/progress, effective monitor policy, aggregates, the bounded event ring, cursor/loss accounting and wait/interrupt lifecycle.

Connector

Projects typed values, preserves exact integer/enum identity, copies host values with correct lifetime and never invents defaults or categories.

Application

Chooses signals/cadence, maps metrics/alerts and owns exporter queue, batching, network I/O, credentials, retry and shutdown order.

Deployment

Owns health endpoint exposure, scrape/service discovery, alert routing, retention, access control and replica-level interpretation.

03 · Direct health

Health is a coherent local snapshot, not one boolean

Lifecycle
CREATED, RUNNING, DRAINING or STOPPED; read it with readiness/admission instead of inferring from a process or socket.
Snapshot sequence + observed monotonic time
Identity and time of the observation; monotonic time is not a wall-clock timestamp.
Progress sequence + monotonic time
Core-issued progress evidence. An old value is not fresh-liveness proof.
Acknowledged probe sequence + time
Which probe the runtime acknowledged; a bounded probe asks for fresh progress within a deadline.
Route/metadata generation + binding-change sequence
Effective control-plane identity being observed; never increment it locally or replace it with a source version.
Ready + admission open
Separate facts: a service may remain operational while admission is closed during drain.
Activity
Active/pending requests, connections, WebSocket sessions and outbound pending at the snapshot; gauges do not transfer ownership.

While live-control observation is unresolved, health/liveness/route snapshots can return CONTROL_UNRESOLVED without changing output. Never label the last confirmed cut as current.

Run the drain lab with a request in flight

04 · Fresh liveness

“The process still exists” is not enough

health snapshot       = non-blocking state observed now
fresh liveness probe = ask the runtime progress lane to acknowledge within timeout

probe timeout ≠ business request timeout
probe pass    ≠ downstream dependency health
probe failure = preserve structured evidence; never fabricate ready=true

Use a finite timeout appropriate to the scheduler/host. A liveness endpoint must not run unbounded work, call every dependency or reuse cached success as fresh proof.

05 · Collection policy

Reserve the maximum shape before start; live policy can only use that reservation

FieldMeaning in SDK 2.3.0
CollectionDISABLED, AGGREGATES or AGGREGATES_AND_EVENTS. The default is disabled.
NotificationPOLL or SIGNAL; signal is valid only when reserved at startup.
LatencyNONE or fixed pre-reserved buckets; arbitrary histograms are not created mid-runtime.
Active event capacityThe portion used in the reserved ring; live apply cannot exceed reserved event capacity.
Aggregate/event categoriesSDK 2.3.0 accepts LIFECYCLE, EXCHANGE, CONTROL, LATENCY bitmasks. Core's supported mask is authoritative.
Max events per readStartup bound for each page; callers still choose a finite maximum and supply enough capacity.

Policy apply uses an expected configuration generation. Invalid enum/category relationship, unsupported category, reservation exceeded, signal not reserved, generation conflict, invalid lifecycle, sequence exhaustion or internal failure preserves the complete previous policy.

06 · Identity map

Policy generation and collection epoch are not the same number

Configuration generation

Compare-and-apply identity for effective policy. If two controllers read one generation, only the first valid operation can advance it.

Collection epoch

Context/interval for interpreting counters and resets. An epoch change splits a time series; it never substitutes for expected generation on apply.

Change sequence

Monotonic observation identity for policy/collection changes in the instance; not wall clock.

Event sequence

Cursor identity for the retained event stream; gaps/overwrite must be reported rather than hidden behind timestamps.

Export generation, epoch and sequence with the values. Never merge samples from two epochs into one continuous interval.

07 · Aggregate snapshot

One snapshot carries counters, quality flags and accepted configuration

GroupFields to understand
Qualitycollecting, stale, partial, snapshot/change sequence and observed monotonic time. Never export stale/partial as a complete fresh sample.
Traffic/exchangeAdmitted requests/bytes; completed, failed, timed out, disconnected, cancelled; response status-family counters.
Event channelRetained, overwritten and dropped events; signal notifications, coalesced signals and signal failures.
Failure/latencyBounded stable failure rows and reserved fixed latency buckets; preserve the numeric identity of an unknown reason.
Effective contextComplete monitor config + direct health embedded in the snapshot so the sample retains generation/epoch/lifecycle context.

Traffic/response/failure/signal are snapshot fields, not separate policy categories in SDK 2.3.0. The snapshot does not report live connector queue depth. Export that metric separately if the connector exposes it.

08 · Event cursor

Notification is a doorbell; the bounded page is the data

wait(finite timeout)
  → read(after_sequence, finite maximum, finite output capacity)
  → process retained events in sequence
  → record oldest / latest / remaining / overwritten
  → advance cursor only from returned facts
FactReading law
EventPreserve kind, sequence/change sequence, config generation, collection epoch, monotonic time, category, stable failure reason and exchange identity.
Oldest/latestDefine the retained window; never infer continuity merely because latest increased.
OverwrittenReport the history gap, mark the interval incomplete and resync with a snapshot; never recreate missing events.
RemainingShows another page remains in the retained ring; continue bounded reads rather than growing a page without limit.
Queue-shaped fieldsUse them only when the exact producer/capability confirms them; field presence does not prove every category emits queue depth.

09 · Wait and shutdown

One runtime has exactly one blocking monitor waiter

1

Assign one owner

One thread/task calls bounded wait; independent snapshot readers do not own the wait lane.

2

Wake, then read

Notifications can coalesce. Always read a snapshot/page after wake; never count wakeups as event count.

3

Stop admission and observe drain

Keep monitoring alive when it must observe accepted work during the finite drain interval.

4

Interrupt, join, close

The lifecycle owner signals stop, interrupts the waiter from another thread, joins with a bound, then closes the runtime.

A wait timeout only means no wake occurred in that window. Signal failure or monitor pressure must not block HTTP traffic or change an exchange terminal.

10 · Data boundary

Monitor is operational evidence, not traffic capture

11 · Application exporter

Copy facts out of the runtime, then export through a finite pipeline

CoAkka HTTP Runtime snapshot/page
  → copy bounded typed values
  → finite application queue
  → batch + finite network deadline
  → Prometheus / OpenTelemetry / logs / local dashboard

queue full / backend down → count exporter drop; never block HTTP work

The application owns metric names, labels/cardinality, backend TLS/auth, batching, retry/backoff, total budget and shutdown. The runtime does not retry the exporter, hold credentials or convert exporter failure into request failure.

12 · Failure law

Each failure needs the correct owner and recovery

Observed factNext safe action
Health/liveness observation unresolvedKeep output unknown and recover the exact control operation; never declare current/ready locally.
Policy generation conflictRead new effective config, merge/reconsider intent and apply against the current generation.
Unsupported/reservation refusalKeep old policy; select a supported subset or replace the service with a new reservation.
Stale/partial snapshotCarry the quality flag and never use it as a complete fresh interval; read again at bounded cadence.
Overwritten/dropped eventRecord the gap, resync the aggregate snapshot and repair reader/exporter capacity; never claim event completeness.
Wait interrupted/timeoutSeparate lifecycle interrupt from an empty wait; neither is a request/runtime terminal.
Exporter queue/backend failureDrop/buffer by finite policy, surface it separately and protect the HTTP path.

13 · Evidence record

A polished dashboard does not prove the runtime contract

Practice reading Monitor and draining

Run a local request and see which counters change when the service drains.

14 · Integration checklist

Before choosing a language API