Telemetry
Monitor rate limit checks, quota usage, and penalty events through one hook.
Read first
Built-in observability StatsCollector + OpenTelemetry
v0.3.0 ships first-class observability: a typed telemetry hook, an in-process aggregator with a snapshot endpoint, and an OTel metrics adapter. Start there.
Quick example
Pass any object implementing the telemetry interface as the limiter's telemetry argument. LoggingTelemetry is the simplest built-in it logs every event.
import { RateLimiter, LoggingTelemetry } from 'halt-rate';
const limiter = new RateLimiter({
store,
policy,
telemetry: new LoggingTelemetry(),
});from halt import RateLimiter, LoggingTelemetry
limiter = RateLimiter(store=store, policy=policy, telemetry=LoggingTelemetry())Available hooks
- StatsCollector in-process aggregator with a JSON snapshot for a
/halt/statsendpoint. - OpenTelemetryMetrics OTel counter adapter via an injected meter.
- LoggingTelemetry logs every event (above).
- CompositeTelemetry fan out to multiple hooks.
All of them implement the same TelemetryHooks interface and are accepted by RateLimiter, QuotaManager, and PenaltyManager wire one to all three for unified counters.