-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Get size of topic #2163
Comments
By size, I assume you mean bytes since you referred to a partition. No, that's not currently available, and I don't know if it's even available via the Kafka Admin API... if there's now a KIP that added it, then we'd happily accept a PR adding support. |
waiting for the feature |
Hi, DescribeLogDirs API (Key: 35)Requests:
Responses:
I already create an issue in confluent-kafka-python here I try some test with kafka-python lib by adding the following code
I try a simple client
==> DescribeLogDirsResponse_v0(throttle_time_ms=0, log_dirs=[(error_code=0, log_dir='/var/lib/kafka/data', topics=[])]) I don't understand why test topic is empty ? In kafka logdir:
|
It finally works! I did a PR #2278 @jeffwidman Simple exemple
DescribeLogDirsResponse
Assuming that "empty partitions" equal to 8.0 kB on disk but in protocol response partition_size value is 0 Byte. |
|
Thank for your feed back, can you give me more info about your configuration and how can I reproduce your issue ? |
HI @Courouge Bellow is the steps I did
The output show the same as you showed above, but the total of topics in output don't match no.of topics that the cluster have. |
Hi @tommy04062019,
|
Is there a forked released version with the changes done by @Courouge which I can include in my requirements.txt? |
I've tested it, it works perfectly! Thank you, Courouge!!! |
Thanks a lot @Courouge! I did a little change because if you have multiple Kafka nodes, you may not see all the partitions because they are not hosted on all brokers.
So I just add the possiblity to specifiy the broker id instead of using _self.client.least_loaded_node():
I asked myself if it could be better to do a loop on all broker by default if I don't set a specific broker. And to use this function I do:
Here is the full code in order to get a list with topic_name, partition_id, size :
Now you'll have a list with this pattern:
And in a real world:
Now you could use the list:
Hope it helps :) |
@hilia yes you right, the proposed PR doesn't give you all partitions in a multiple broker cluster. I'll update this comment if I've a better solution to offer Edit: I ended-up using it like that for now: (In a monitoring script, very close to Hilia's suggestion 👍 ) |
Hi All
Is there a way to get the size of a partition with this library?
I know its possible via commandline with the kafka-log-dirs command.
The text was updated successfully, but these errors were encountered: