koff

package module
v0.0.0-...-cc5091b Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2017 License: MIT Imports: 3 Imported by: 0

README

koff

Build Status GoDoc

koff is a small tool to get information about Kafka offsets.

Run koff --help to get the help.

Here it is for your convenience:

Usage of ./koff
  -b="": The broker to use

Subcommands:

get-consumer-group-offset, gcgo
  -V=1: The Kafka offset version
  -c="": The consumer group
  -p=-1: The partition
  -t="": The topic

get-offset, go
  -n=true: Get the newest offset instead of the oldest
  -p=-1: The partition
  -t="": The topic

drift, d
  -V=1: The Kafka offset version
  -c="": The consumer group
  -n=true: Compare to the newest offset instead of the oldest
  -p=-1: The partition
  -t="": The topic

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Koff

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

Koff provides method to get and compare offsets of consumer groups.

func New

func New(client sarama.Client) *Koff

New creates a new Koff structure.

func (*Koff) GetConsumerGroupOffsets

func (k *Koff) GetConsumerGroupOffsets(consumerGroup, topic string, version OffsetVersion, partitions ...int32) (map[int32]int64, error)

GetConsumerGroupOffsets retrieves the last committed offsets for the given consumer group. Returns a map of partitions to offset.

func (*Koff) GetDrift

func (k *Koff) GetDrift(consumerGroup, topic string, version OffsetVersion, partitions ...int32) (map[int32]int64, error)

GetDrift computes the drift between the last comitted offsets of a consumer group and the newest offsets available for a topic and partition.

Returns a map of partitions to offset.

func (*Koff) GetNewestOffsets

func (k *Koff) GetNewestOffsets(topic string, partitions ...int32) (map[int32]int64, error)

GetNewestOffsets retrieves the newest available offsets for each partitions of the provided topic.

Returns a map of partitions to offset.

func (*Koff) GetOldestOffsets

func (k *Koff) GetOldestOffsets(topic string, partitions ...int32) (res map[int32]int64, err error)

GetOldestOffsets retrieves the oldest available offsets for each partitions of the provided topic.

Returns a map of partitions to offset.

func (*Koff) Init

func (k *Koff) Init() error

Init initializes the state of the Koff instance.

It queries the Kafka cluster for a list of topics and refreshes the metadata for each topic.

func (*Koff) OffsetInAvailableRange

func (k *Koff) OffsetInAvailableRange(topic string, offset int64, partitions ...int32) (bool, error)

OffsetInAvailableRange check that the provided offset is in the available range of the topic and partitions.

If multiple partitions are provided, the offset is checked for all partitions.

type OffsetVersion

type OffsetVersion int16
const (
	ZKOffsetVersion    OffsetVersion = 0
	KafkaOffsetVersion OffsetVersion = 1
)

func (*OffsetVersion) Set

func (v *OffsetVersion) Set(s string) error

func (OffsetVersion) String

func (v OffsetVersion) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL