kafka

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OffsetOldest represents oldest offset in Kafka
	OffsetOldest Offset = -1
	// OffsetNewest represents newest offset in Kafka
	OffsetNewest = -2

	// ProtocolPlain represents graphite line protocol
	ProtocolPlain Protocol = 0
	// ProtocolProtobuf represents protobuf messages
	ProtocolProtobuf = 1
	// ProtocolPickle represents pickled messages
	ProtocolPickle = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Kafka

type Kafka struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Kafka receive metrics in protobuf or graphite line format from Kafka partitions

func (*Kafka) Stat

func (rcv *Kafka) Stat(send helper.StatCallback)

Stat sends kafka receiver's internal stats to specified callback

func (*Kafka) Stop

func (rcv *Kafka) Stop()

Stop stops kafka receiver. It will return when all goroutines finish their work.

type Offset

type Offset int64

Offset is a special type to define kafka offsets. It's used to create custom marshal/unmarshal functions for configs.

func (*Offset) MarshalText

func (o *Offset) MarshalText() ([]byte, error)

MarshalText marshals offset. It's used to handle two special cases "newest" and "oldest".

func (*Offset) UnmarshalText

func (o *Offset) UnmarshalText(text []byte) error

UnmarshalText unmarshals text to offset. It handles "newest" and "oldest", oterwise fallbacks to time.ParseDuration.

type Options

type Options struct {
	Brokers           []string      `toml:"brokers"`
	Topic             string        `toml:"topic"`
	Partition         int32         `toml:"partition"`
	Protocol          Protocol      `toml:"parse-protocol"`
	StateFile         string        `toml:"state-file"`
	InitialOffset     Offset        `toml:"initial-offset"`
	StateSaveInterval time.Duration `toml:"state-save-interval"`
	ReconnectInterval time.Duration `toml:"reconnect-interval"`
	FetchInterval     time.Duration `toml:"fetch-interval"`
}

Options contains all receiver's options that can be changed by user

func NewOptions

func NewOptions() *Options

NewOptions returns Options struct filled with default values.

type Protocol

type Protocol int

Protocol is a special type to allow user to define wire protocol in Config file as a simple text.

func (*Protocol) MarshalText

func (p *Protocol) MarshalText() ([]byte, error)

MarshalText converts internal enum-like representation of protocol to a text

func (*Protocol) ToString

func (p *Protocol) ToString() string

ToString returns text representation of current protocol

func (*Protocol) UnmarshalText

func (p *Protocol) UnmarshalText(text []byte) error

UnmarshalText converts text from config file to a enum.

Jump to

Keyboard shortcuts

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