Documentation ¶
Index ¶
- Variables
- type Counter
- func (c *Counter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error
- func (c *Counter) AddEvents(ctx context.Context, events []*event.Event, next Sink) error
- func (c *Counter) AddSpans(ctx context.Context, spans []*trace.Span, next trace.Sink) error
- func (c *Counter) Datapoints() []*datapoint.Datapoint
- type DSink
- type ESink
- type EmptyMetricFilter
- type FlagCheck
- type HistoCounter
- func (h *HistoCounter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error
- func (h *HistoCounter) AddEvents(ctx context.Context, events []*event.Event, next Sink) error
- func (h *HistoCounter) AddSpans(ctx context.Context, spans []*trace.Span, next trace.Sink) error
- func (h *HistoCounter) Datapoints() []*datapoint.Datapoint
- type ItemFlagger
- func (f *ItemFlagger) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error
- func (f *ItemFlagger) AddEvents(ctx context.Context, events []*event.Event, next Sink) error
- func (f *ItemFlagger) AddSpans(ctx context.Context, spans []*trace.Span, next trace.Sink) error
- func (f *ItemFlagger) Datapoints() []*datapoint.Datapoint
- func (f *ItemFlagger) GetDimensions() map[string]string
- func (f *ItemFlagger) HasDatapointFlag(dp *datapoint.Datapoint) bool
- func (f *ItemFlagger) HasEventFlag(ev *event.Event) bool
- func (f *ItemFlagger) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (f *ItemFlagger) SetDatapointFlag(dp *datapoint.Datapoint)
- func (f *ItemFlagger) SetDatapointFlags(ctx context.Context, points []*datapoint.Datapoint)
- func (f *ItemFlagger) SetDimensions(dims map[string]string)
- func (f *ItemFlagger) SetEventFlag(ev *event.Event)
- func (f *ItemFlagger) Var() expvar.Var
- type MiddlewareConstructor
- type NextSink
- type RateLimitErrorLogging
- type Sink
- type WithDimensions
Constants ¶
This section is empty.
Variables ¶
var DefaultLogger = log.DefaultLogger.CreateChild()
DefaultLogger is used by package structs that don't have a default logger set.
var Discard = discardSink{}
Discard is a datapoint sink that does nothing with points it gets
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct { TotalProcessErrors int64 TotalDatapoints int64 TotalEvents int64 TotalSpans int64 TotalProcessCalls int64 ProcessErrorPoints int64 ProcessErrorEvents int64 ProcessErrorSpans int64 TotalProcessTimeNs int64 CallsInFlight int64 Logger log.Logger LoggerFunc func(context.Context) string LoggerKey log.Key DroppedReason string }
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 ¶
AddEvents will send events to the next sink and track events sent to the next sink
func (*Counter) AddSpans ¶ added in v1.1.5
AddSpans will send spans to the next sink and track spans sent to the next sink
func (*Counter) Datapoints ¶
Datapoints returns counter stats
type DSink ¶
A DSink is an object that can accept datapoints and do something with them, like forward them to some endpoint
type ESink ¶
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 HistoCounter ¶ added in v1.1.6
type HistoCounter struct { DatapointBucket *sfxclient.RollingBucket EventBucket *sfxclient.RollingBucket SpanBucket *sfxclient.RollingBucket // contains filtered or unexported fields }
HistoCounter wraps a Counter with a histogram around batch sizes
func NewHistoCounter ¶ added in v1.1.6
func NewHistoCounter(sink *Counter) *HistoCounter
NewHistoCounter is a constructor
func (*HistoCounter) AddDatapoints ¶ added in v1.1.6
func (h *HistoCounter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error
AddDatapoints sample length of slice and pass on
func (*HistoCounter) Datapoints ¶ added in v1.1.6
func (h *HistoCounter) Datapoints() []*datapoint.Datapoint
Datapoints is rather self explanitory
type ItemFlagger ¶
type ItemFlagger struct { CtxFlagCheck FlagCheck Logger log.Logger EventMetaName string SpanMetaName string MetricDimensionName string // contains filtered or unexported fields }
ItemFlagger will flag events and datapoints according to which dimensions are set or if the connection context has a flag set.
func (*ItemFlagger) AddDatapoints ¶
func (f *ItemFlagger) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error
AddDatapoints adds a signal to each datapoint if the signal is inside the context
func (*ItemFlagger) AddEvents ¶
AddEvents adds a signal to each event if the signal is inside the context
func (*ItemFlagger) Datapoints ¶
func (f *ItemFlagger) Datapoints() []*datapoint.Datapoint
Datapoints returns debug stat information about the flagger
func (*ItemFlagger) GetDimensions ¶
func (f *ItemFlagger) GetDimensions() map[string]string
GetDimensions returns which dimensions are flagged
func (*ItemFlagger) HasDatapointFlag ¶
func (f *ItemFlagger) HasDatapointFlag(dp *datapoint.Datapoint) bool
HasDatapointFlag return true if the datapoint is connected to this item
func (*ItemFlagger) HasEventFlag ¶
func (f *ItemFlagger) HasEventFlag(ev *event.Event) bool
HasEventFlag return true if the event is connected to this item
func (*ItemFlagger) ServeHTTP ¶
func (f *ItemFlagger) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP supports GET to see the current dimensions and POST to change the current dimensions. POST expects (and GET returns) a JSON encoded map[string]string
func (*ItemFlagger) SetDatapointFlag ¶
func (f *ItemFlagger) SetDatapointFlag(dp *datapoint.Datapoint)
SetDatapointFlag flags the datapoint as connected to this flagger
func (*ItemFlagger) SetDatapointFlags ¶
func (f *ItemFlagger) SetDatapointFlags(ctx context.Context, points []*datapoint.Datapoint)
SetDatapointFlags sets the log flag for every datapoint if the signal is inside the context
func (*ItemFlagger) SetDimensions ¶
func (f *ItemFlagger) SetDimensions(dims map[string]string)
SetDimensions controls which dimensions are flagged
func (*ItemFlagger) SetEventFlag ¶
func (f *ItemFlagger) SetEventFlag(ev *event.Event)
SetEventFlag flags the event as connected to this flagger
func (*ItemFlagger) Var ¶
func (f *ItemFlagger) Var() expvar.Var
Var returns the dimensions that are being filtered
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 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 Logger log.Logger // contains filtered or unexported fields }
RateLimitErrorLogging does a 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 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.
type WithDimensions ¶
WithDimensions adds dimensions on top of the datapoints of a collector
func (*WithDimensions) AddDatapoints ¶
func (w *WithDimensions) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error
AddDatapoints calls next() including the wrapped dimensions on each point