Ankusa.Metrics.Gauges (ankusa v0.7.0)

Copy Markdown View Source

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) and oldest_due_age_ms (how long the oldest due row has been waiting; 0 with 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 most pending rows (pending, and the tenant in the metadata), taken from the counters of the first 10 000 tenants of the active index.
  • [:ankusa, :quarantine, :state] — the pen's bytes, entries and pending (writes waiting for its group commit); on an :edge node.
  • [:ankusa, :disk, :state] — free_bytes and total_bytes of the file system holding data_dir, only while :disksup (:os_mon) runs. Core does not start :os_mon; ankusa_server does.
  • [:ankusa, :http, :state] — pools, how many outbound HTTP connection pools the instance has open in Ankusa.HttpClient.Pools; a read of the pool rows, bounded by egress.pools.max_pools.
  • [:ankusa, :sink_batch, :state] — batchers, queued and queued_bytes across the Ankusa.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 no dedupe (a walk of the declared specs, no data read); on an :edge node.

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

child_spec(opts)

@spec child_spec(keyword()) :: Supervisor.child_spec()

measure(instance)

@spec measure(atom()) :: :ok

Take every measurement once, now. The poller calls this; so may a test.