dpsink

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	TotalProcessErrors int64
	TotalDatapoints    int64
	TotalEvents        int64
	TotalProcessCalls  int64
	ProcessErrorPoints int64
	TotalProcessTimeNs int64
	CallsInFlight      int64
}

Counter records stats on datapoints to go through it as a sink middleware

func (*Counter) AddDatapoints

func (c *Counter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error

AddDatapoints will send points to the next sink and track points send to the next sink

func (*Counter) AddEvents added in v0.7.0

func (c *Counter) AddEvents(ctx context.Context, events []*event.Event, next Sink) error

AddEvents will send events to the next sink and track events sent to the next sink

func (*Counter) Stats

func (c *Counter) Stats(dimensions map[string]string) []*datapoint.Datapoint

Stats related to this c, including errors processing datapoints

type DSink added in v0.8.0

type DSink interface {
	AddDatapoints(ctx context.Context, points []*datapoint.Datapoint) error
}

A DSink is an object that can accept datapoints and do something with them, like forward them to some endpoint

type ESink added in v0.8.0

type ESink interface {
	AddEvents(ctx context.Context, events []*event.Event) error
}

A ESink is an object that can accept events and do something with them, like forward them to some endpoint

type EmptyMetricFilter

type EmptyMetricFilter struct {
	EmptyMetricFiltered int64
}

EmptyMetricFilter filters empty metric name datapoints

func (*EmptyMetricFilter) AddDatapoints

func (e *EmptyMetricFilter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error

AddDatapoints will send points to the next sink that have a non empty metric name

func (*EmptyMetricFilter) FilterDatapoints

func (e *EmptyMetricFilter) FilterDatapoints(points []*datapoint.Datapoint) []*datapoint.Datapoint

FilterDatapoints returns points that have a non empty metric name

type ErrCallback

type ErrCallback func(error)

ErrCallback is the type of callback we expect to execute on RateLimitErrorLogging non rate limited messages

func LogCallback

func LogCallback(msg string, l *log.Logger) ErrCallback

LogCallback returns a callback that logs an error to logger with msg at Warn

type MiddlewareConstructor

type MiddlewareConstructor func(sendTo Sink) Sink

A MiddlewareConstructor is used by FromChain to chain together a bunch of sinks that forward to each other

func NextWrap

func NextWrap(wrapping NextSink) MiddlewareConstructor

NextWrap wraps a NextSink to make it usable by MiddlewareConstructor

type NextSink

type NextSink interface {
	AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error
	AddEvents(ctx context.Context, events []*event.Event, next Sink) error
}

NextSink is a special case of a sink that forwards to another sink

type RateLimitErrorLogging

type RateLimitErrorLogging struct {
	LogThrottle time.Duration
	Callback    ErrCallback
	// contains filtered or unexported fields
}

RateLimitErrorLogging does a logrus log of errors forwarding points in a rate limited manner

func (*RateLimitErrorLogging) AddDatapoints

func (e *RateLimitErrorLogging) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error

AddDatapoints forwards points and will log any errors forwarding, but only one per LogThrottle duration

func (*RateLimitErrorLogging) AddEvents added in v0.7.0

func (e *RateLimitErrorLogging) AddEvents(ctx context.Context, points []*event.Event, next Sink) error

AddEvents forwards points and will log any errors forwarding, but only one per LogThrottle duration

type Sink

type Sink interface {
	DSink
	ESink
}

A Sink is an object that can accept datapoints or events and do something with them, like forward them to some endpoint

func FromChain

func FromChain(endSink Sink, sinks ...MiddlewareConstructor) Sink

FromChain creates an endpoint Sink that sends calls between multiple middlewares for things like counting points in between.

Jump to

Keyboard shortcuts

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