reporter

package
v0.0.0-...-7e90556 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CactusStatterWrapper

type CactusStatterWrapper struct {
	// contains filtered or unexported fields
}

CactusStatterWrapper is a wrapper for a statsd.Statter with a rate for all stats.

func WrapCactusStatter

func WrapCactusStatter(statter statsd.Statter, rate float32) *CactusStatterWrapper

WrapCactusStatter returns a CactusStatterWrapper of the statter at a given rate.

func (*CactusStatterWrapper) GetStatter

func (c *CactusStatterWrapper) GetStatter() statsd.Statter

GetStatter returns the statsd statter as is

func (*CactusStatterWrapper) IncrBy

func (c *CactusStatterWrapper) IncrBy(stat string, value int)

IncrBy reports the stat increment to the wrapped statter at our rate.

func (*CactusStatterWrapper) Timing

func (c *CactusStatterWrapper) Timing(stat string, t time.Duration)

Timing reports the timing to the wrapped statter at our rate.

type FailMode

type FailMode int

FailMode is an enum of the types of failure modes we report.

const (
	None FailMode = iota
	UnableToParseData
	NonTrackingEvent
	BadColumnConversion
	FailedWrite
	EmptyRequest
	SkippedColumn
	UnknownError
	PanickedInProcessing
	FailedTransport
)

See String() for a more verbose explanation of each.

func (FailMode) String

func (m FailMode) String() string

Return a human-readable string describing the given FailMode.

type Reporter

type Reporter interface {
	Record(*Result)
	Report() map[string]int
}

Reporter Records Results and returns stats on them.

func BuildSpadeReporter

func BuildSpadeReporter(trackers []Tracker) Reporter

BuildSpadeReporter builds a SpadeReporter on the given Trackers and starts its goroutine.

type Result

type Result struct {
	Duration   time.Duration
	FinishedAt time.Time
	Failure    FailMode
	UUID       string
	Line       string
	Category   string
}

Result tracks an input record with identifiers, timing information, and failures.

type SpadeReporter

type SpadeReporter struct {
	Trackers []Tracker
	// contains filtered or unexported fields
}

SpadeReporter is a Reporter that also sends stats to external Trackers. It is NOT thread safe.

func (*SpadeReporter) Record

func (r *SpadeReporter) Record(result *Result)

Record sends the given result to all trackers and our stats report.

func (*SpadeReporter) Report

func (r *SpadeReporter) Report() map[string]int

Report returns the current stats report.

type SpadeStatsdTracker

type SpadeStatsdTracker struct {
	Stats StatsLogger
}

SpadeStatsdTracker is a Tracker that reports to statsd.

func (*SpadeStatsdTracker) Track

func (s *SpadeStatsdTracker) Track(result *Result)

Track sends the given result to statsd.

type StatsLogger

type StatsLogger interface {
	Timing(string, time.Duration)
	IncrBy(string, int)
	GetStatter() statsd.Statter
}

StatsLogger is an interface to receive statsd stats.

type Tracker

type Tracker interface {
	Track(*Result)
}

Tracker Tracks Results in some external system.

Jump to

Keyboard shortcuts

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