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 TotalProcessCalls int64 ProcessErrorPoints int64 TotalProcessTimeNs int64 CallsInFlight int64 }
Counter records stats on datapoints to go trhough it as a sink middleware
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, log *logrus.Logger) ErrCallback
LogCallback returns a callback that logs an error to logger with msg at Warn
type MiddlewareConstructor ¶
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
}
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
type Sink ¶
A Sink is an object that can accept datapoints 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.