Skip to content

Add CLIENT SETNAME to Valkey vector store for connection identification #6172

@atao2004

Description

@atao2004

Summary

The ValkeyVectorStore accepts a pre-built valkey-glide BaseClient and does not set a clientName. When the caller does not configure one, the connection appears anonymous in monitoring tools like CLIENT LIST and Valkey Admin.

Suggested Fix

In ValkeyVectorStore.java (line ~99), when the store creates its own client internally, set a default clientName:

GlideClientConfiguration config = GlideClientConfiguration.builder()
    .address(NodeAddress.builder().host(host).port(port).build())
    .clientName("spring_ai_vector_store_client")
    .build();

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 Spring AI connections from other anonymous clients. This is especially important in production environments with ElastiCache where multiple services share the same Valkey cluster.

Setting clientName 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: spring_ai_vector_store_client

Pattern: {project}_{purpose}_client

  • spring_ai = project name
  • vector_store = purpose (vector store for Spring AI RAG)
  • _client = convention (matches Valkey Admin naming pattern)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions