Skip to content

Commit a4df5ce

Browse files
fix: make Valkey client names configurable and component-specific
- Add optional client_name parameter to create_valkey_client() - Enable component-specific names for better debugging: * praisonai_state_store for StateStore * praisonai_vector_store for VectorKnowledgeStore * praisonai_storage_adapter for StorageAdapter * praisonai_search_backend for SearchBackend - Maintain backward compatibility with default fallback - Allow client_name=None to disable CLIENT SETNAME Addresses Qodo reviewer feedback about hardcoded client names. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Mervin Praison <MervinPraison@users.noreply.github.com>
1 parent 10d5516 commit a4df5ce

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/praisonai/praisonai/persistence/_valkey_client.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,22 @@ def create_valkey_client(
3030
port: int = 6379,
3131
password: Optional[str] = None,
3232
db: int = 0,
33+
client_name: Optional[str] = "praisonai_valkey_client",
3334
):
3435
"""Create and return a GlideClientSync instance."""
3536
if GlideClientSync is None:
3637
raise ImportError(_MISSING_MSG)
3738
addresses = [NodeAddress(host, port)]
3839
creds = ServerCredentials(password=password) if password else None
39-
config = GlideClientConfiguration(
40-
addresses=addresses,
41-
credentials=creds,
42-
client_name="praisonai_valkey_client",
43-
database_id=db,
44-
)
40+
41+
# Build configuration, only include client_name if provided
42+
config_kwargs = {
43+
"addresses": addresses,
44+
"credentials": creds,
45+
"database_id": db,
46+
}
47+
if client_name is not None:
48+
config_kwargs["client_name"] = client_name
49+
50+
config = GlideClientConfiguration(**config_kwargs)
4551
return GlideClientSync.create(config)

src/praisonai/praisonai/persistence/knowledge/valkey_vector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def _get_client(self):
7373
host=self.host,
7474
port=self.port,
7575
password=self.password,
76+
client_name="praisonai_vector_store",
7677
)
7778
return self._client
7879

src/praisonai/praisonai/persistence/state/valkey.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def _get_client(self):
5252
port=self.port,
5353
password=self.password,
5454
db=self.db,
55+
client_name="praisonai_state_store",
5556
)
5657
return self._client
5758

src/praisonai/praisonai/storage/valkey_adapter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def _get_client(self):
8080
host=self.host,
8181
port=self.port,
8282
password=self.password,
83+
client_name="praisonai_storage_adapter",
8384
)
8485
return self._client
8586

@@ -260,6 +261,7 @@ def _get_client(self):
260261
host=self.host,
261262
port=self.port,
262263
password=self.password,
264+
client_name="praisonai_search_backend",
263265
)
264266
return self._client
265267

0 commit comments

Comments
 (0)