Skip to main content
The @healthzkit/redis package ships ready-made HealthAdapter implementations for common Redis clients. Each adapter measures round-trip latency, returns ok with metadata.latencyMs (and any extra fields from an optional hook), or fail with the caught error. Install the adapter package and at least one peer client library:
All three clients are optional peers: install only the stack you use.

Shared options

Every factory accepts a small common shape (see BaseRedisOptions in the package):

ioredisAdapter

Peer: ioredis >= 5. Use either a shared Redis instance or a connection string (the adapter lazily creates an internal client with maxRetriesPerRequest: 1 and enableReadyCheck: false, merged with your redisOptions).
The command string is passed to ioredis client.call(...) as a single string (for example "PING" or "ECHO x").

nodeRedisAdapter (node-redis)

Peer: redis >= 4. Use a createClient instance (with sendCommand, connect, isOpen) or a connection string (the adapter calls createClient({ url, ...redisOptions }), then connect() once).
The command string is split on whitespace and passed to sendCommand as an argv array (default ["PING"]; custom example "ECHO hello" -> ["ECHO", "hello"]). If the client is not open, connect() is awaited before the command.

upstashAdapter

Peer: @upstash/redis >= 1. Use url + token (internal REST client is created lazily) or pass an existing Upstash Redis client.
  • Default PING uses client.ping().
  • Any other command value is split into argv and sent with client.exec([cmd, ...args]). Setting command to exactly PING still uses ping(), not exec.

Wiring into createHealthKit

Treat each factory’s return value as adapter on a check (same as a hand-written { check() { ... } } object):
Combine with schedule on the check if you want cached readiness results instead of hitting Redis on every probe (see Scheduling).