Skip to content

Add clientInfoTag support to Redis driver #735

@vchomakov

Description

@vchomakov

Describe the feature

Feature Request

Problem

Currently, when using the Redis driver with ioredis, there's no way to identify that unstorage is the higher-level library using ioredis. This makes it difficult for Redis administrators to track and debug connections.

Proposed Solution

Add clientInfoTag support to the Redis driver to leverage Redis's CLIENT SETINFO command.

This would allow ioredis to set a custom tag via the CLIENT SETINFO LIB-NAME command, making it visible in Redis that the connection is from ioredis(unstorage_vX.X.X).

Benefits

  • Better observability for Redis administrators
  • Easier debugging and connection tracking
  • Automatic version detection from package.json
  • Support for custom tags when needed
  • Utilizes Redis's built-in client information tracking

Example Usage

// Default behavior - automatically includes version
const storage = createStorage({
  driver: redisDriver({
    host: 'localhost',
    port: 6379
  })
});
// Results in: CLIENT SETINFO LIB-NAME ioredis(unstorage_v2.0.0-alpha.5)

// Custom tag
const storage = createStorage({
  driver: redisDriver({
    host: 'localhost',
    port: 6379,
    clientInfoTag: 'my-app_v1.0.0'
  })
});
// Results in: CLIENT SETINFO LIB-NAME ioredis(my-app_v1.0.0)

References

Redis CLIENT SETINFO documentation: https://redis.io/docs/latest/commands/client-setinfo/

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions