semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Python: Add CLIENT SETNAME to Valkey/Redis connector for connection identification

Open atao2004 opened this issue 6 months ago • 1 comments

Summary

The Semantic Kernel Valkey connector uses redis-py (Redis from redis.asyncio.client) without setting a client_name. This means connections appear anonymous in monitoring tools like CLIENT LIST and Valkey Admin.

Suggested Fix

In python/semantic_kernel/connectors/redis.py (line ~16), add client_name when creating the Redis client:

client = Redis(host=host, port=port, client_name="semantic_kernel_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 Semantic Kernel 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: semantic_kernel_vector_store_client

Pattern: {project}_{purpose}_client

  • semantic_kernel = project name
  • vector_store = purpose (vector store connector)
  • _client = convention (matches Valkey Admin naming pattern)

atao2004 avatar May 26 '26 21:05 atao2004

@moonbox3 require approval for the fix on this MR: https://github.com/microsoft/semantic-kernel/pull/14039

kuriangeorgebinu avatar May 28 '26 15:05 kuriangeorgebinu