-
Notifications
You must be signed in to change notification settings - Fork 16
docs: Python client identification options #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Aryex
wants to merge
1
commit into
main
Choose a base branch
from
alexl/agent/python-client-info-config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
src/content/docs/how-to/monitoring/client-identification.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| --- | ||
| title: Client Identification | ||
| description: Customize the library name reported to Valkey for framework attribution and observability. | ||
| --- | ||
|
|
||
| import { Tabs, TabItem } from '@astrojs/starlight/components'; | ||
|
|
||
| Frameworks and libraries that embed Valkey GLIDE often need to be identifiable in `CLIENT INFO` and `CLIENT LIST` output. This is useful for adoption tracking, observability, and debugging — letting operators see exactly which library or framework is responsible for each connection. | ||
|
|
||
| ## client_name vs lib_name | ||
|
|
||
| Valkey exposes two separate identification fields per connection: | ||
|
|
||
| | Option | Valkey command | Purpose | | ||
| |--------|---------------|---------| | ||
| | `client_name` | `CLIENT SETNAME` | Identifies the **application** (e.g. `"order-service"`) | | ||
| | `lib_name` / `client_info_tag` | `CLIENT SETINFO LIB-NAME` | Identifies the **library or framework** (e.g. `"GlidePy(my-framework:1.2.3)"`) | | ||
|
|
||
| Use `client_name` to label your application instance. Use `lib_name` and `client_info_tag` when you are building a library or framework on top of GLIDE and want that layer to be visible in server diagnostics. | ||
|
|
||
| ## Configuration Options | ||
|
|
||
| GLIDE provides two options for controlling the `LIB-NAME` value: | ||
|
|
||
| - **`client_info_tag`** (recommended) — appends a parenthesized tag to the default library name, preserving GLIDE's identity. For example, setting `client_info_tag="my-framework:1.2.3"` produces `GlidePy(my-framework:1.2.3)`. | ||
| - **`lib_name`** — fully overrides the default library name. Use this only when you need complete control over the reported name. | ||
|
|
||
| ### Behavior Matrix | ||
|
|
||
| | Configuration | Resulting `lib-name` (async) | Resulting `lib-name` (sync) | | ||
| |---|---|---| | ||
| | _(none)_ | `GlidePy` | `GlidePySync` | | ||
| | `client_info_tag="lmcache:1.2"` | `GlidePy(lmcache:1.2)` | `GlidePySync(lmcache:1.2)` | | ||
| | `lib_name="custom"` | `custom` | `custom` | | ||
| | `lib_name="custom"`, `client_info_tag="lmcache:1.2"` | `custom(lmcache:1.2)` | `custom(lmcache:1.2)` | | ||
|
|
||
| ## Examples | ||
|
|
||
| <Tabs syncKey="progLangInExamples"> | ||
| <TabItem label="Python"> | ||
| **Async client (cluster mode):** | ||
|
|
||
| ```python | ||
| from glide import ( | ||
| GlideClusterClient, | ||
| GlideClusterClientConfiguration, | ||
| NodeAddress | ||
| ) | ||
|
|
||
| # Recommended: use client_info_tag to preserve GLIDE identity | ||
| config = GlideClusterClientConfiguration( | ||
| addresses=[NodeAddress("localhost", 6379)], | ||
| client_info_tag="my-framework:1.2.3", | ||
| ) | ||
| client = await GlideClusterClient.create(config) | ||
| # lib-name in CLIENT INFO: GlidePy(my-framework:1.2.3) | ||
|
|
||
| # Full override (replaces the default library name entirely) | ||
| config = GlideClusterClientConfiguration( | ||
| addresses=[NodeAddress("localhost", 6379)], | ||
| lib_name="custom-lib", | ||
| ) | ||
| client = await GlideClusterClient.create(config) | ||
| # lib-name in CLIENT INFO: custom-lib | ||
| ``` | ||
|
|
||
| **Sync client (standalone mode):** | ||
|
|
||
| ```python | ||
| from glide import ( | ||
| GlideClient, | ||
| GlideClientConfiguration, | ||
| NodeAddress | ||
| ) | ||
|
|
||
| config = GlideClientConfiguration( | ||
| addresses=[NodeAddress("localhost", 6379)], | ||
| client_info_tag="my-framework:1.2.3", | ||
| ) | ||
| client = GlideClient(config) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be |
||
| # lib-name in CLIENT INFO: GlidePySync(my-framework:1.2.3) | ||
| ``` | ||
| </TabItem> | ||
|
|
||
| <TabItem label="Java"> | ||
| :::note[Coming soon] | ||
| The `client_info_tag` option is not yet available in Java. Java already supports `libName` for overriding the library name, but the tag-append behavior will be added in a future release. | ||
| ::: | ||
| </TabItem> | ||
|
|
||
| <TabItem label="Node"> | ||
| :::note[Coming soon] | ||
| Client identification options (`lib_name` and `client_info_tag`) are not yet available in the Node.js client. Support is planned for a future release. | ||
| ::: | ||
| </TabItem> | ||
|
|
||
| <TabItem label="Go"> | ||
| :::note[Coming soon] | ||
| Client identification options (`lib_name` and `client_info_tag`) are not yet available in the Go client. | ||
| ::: | ||
| </TabItem> | ||
|
|
||
| <TabItem label="PHP"> | ||
| :::note[Coming soon] | ||
| Client identification options (`lib_name` and `client_info_tag`) are not yet available in the PHP client. | ||
| ::: | ||
| </TabItem> | ||
|
|
||
| <TabItem label="C#"> | ||
| :::note[Coming soon] | ||
| Client identification options (`lib_name` and `client_info_tag`) are not yet available in the C# client. | ||
| ::: | ||
| </TabItem> | ||
| </Tabs> | ||
|
|
||
| ## Validation Rules | ||
|
|
||
| The `client_info_tag` value **must not contain whitespace**. This constraint comes from the Valkey `CLIENT SETINFO` command, which does not allow spaces in values. If you pass a tag containing spaces, the client will reject it. | ||
|
|
||
| Valid examples: | ||
| - `"my-framework:1.2.3"` | ||
| - `"lmcache:2.0"` | ||
| - `"analytics-sdk"` | ||
|
|
||
| Invalid examples: | ||
| - `"my framework"` (contains a space) | ||
| - `"lmcache 1.2"` (contains a space) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far
client_info_taghas only been added to Python which is why this page focuses on Python (see valkey-io/valkey-glide#6429 for task to add to all clients). But this page could also go over currentlib_nameandclient_nameusage across all clients.