Skip to content
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

rpk: add an option to print group member's instance ID #24881

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/go/rpk/pkg/cli/group/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

func NewDescribeCommand(fs afero.Fs, p *config.Params) *cobra.Command {
var summary, commitsOnly, lagPerTopic, re bool
var summary, commitsOnly, lagPerTopic, re, useInstanceID bool
cmd := &cobra.Command{
Use: "describe [GROUPS...]",
Short: "Describe group offset status & lag",
Expand Down Expand Up @@ -81,13 +81,14 @@ Describe any one-character group:
printDescribedSummary(lags)
return
}
printDescribed(commitsOnly, lags)
printDescribed(commitsOnly, lags, useInstanceID)
},
}
cmd.Flags().BoolVarP(&lagPerTopic, "print-lag-per-topic", "t", false, "Print the aggregated lag per topic")
cmd.Flags().BoolVarP(&summary, "print-summary", "s", false, "Print only the group summary section")
cmd.Flags().BoolVarP(&commitsOnly, "print-commits", "c", false, "Print only the group commits section")
cmd.Flags().BoolVarP(&re, "regex", "r", false, "Parse arguments as regex; describe any group that matches any input group expression")
cmd.Flags().BoolVarP(&useInstanceID, "use-instance-ID", "i", false, "Show each group member's instance ID")
cmd.MarkFlagsMutuallyExclusive("print-summary", "print-commits")
cmd.MarkFlagsMutuallyExclusive("print-lag-per-topic", "print-commits")
return cmd
Expand All @@ -113,10 +114,10 @@ type describeRow struct {
err string
}

func printDescribed(commitsOnly bool, lags kadm.DescribedGroupLags) {
func printDescribed(commitsOnly bool, lags kadm.DescribedGroupLags, useInstanceID bool) {
for i, group := range lags.Sorted() {
var rows []describeRow
var useInstanceID, useErr bool
var useErr bool
for _, l := range group.Lag.Sorted() {
row := describeRow{
topic: l.Topic,
Expand Down
Loading