@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:
Shared options
Every factory accepts a small common shape (seeBaseRedisOptions 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).
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).
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
PINGusesclient.ping(). - Any other
commandvalue is split into argv and sent withclient.exec([cmd, ...args]). Settingcommandto exactlyPINGstill usesping(), notexec.
Wiring into createHealthKit
Treat each factory’s return value as adapter on a check (same as a hand-written { check() { ... } } object):
schedule on the check if you want cached readiness results instead of hitting Redis on every probe (see Scheduling).