dify icon indicating copy to clipboard operation
dify copied to clipboard

Add CLIENT SETNAME to Valkey vector store for connection identification

Open atao2004 opened this issue 6 months ago • 0 comments

Summary

The Dify Valkey vector store creates a GlideClient without setting a client_name. This means connections appear anonymous in monitoring tools like CLIENT LIST and Valkey Admin.

Suggested Fix

In api/providers/vdb/vdb-valkey/src/dify_vdb_valkey/valkey_vector.py (line ~250), add client_name to the GlideClientConfiguration:

cfg = GlideClientConfiguration(
    [NodeAddress(host, port)],
    client_name="dify_vector_store_client",
)

Why This Matters

When monitoring a Valkey server with multiple connected applications, CLIENT LIST shows each connection's name. Without a client name, operators cannot distinguish Dify connections from other anonymous clients. This is especially important in production environments with ElastiCache where multiple services share the same Valkey cluster.

Setting client_name sends a CLIENT SETNAME command on connection, making the connection identifiable in:

  • CLIENT LIST output
  • Monitoring dashboards (e.g., Valkey Admin)
  • CloudWatch metrics (ElastiCache)

Naming Convention

Suggested client name: dify_vector_store_client

Pattern: {project}_{purpose}_client

  • dify = project name
  • vector_store = purpose (vector database for RAG)
  • _client = convention (matches Valkey Admin naming pattern)

atao2004 avatar May 26 '26 21:05 atao2004