Periodic state measurements for Ankusa.Metrics: what an operator alarms on,
as opposed to the event counters.
A :telemetry_poller per instance calls measure/1 every
admin.gauge_interval_ms (default 15 s) and emits:
[:ankusa, :store, :state]—hooks,deliveries(RocksDB key estimates),disk_bytes,next_seq(Ankusa.Queue.stats/1); on a node that runs the store.[:ankusa, :queue, :state]—pending(first-attempt rows waiting),scheduled(retry rows waiting, including one whose backoff has just ended and is not yet claimed),inflight,dead,archive_pending,dedupe(live ingest-dedupe keys),tenants(how many tenants the store has handed an ordinal to) andoldest_due_age_ms(how long the oldest due row has been waiting;0with nothing due). Read from the node's queue counters (seven point reads) and the active-tenant index, so the cost is independent of the backlog and of the number of tenants; on a node that runs the store.[:ankusa, :tenant, :state]— one event per tenant among the 100 with the mostpendingrows (pending, and thetenantin the metadata), taken from the counters of the first 10 000 tenants of the active index.[:ankusa, :quarantine, :state]— the pen'sbytes,entriesandpending(writes waiting for its group commit); on an:edgenode.[:ankusa, :disk, :state]—free_bytesandtotal_bytesof the file system holdingdata_dir, only while:disksup(:os_mon) runs. Core does not start:os_mon;ankusa_serverdoes.[:ankusa, :http, :state]—pools, how many outbound HTTP connection pools the instance has open inAnkusa.HttpClient.Pools; a read of the pool rows, bounded byegress.pools.max_pools.[:ankusa, :sink_batch, :state]—batchers,queuedandqueued_bytesacross theAnkusa.Sink.Batchers (SQS, Pub/Sub) of the instance; summed from counters each batcher keeps, no queue is scanned.[:ankusa, :vm, :state]—memory_bytes,:erlang.memory(:total): what the Erlang VM holds, the series the memory-growth alert reads.[:ankusa, :sources, :state]—without_dedupe, how many sources the configured source store declares with nodedupe(a walk of the declared specs, no data read); on an:edgenode.
Each probe runs on its own: one that fails (the store is reopening) emits
nothing, so its gauges keep their last value, and logs at :debug; the
others still run. Dispatch reports its own scheduler state
([:ankusa, :dispatch, :state]) from its housekeeping tick.
Summary
Functions
Take every measurement once, now. The poller calls this; so may a test.
Functions
@spec child_spec(keyword()) :: Supervisor.child_spec()
@spec measure(atom()) :: :ok
Take every measurement once, now. The poller calls this; so may a test.