receiver

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BufferPool = sync.Pool{
	New: func() interface{} {
		return &Buffer{}
	},
}

Functions

func HasDoubleDot

func HasDoubleDot(p []byte) bool

func PlainParseBuffer

func PlainParseBuffer(exit chan struct{}, b *Buffer, out chan *RowBinary.WriteBuffer, days *days1970.Days, metricsReceived *uint32, errors *uint32)

func PlainParseLine

func PlainParseLine(p []byte) ([]byte, float64, uint32, error)

func PlainParser

func PlainParser(exit chan struct{}, in chan *Buffer, out chan *RowBinary.WriteBuffer, metricsReceived *uint32, errors *uint32)

func RemoveDoubleDot

func RemoveDoubleDot(p []byte) []byte

Types

type Buffer

type Buffer struct {
	Time uint32
	Used int
	Body [262144]byte
}

func GetBuffer

func GetBuffer() *Buffer

func (*Buffer) Release

func (b *Buffer) Release()

func (*Buffer) Reset

func (b *Buffer) Reset() *Buffer

func (*Buffer) Write

func (b *Buffer) Write(p []byte)

type Option

type Option func(Receiver) error

func Logger

func Logger(logger zap.Logger) Option

Logger creates option for New contructor

func ParseThreads

func ParseThreads(threads int) Option

ParseThreads creates option for New contructor

func WriteChan

func WriteChan(ch chan *RowBinary.WriteBuffer) Option

WriteChan creates option for New contructor

type Receiver

type Receiver interface {
	Stat(func(metric string, value float64))
	Stop()
}

func New

func New(dsn string, opts ...Option) (Receiver, error)

New creates udp, tcp, pickle receiver

type TCP

type TCP struct {
	stop.Struct
	// contains filtered or unexported fields
}

TCP receive metrics from TCP connections

func (*TCP) Addr

func (rcv *TCP) Addr() net.Addr

Addr returns binded socket address. For bind port 0 in tests

func (*TCP) HandleConnection

func (rcv *TCP) HandleConnection(conn net.Conn)

func (*TCP) Listen

func (rcv *TCP) Listen(addr *net.TCPAddr) error

Listen bind port. Receive messages and send to out channel

func (*TCP) Stat

func (rcv *TCP) Stat(send func(metric string, value float64))

type UDP

type UDP struct {
	stop.Struct
	// contains filtered or unexported fields
}

UDP receive metrics from UDP messages

func (*UDP) Addr

func (rcv *UDP) Addr() net.Addr

Addr returns binded socket address. For bind port 0 in tests

func (*UDP) Listen

func (rcv *UDP) Listen(addr *net.UDPAddr) error

Listen bind port. Receive messages and send to out channel

func (*UDP) Stat

func (rcv *UDP) Stat(send func(metric string, value float64))

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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