receiver

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 37 Imported by: 3

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 RemoveDoubleDot

func RemoveDoubleDot(p []byte) []byte

func TelegrafEncodeTags added in v0.9.0

func TelegrafEncodeTags(tags map[string]string) string

Types

type Base added in v0.9.0

type Base struct {
	stop.Struct

	Tags tags.TagConfig
	// contains filtered or unexported fields
}

func (*Base) DroppedHandler added in v0.9.1

func (base *Base) DroppedHandler(w http.ResponseWriter, r *http.Request)

func (*Base) Init added in v0.11.7

func (base *Base) Init(logger *zap.Logger, config tags.TagConfig, opts ...Option)

func (*Base) PickleParseBytes added in v0.9.0

func (base *Base) PickleParseBytes(ctx context.Context, b []byte, now uint32)

func (*Base) PickleParser added in v0.9.0

func (base *Base) PickleParser(ctx context.Context, in chan []byte)

func (*Base) PlainParseBuffer added in v0.9.0

func (base *Base) PlainParseBuffer(ctx context.Context, b *Buffer, buf *tags.GraphiteBuf)

func (*Base) PlainParseLine added in v0.10.0

func (base *Base) PlainParseLine(p []byte, now uint32, buf *tags.GraphiteBuf) ([]byte, float64, uint32, error)

func (*Base) PlainParser added in v0.9.0

func (base *Base) PlainParser(ctx context.Context, in chan *Buffer)

func (*Base) SendStat added in v0.9.0

func (base *Base) SendStat(send func(metric string, value float64), fields ...string)

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 GRPC added in v0.6.1

type GRPC struct {
	Base
	// contains filtered or unexported fields
}

GRPC receive metrics from GRPC connections

func (*GRPC) Addr added in v0.6.1

func (g *GRPC) Addr() net.Addr

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

func (*GRPC) Listen added in v0.6.1

func (g *GRPC) Listen(addr *net.TCPAddr) error

Listen bind port. Receive messages and send to out channel

func (*GRPC) Stat added in v0.6.1

func (g *GRPC) Stat(send func(metric string, value float64))

func (*GRPC) Store added in v0.6.1

func (g *GRPC) Store(ctx context.Context, in *pb.Payload) (*empty.Empty, error)

func (*GRPC) StoreSync added in v0.6.1

func (g *GRPC) StoreSync(ctx context.Context, in *pb.Payload) (*empty.Empty, error)

type Option

type Option func(interface{}) error

func ConcatChar added in v0.11.2

func ConcatChar(concat string) Option

ConcatChar creates option for New constructor

func DropFuture added in v0.9.0

func DropFuture(seconds uint32) Option

DropFuture creates option for New contructor

func DropLongerThan added in v0.11.2

func DropLongerThan(maximumLength uint16) Option

DropLongerThan creates option for New constructor

func DropPast added in v0.9.0

func DropPast(seconds uint32) Option

DropPast creates option for New contructor

func ParseThreads

func ParseThreads(threads int) Option

ParseThreads creates option for New contructor

func ReadTimeout added in v0.11.0

func ReadTimeout(seconds uint32) Option

ReadTimeout creates option for New constructor

func WriteChan

func WriteChan(ch chan *RowBinary.WriteBuffer) Option

WriteChan creates option for New contructor

type Pickle added in v0.6.1

type Pickle struct {
	Base
	// contains filtered or unexported fields
}

Pickle receive metrics from TCP connections

func (*Pickle) Addr added in v0.6.1

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

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

func (*Pickle) HandleConnection added in v0.6.1

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

func (*Pickle) Listen added in v0.6.1

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

Listen bind port. Receive messages and send to out channel

func (*Pickle) Stat added in v0.6.1

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

type PrometheusRemoteWrite added in v0.7.0

type PrometheusRemoteWrite struct {
	Base
	// contains filtered or unexported fields
}

func (*PrometheusRemoteWrite) Addr added in v0.7.0

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

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

func (*PrometheusRemoteWrite) Listen added in v0.7.0

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

Listen bind port. Receive messages and send to out channel

func (*PrometheusRemoteWrite) ServeHTTP added in v0.7.0

func (rcv *PrometheusRemoteWrite) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*PrometheusRemoteWrite) Stat added in v0.7.0

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

type Receiver

type Receiver interface {
	Stat(func(metric string, value float64))
	DroppedHandler(w http.ResponseWriter, r *http.Request)
	Stop()
}

func New

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

New creates udp, tcp, pickle receiver

type TCP

type TCP struct {
	Base
	// 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 TelegrafHttpJson added in v0.9.0

type TelegrafHttpJson struct {
	Base
	// contains filtered or unexported fields
}

func (*TelegrafHttpJson) Addr added in v0.9.0

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

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

func (*TelegrafHttpJson) Listen added in v0.9.0

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

Listen bind port. Receive messages and send to out channel

func (*TelegrafHttpJson) ServeHTTP added in v0.9.0

func (rcv *TelegrafHttpJson) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*TelegrafHttpJson) Stat added in v0.9.0

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

type TelegrafHttpMetric added in v0.9.0

type TelegrafHttpMetric struct {
	Name      string                 `json:"name"`
	Timestamp int64                  `json:"timestamp"`
	Fields    map[string]interface{} `json:"fields"`
	Tags      map[string]string      `json:"tags"`
}

type TelegrafHttpPayload added in v0.9.0

type TelegrafHttpPayload struct {
	Metrics []TelegrafHttpMetric `json:"metrics"`
}

type UDP

type UDP struct {
	Base
	// 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