Redis-backed counter and trend tracking library for Node.js (v1.4.2). Provides easy aggregation of time-series counters with configurable granularity (hour, day, week, month, year) and Redis namespacing. Supports both callback and Promise patterns. Maintained by GetConversio, last release stable. Differentiates from generic Redis counters by offering pre-built aggregation logic and simple API.
npm install redis-metricsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to instantiate RedisMetrics, create a counter, increment it, and retrieve the count using promises.
Ensure redis-server is running and accessible via default host/port, or provide custom Redis options to the constructor.
Always attach an 'error' listener to metrics.client: metrics.client.on('error', (err) => { /* handle */ })Use .then() and .catch() instead of callbacks for future-proof code.
Replace { timeGranularity: 'hour' } with { granularity: 'hour' }.Use a single Redis instance or use a library with cluster support.
Instantiate: const metrics = new RedisMetrics(); then metrics.counter('name')Ensure Redis is running and metrics.client.on('error') is set to log connection issues.