Skip to content

feat(vdb): add client_name to Valkey GlideClient configuration#36697

Open
iAbhi001 wants to merge 10 commits into
langgenius:mainfrom
iAbhi001:fix/valkey-name
Open

feat(vdb): add client_name to Valkey GlideClient configuration#36697
iAbhi001 wants to merge 10 commits into
langgenius:mainfrom
iAbhi001:fix/valkey-name

Conversation

@iAbhi001
Copy link
Copy Markdown
Contributor

@iAbhi001 iAbhi001 commented May 26, 2026

Closes #36696

This Pull Request resolves issue #36696 by adding the client_name="dify_valkey" parameter to the GlideClientConfiguration inside the Valkey vector store backend (valkey_vector.py). Currently, Dify initializes the GlideClient without an explicit application identifier, causing its active connections to appear completely anonymous in server tracking metrics. In production environments where multiple microservices share a single Valkey cluster or an AWS ElastiCache deployment, this anonymity prevents DevOps engineers and database administrators from isolating Dify's resource footprint during troubleshooting. Injecting this explicit client name triggers a native CLIENT SETNAME command upon connection, allowing the application to be instantly identifiable within standard CLIENT LIST commands, cloud monitoring dashboards, and infrastructure management tools.

daric93 and others added 9 commits May 20, 2026 13:56
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
- Fix S110 lint: replace bare except-pass with logger.debug in __del__
- Fix type-check: use Literal type for VALKEY_DISTANCE_METRIC in config
- Fix VDB CI: expose valkey port in CI, read host/port from env vars in tests

Signed-off-by: Daria Korenieva <daric2612@gmail.com>
- Add valkey service definition to docker-compose-template.yaml
- Change VALKEY_HOST default from localhost to valkey in .env.example
- Prevents autofix from removing valkey service on regeneration

Signed-off-by: Daria Korenieva <daric2612@gmail.com>
- Fix list type annotation in integration test field_pairs
- Add type: ignore for intentional invalid arg in unit test

Signed-off-by: Daria Korenieva <daric2612@gmail.com>
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
@iAbhi001 iAbhi001 requested a review from a team May 26, 2026 21:48
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label May 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 45.69% 45.66% -0.03%
Strict coverage 45.21% 45.19% -0.03%
Typed symbols 24,247 24,278 +31
Untyped symbols 29,125 29,195 +70
Modules 2724 2727 +3

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-26 21:52:47.936918679 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-26 21:52:40.433862426 +0000
@@ -520,6 +520,8 @@
   --> providers/vdb/vdb-upstash/tests/unit_tests/test_upstash_vector.py:33:5
 ERROR Object of class `ModuleType` has no attribute `Index` [missing-attribute]
   --> providers/vdb/vdb-upstash/tests/unit_tests/test_upstash_vector.py:34:5
+ERROR Could not find name `ValidationError` [unknown-name]
+   --> providers/vdb/vdb-valkey/tests/unit_tests/test_valkey_vector.py:240:28
 ERROR Object of class `ModuleType` has no attribute `SimpleConnectionPool` [missing-attribute]
   --> providers/vdb/vdb-vastbase/tests/unit_tests/test_vastbase_vector.py:27:5
 ERROR Object of class `ModuleType` has no attribute `execute_values` [missing-attribute]
@@ -4701,7 +4703,7 @@
 ERROR Argument `list[Document | SimpleNamespace]` is not assignable to parameter `texts` with type `list[Document]` in function `core.rag.datasource.vdb.vector_base.BaseVector._get_uuids` [bad-argument-type]
   --> tests/unit_tests/core/rag/datasource/vdb/test_vector_base.py:87:30
 ERROR Class member `_Expr.__eq__` overrides parent class `object` in an inconsistent manner [bad-override]
-   --> tests/unit_tests/core/rag/datasource/vdb/test_vector_factory.py:249:13
+   --> tests/unit_tests/core/rag/datasource/vdb/test_vector_factory.py:250:13
 ERROR Argument `list[str]` is not assignable to parameter `docs` with type `Sequence[Document]` in function `core.rag.docstore.dataset_docstore.DatasetDocumentStore.add_documents` [bad-argument-type]
    --> tests/unit_tests/core/rag/docstore/test_dataset_docstore.py:307:37
 ERROR Argument `None` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CLIENT SETNAME to Valkey vector store for connection identification

2 participants