Skip to content

Support client_name connection parameter for redis transport#2367

Merged
auvipy merged 5 commits intocelery:mainfrom
mdalp:support-client-name-connection-parameter-for-redis
Sep 24, 2025
Merged

Support client_name connection parameter for redis transport#2367
auvipy merged 5 commits intocelery:mainfrom
mdalp:support-client-name-connection-parameter-for-redis

Conversation

@mdalp
Copy link
Contributor

@mdalp mdalp commented Sep 19, 2025

This is the first step to allow passing the client name from the celery configuration.
I'll send a PR when I can to do that.

@mdalp mdalp force-pushed the support-client-name-connection-parameter-for-redis branch from 54e2489 to 3c91c85 Compare September 19, 2025 09:06
@auvipy auvipy requested a review from Copilot September 20, 2025 04:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the client_name connection parameter in the Redis transport, allowing Redis clients to be identified with a custom name. This is the first step toward enabling client name configuration through Celery configuration.

  • Adds client_name as a configurable transport option for Redis connections
  • Updates connection parameter handling to include the client name in Redis connection pools
  • Adds comprehensive test coverage for both regular Redis connections and Sentinel configurations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
kombu/transport/redis.py Adds client_name attribute and includes it in connection parameters
t/unit/transport/test_redis.py Adds tests for client_name parameter handling in regular and Sentinel Redis connections

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

would like to have more reference for this, can you share?

@auvipy auvipy added this to the 5.6.0 milestone Sep 20, 2025
@Nusnus
Copy link
Member

Nusnus commented Sep 21, 2025

would like to have more reference for this, can you share?

Same 🙏

@Nusnus Nusnus force-pushed the support-client-name-connection-parameter-for-redis branch from 3c91c85 to c14851a Compare September 21, 2025 15:04
@mdalp
Copy link
Contributor Author

mdalp commented Sep 22, 2025

Absolutely!
So, redis allows to label a given connection, so that you can identify it when listing all the connections on the server (a bit like you would do for other DBs, i.e. Oracle, Postgres, ...).
This is the command that's run to do so https://redis.io/docs/latest/commands/client-setname/ .
The library that kombu uses redis-py offers the ability to customise that via an argument given to the constructor https://github.com/redis/redis-py/blob/master/redis/client.py#L241, if this argument is set then the ConnectionPool manager calls the command upon creation of a new connection https://github.com/redis/redis-py/blob/master/redis/connection.py#L721 .

Feel free to ask any question you'd like 💪

@mdalp
Copy link
Contributor Author

mdalp commented Sep 22, 2025

On another note, @Nusnus watch out that you force pushed some changes that are not relevant to my PR.
I'm happy to revert those, unless there is a reason for those.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

may be we also need to update the docs to highlight the change

@mdalp
Copy link
Contributor Author

mdalp commented Sep 23, 2025

Hey @auvipy is this what you meant d6aeea2 ?
Or you had something different in mind?

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

can we get better example docs where users can check the example to use in their code?

@mdalp
Copy link
Contributor Author

mdalp commented Sep 24, 2025

Hi @auvipy , I'm a bit lost, where do you suggest I should document that?
I took as as an example the retry_on_timeout parameter and it's not documented anywhere more than I did for client_name.

@auvipy auvipy merged commit 252d8ac into celery:main Sep 24, 2025
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants