groups

package
v0.0.2-3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatGroupCoordinators

func FormatGroupCoordinators(groupCoordinators []GroupCoordinator) string

FormatGroupCoordinators generates a pretty table from the results of a call to GetGroups.

func FormatGroupMembers

func FormatGroupMembers(members []MemberInfo, full bool) string

FormatGroupMembers generates a pretty table from a slice of MemberInfo details.

func FormatMemberLags

func FormatMemberLags(memberLags []MemberPartitionLag, full bool) string

FormatMemberLags generates a pretty table from the results of GetMemberLags.

func FormatMemberPartitionCounts

func FormatMemberPartitionCounts(members []MemberInfo) string

FormatMemberPartitionCounts generates a pretty table with the details on how many partitions group members are consuming from.

func FormatPartitionOffsets

func FormatPartitionOffsets(partitionOffsets map[int]int64) string

FormatPartitionOffsets generates a pretty table that shows the proposed offsets for each partition in a reset.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a struct for getting information about consumer groups from a cluster.

func NewClient

func NewClient(brokerAddr string) *Client

NewClient creates and returns a new Client instance.

func (*Client) GetGroupDetails

func (c *Client) GetGroupDetails(
	ctx context.Context,
	groupID string,
) (*GroupDetails, error)

GetGroupDetails returns the details (membership, etc.) for a single consumer group.

func (*Client) GetGroups

func (c *Client) GetGroups(
	ctx context.Context,
) ([]GroupCoordinator, error)

GetGroups fetches and returns information about all consumer groups in the cluster.

func (*Client) GetMemberLags

func (c *Client) GetMemberLags(
	ctx context.Context,
	topic string,
	groupID string,
) ([]MemberPartitionLag, error)

GetMemberLags returns the lag for each partition being consumed by the argument group in the argument topic.

func (*Client) ResetOffsets

func (c *Client) ResetOffsets(
	ctx context.Context,
	topic string,
	groupID string,
	partitionOffsets map[int]int64,
) error

ResetOffsets updates the offsets for a given topic / group combination.

type GroupCoordinator

type GroupCoordinator struct {
	GroupID     string
	Coordinator int
}

GroupCoordinator stores the coordinator broker for a single consumer group.

type GroupDetails

type GroupDetails struct {
	GroupID string
	State   string
	Members []MemberInfo
}

GroupDetails stores the state and members for a consumer group.

func (GroupDetails) PartitionMembers

func (g GroupDetails) PartitionMembers(topic string) map[int]MemberInfo

PartitionMembers returns the members for each partition in the argument topic.

func (GroupDetails) TopicsMap

func (g GroupDetails) TopicsMap() map[string]struct{}

TopicsMap returns a map of all the topics consumed by the current group.

type MemberInfo

type MemberInfo struct {
	MemberID        string
	ClientID        string
	ClientHost      string
	TopicPartitions map[string][]int
}

MemberInfo stores information about a single consumer group member.

func (MemberInfo) Topics

func (m MemberInfo) Topics() []string

Topics returns a slice of all topics that the current MemberInfo is consuming from.

type MemberPartitionLag

type MemberPartitionLag struct {
	Topic        string
	Partition    int
	MemberID     string
	NewestOffset int64
	NewestTime   time.Time
	MemberOffset int64
	MemberTime   time.Time
}

MemberPartitionLag information about the lag for a single topic / partition / group member combination.

func (MemberPartitionLag) OffsetLag

func (m MemberPartitionLag) OffsetLag() int64

OffsetLag returns the difference between the latest offset in the partition and the latest one committed by the group member.

func (MemberPartitionLag) TimeLag

func (m MemberPartitionLag) TimeLag() time.Duration

TimeLag returns the time difference between the latest timestamp in the the partition and the timestamp in the latest message committed by the group member.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳