[
https://issues.apache.org/jira/browse/KAFKA-5526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16269410#comment-16269410
]
ASF GitHub Bot commented on KAFKA-5526:
---------------------------------------
GitHub user vahidhashemian opened a pull request:
https://github.com/apache/kafka/pull/4271
KAFKA-5526: Additional `--describe` views for ConsumerGroupCommand (KIP-175)
The `--describe` option of ConsumerGroupCommand is expanded to support:
* `--describe` or `--describe --offsets`: listing of current group offsets
* `--describe --members` or `--describe --members --verbose`: listing of
group members
* `--describe --state`: group status
Example: With a single partition topic `test1` and a double partition topic
`test2`, consumers `consumer1` and `consumer11` subscribed to `test`, consumers
`consumer2` and `consumer22` and `consumer222` subscribed to `test2`, and all
consumers belonging to group `test-group`, this is an output example of the new
options above for `test-group`:
```
--describe, or --describe --offsets:
TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG
CONSUMER-ID HOST CLIENT-ID
test2 0 0 0 0
consumer2-bad9496d-0889-47ab-98ff-af17d9460382 /127.0.0.1 consumer2
test2 1 0 0 0
consumer22-c45e6ee2-0c7d-44a3-94a8-9627f63fb411 /127.0.0.1 consumer22
test1 0 0 0 0
consumer1-d51b0345-3194-4305-80db-81a68fa6c5bf /127.0.0.1 consumer1
```
```
--describe --members
CONSUMER-ID HOST CLIENT-ID
#PARTITIONS
consumer2-bad9496d-0889-47ab-98ff-af17d9460382 /127.0.0.1 consumer2
1
consumer222-ed2108cd-d368-41f1-8514-5b72aa835bcc /127.0.0.1
consumer222 0
consumer11-dc8295d7-8f3f-4438-9b11-7270bab46760 /127.0.0.1 consumer11
0
consumer22-c45e6ee2-0c7d-44a3-94a8-9627f63fb411 /127.0.0.1 consumer22
1
consumer1-d51b0345-3194-4305-80db-81a68fa6c5bf /127.0.0.1 consumer1
1
```
```
--describe --members --verbose
CONSUMER-ID HOST CLIENT-ID
#PARTITIONS ASSIGNMENT
consumer2-bad9496d-0889-47ab-98ff-af17d9460382 /127.0.0.1 consumer2
1 test2(0)
consumer222-ed2108cd-d368-41f1-8514-5b72aa835bcc /127.0.0.1
consumer222 0 -
consumer11-dc8295d7-8f3f-4438-9b11-7270bab46760 /127.0.0.1 consumer11
0 -
consumer22-c45e6ee2-0c7d-44a3-94a8-9627f63fb411 /127.0.0.1 consumer22
1 test2(1)
consumer1-d51b0345-3194-4305-80db-81a68fa6c5bf /127.0.0.1 consumer1
1 test1(0)
```
```
--describe --state
ASSIGNMENT-STRATEGY STATE #MEMBERS
range Stable 5
```
Note that this PR also addresses the issue reported in
[KAFKA-6158](https://issues.apache.org/jira/browse/KAFKA-6158) by dynamically
setting the width of columns `TOPIC`, `CONSUMER-ID`, `HOST` and `CLIENT-ID`.
This avoid truncation of column values when they go over the current fixed
width of these columns.
The code has been restructured to better support testing of individual
values and also the console output. Unit tests have been updated and extended
to take advantage of this restructuring.
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vahidhashemian/kafka KAFKA-5526
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/kafka/pull/4271.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4271
----
commit 1973db23d2f29191ec56b56a3040c1a2b0c00ef4
Author: Vahid Hashemian <[email protected]>
Date: 2017-11-28T20:08:37Z
KAFKA-5526: Additional `--describe` views for ConsumerGroupCommand (KIP-175)
The `--describe` option of ConsumerGroupCommand is expanded to support:
* `--describe` or `--describe --offsets`: listing of current group offsets
* `--describe --members` or `--describe --members --verbose`: listing of
group members
* `--describe --state`: group status
Example: With a single partition topic `test1` and a double partition topic
`test2`, consumers `consumer1` and `consumer11` subscribed to `test`, consumers
`consumer2` and `consumer22` and `consumer222` subscribed to `test2`, and all
consumers belonging to group `test-group`, this is an output example of the new
options above for `test-group`:
```
--describe, or --describe --offsets:
TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG
CONSUMER-ID HOST CLIENT-ID
test2 0 0 0 0
consumer2-bad9496d-0889-47ab-98ff-af17d9460382 /127.0.0.1 consumer2
test2 1 0 0 0
consumer22-c45e6ee2-0c7d-44a3-94a8-9627f63fb411 /127.0.0.1 consumer22
test1 0 0 0 0
consumer1-d51b0345-3194-4305-80db-81a68fa6c5bf /127.0.0.1 consumer1
```
```
--describe --members
CONSUMER-ID HOST CLIENT-ID
#PARTITIONS
consumer2-bad9496d-0889-47ab-98ff-af17d9460382 /127.0.0.1 consumer2
1
consumer222-ed2108cd-d368-41f1-8514-5b72aa835bcc /127.0.0.1
consumer222 0
consumer11-dc8295d7-8f3f-4438-9b11-7270bab46760 /127.0.0.1 consumer11
0
consumer22-c45e6ee2-0c7d-44a3-94a8-9627f63fb411 /127.0.0.1 consumer22
1
consumer1-d51b0345-3194-4305-80db-81a68fa6c5bf /127.0.0.1 consumer1
1
```
```
--describe --members --verbose
CONSUMER-ID HOST CLIENT-ID
#PARTITIONS ASSIGNMENT
consumer2-bad9496d-0889-47ab-98ff-af17d9460382 /127.0.0.1 consumer2
1 test2(0)
consumer222-ed2108cd-d368-41f1-8514-5b72aa835bcc /127.0.0.1
consumer222 0 -
consumer11-dc8295d7-8f3f-4438-9b11-7270bab46760 /127.0.0.1 consumer11
0 -
consumer22-c45e6ee2-0c7d-44a3-94a8-9627f63fb411 /127.0.0.1 consumer22
1 test2(1)
consumer1-d51b0345-3194-4305-80db-81a68fa6c5bf /127.0.0.1 consumer1
1 test1(0)
```
```
--describe --state
ASSIGNMENT-STRATEGY STATE #MEMBERS
range Stable 5
```
Note that this PR also addresses the issue reported in
[KAFKA-6158](https://issues.apache.org/jira/browse/KAFKA-6158) by dynamically
setting the width of columns `TOPIC`, `CONSUMER-ID`, `HOST` and `CLIENT-ID`.
This avoid truncation of column values when they go over the current fixed
width of these columns.
----
> KIP-175: ConsumerGroupCommand no longer shows output for consumer groups
> which have not committed offsets
> ---------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-5526
> URL: https://issues.apache.org/jira/browse/KAFKA-5526
> Project: Kafka
> Issue Type: Improvement
> Reporter: Ryan P
> Assignee: Vahid Hashemian
> Labels: kip
>
> It would appear that the latest iteration of the ConsumerGroupCommand no
> longer outputs information about group membership when no offsets have been
> committed. It would be nice if the output generated by these tools maintained
> some form of consistency across versions as some users have grown to depend
> on them.
> 0.9.x output:
> bin/kafka-consumer-groups --bootstrap-server localhost:9092 --new-consumer
> --describe --group console-consumer-34885
> GROUP, TOPIC, PARTITION, CURRENT OFFSET, LOG END OFFSET, LAG, OWNER
> console-consumer-34885, test, 0, unknown, 0, unknown, consumer-1_/192.168.1.64
> 0.10.2 output:
> bin/kafka-consumer-groups --bootstrap-server localhost:9092 --new-consumer
> --describe --group console-consumer-34885
> Note: This will only show information about consumers that use the Java
> consumer API (non-ZooKeeper-based consumers).
> TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG
> CONSUMER-ID HOST
> CLIENT-ID
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)