Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ class ClusterGlideClientAdapter implements UnifiedGlideClient {
subConfigBuilder.callback((msg, context) -> this.listener.onMessage(msg, context));
configBuilder.subscriptionConfiguration(subConfigBuilder.build());

// Set library name for server-side client identification
configBuilder.libName("GlideSpringDataValkey");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me that Spring Data Valkey would override the underlying Java driver (i.e. GlideJava to GlideSpringDataValkey). The Jedis compat layer does something similar. Although would like @jamesx-improving to confirm this is correct.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely arguable to say the least. I would push back on the Jedis comp layer case if I had the chance, as it introduced a precedent that a wrapper using glide underneath could claim its own lib-name, opening the door for future outer wrapper to change their lib-name as well, which would be an endless situation.

Of course I don't have the final say here, and I'm open to counterarguments.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reviewing existing lib names, I think setting lib name for Spring Data Valkey makes sense. Users can still set client name (which we don't set), and we maintain observability into which specific client/library is being used for devops.


// Build and create cluster client
GlideClusterClientConfiguration config = configBuilder.build();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ class StandaloneGlideClientAdapter implements UnifiedGlideClient {
subConfigBuilder.callback((msg, context) -> this.listener.onMessage(msg, context));
configBuilder.subscriptionConfiguration(subConfigBuilder.build());

// Set library name for server-side client identification
configBuilder.libName("GlideSpringDataValkey");

// Build and create client
GlideClientConfiguration config = configBuilder.build();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.valkey.springframework.data.valkey.connection.ValkeyServerCommands.FlushOption;
import io.valkey.springframework.data.valkey.core.types.ValkeyClientInfo;
import io.valkey.springframework.data.valkey.test.condition.EnabledOnValkeyClusterAvailable;
import io.valkey.springframework.data.valkey.test.condition.EnabledOnValkeyVersion;

/**
* Comprehensive low-level integration tests for {@link ValkeyGlideClusterConnection}
Expand Down Expand Up @@ -463,6 +464,13 @@ void testGetClientListOnSpecificNode() {
}
}

@Test
@EnabledOnValkeyVersion("7.2")
void testClientLibNameReported() {
List<ValkeyClientInfo> clientList = clusterConnection.serverCommands().getClientList();
assertThat(clientList).anyMatch(client -> "GlideSpringDataValkey".equals(client.get("lib-name")));
}

// ==================== Cluster-Wide Routing and Aggregation Verification ====================

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.jupiter.api.Test;

import io.valkey.springframework.data.valkey.connection.ValkeyNode;
import io.valkey.springframework.data.valkey.test.condition.EnabledOnValkeyVersion;
import io.valkey.springframework.data.valkey.connection.ValkeyServerCommands;
import io.valkey.springframework.data.valkey.connection.ValkeyServerCommands.FlushOption;
import io.valkey.springframework.data.valkey.connection.ValkeyServerCommands.MigrateOption;
Expand Down Expand Up @@ -453,6 +454,13 @@ void testGetClientList() {
assertThat(firstClient.get("idle")).isNotNull();
}

@Test
@EnabledOnValkeyVersion("7.2")
void testClientLibNameReported() {
List<ValkeyClientInfo> clientList = connection.serverCommands().getClientList();
assertThat(clientList).anyMatch(client -> "GlideSpringDataValkey".equals(client.get("lib-name")));
}

@Test
void testKillClient() {
// Test killing a client
Expand Down
Loading