8000 feat: add cluster metadata request via aiokafka admin client in ping by murzinov01 · Pull Request #2212 · ag2ai/faststream · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add cluster metadata request via aiokafka admin client in ping #2212

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

Merged
merged 11 commits into from
May 18, 2025

Conversation

murzinov01
Copy link
Contributor

Description

Add request of the kafka cluster metadata via aiokafka.admin.client.AIOKafkaAdminClient in broker.ping method to achieve ping correct work.
For now, if you run FastStream application, connected to the Kafka, for example, in docker container and use broker.ping in /readiness probe you can encounter a bug:

After shutting down a Kafka docker container, broker.ping still respond as True value.
I believe that this is wrong behaviour.
More proper and expected decision is to return False or at least raise an Exception in that case.

Fixes # (issue number)

Type of change

Please delete options that are not relevant.

  • Bug fix (a non-breaking change that resolves an issue)

Checklist

  • My code adheres to the style guidelines of this project (scripts/lint.sh shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running scripts/test-cov.sh
  • I have ensured that static analysis tests are passing by running scripts/static-analysis.sh
  • I have included code examples to illustrate the modifications

@CLAassistant
Copy link
CLAassistant commented May 15, 2025

CLA assistant check
All committers have signed the CLA.

if self._admin_client is None:
return False

try:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think, we should replace the old logic by new one. Also, this check should respect timeout option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I think that in other broker classes(like RabbitMQ and others) the broker.ping should be checked for an example of a similar bug. But this is beyond the scope of my PR. Just keep it mind

@murzinov01 murzinov01 force-pushed the bugfix/ping_kafka_broker branch from 4dd9972 to 0f95ee6 Compare May 17, 2025 10:08
@murzinov01
Copy link
Contributor Author

Tests in tests/brokers/kafka were successful like in main branch 😌

Lancetnik
Lancetnik previously approved these changes May 17, 2025
Lancetnik
Lancetnik previously approved these changes May 18, 2025
@Lancetnik Lancetnik enabled auto-merge May 18, 2025 08:33
@Lancetnik Lancetnik marked this pull request as draft May 18, 2025 08:33
auto-merge was automatically disabled May 18, 2025 08:33

Pull request was converted to draft

@Lancetnik Lancetnik marked this pull request as ready for review May 18, 2025 08:33
@Lancetnik Lancetnik enabled auto-merge May 18, 2025 08:33
auto-merge was automatically disabled May 18, 2025 09:52

Head branch was pushed to by a user without write access

@Lancetnik Lancetnik added this pull request to the merge queue May 18, 2025
Merged via the queue into ag2ai:main with commit 1ca7783 May 18, 2025
41 of 64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0