stable

meter

Pass-through metrics wrapper for any to-* store — records per-method latency, error rate, and CAS conflicts on real traffic without changing behaviour.

@noy-db/to-meter · pnpm add @noy-db/to-meter Wraps any store and records what your app is actually doing.

Shapen/a — pass-through wrapper
Wrapsany NoydbStore

What it does

toMeter(inner) wraps any NoydbStore and returns the same six-method surface plus a meter handle, so app code doesn't change. It records real per-method (get/put/delete/list/loadAll/saveAll) latency percentiles, error rates, byte counts, and CAS conflicts. An optional synthetic liveness probe emits degraded/restored events. Unlike the probe — whose runStoreProbe() / probeTopology() this same package ships — it measures live traffic rather than synthetic benchmarks.

Notes

  • meter.snapshot() returns per-method stats plus status (ok / degraded / unreachable), casConflicts, totalCalls, and windowMs (time since start or last reset()).
  • meter also offers reset(), subscribe(listener) for degraded/restored transitions, and close() to stop the optional liveness timer.
  • Pass-through wrapper — the wrapped store's behaviour is unchanged.

See also