Documentation ¶
Index ¶
- Variables
- type CompletionStatus
- type ErrorCounter
- type EventReceiver
- type HealthAggregationsResponse
- type IntervalAggregation
- type Job
- func (j *Job) Complete(status CompletionStatus)
- func (j *Job) CompleteKv(status CompletionStatus, kvs map[string]string)
- func (j *Job) Event(eventName string)
- func (j *Job) EventErr(eventName string, err error) error
- func (j *Job) EventErrKv(eventName string, err error, kvs map[string]string) error
- func (j *Job) EventKv(eventName string, kvs map[string]string)
- func (j *Job) Gauge(eventName string, value float64)
- func (j *Job) GaugeKv(eventName string, value float64, kvs map[string]string)
- func (j *Job) KeyValue(key string, value string) *Job
- func (j *Job) Run(f func() error) (err error)
- func (j *Job) Timing(eventName string, nanoseconds int64)
- func (j *Job) TimingKv(eventName string, nanoseconds int64, kvs map[string]string)
- type JobAggregation
- type JsonPollingSink
- func (s *JsonPollingSink) EmitComplete(job string, status CompletionStatus, nanos int64, kvs map[string]string)
- func (s *JsonPollingSink) EmitEvent(job string, event string, kvs map[string]string)
- func (s *JsonPollingSink) EmitEventErr(job string, event string, inputErr error, kvs map[string]string)
- func (s *JsonPollingSink) EmitGauge(job string, event string, value float64, kvs map[string]string)
- func (s *JsonPollingSink) EmitTiming(job string, event string, nanos int64, kvs map[string]string)
- func (s *JsonPollingSink) GetMetrics() []*IntervalAggregation
- func (s *JsonPollingSink) ServeHTTP(rw http.ResponseWriter, r *http.Request)
- func (s *JsonPollingSink) ShutdownServer()
- func (s *JsonPollingSink) StartServer(addr string)
- type JsonWriterSink
- func (j *JsonWriterSink) EmitComplete(job string, status CompletionStatus, nanoseconds int64, kvs map[string]string)
- func (j *JsonWriterSink) EmitEvent(job string, event string, kvs map[string]string)
- func (j *JsonWriterSink) EmitEventErr(job string, event string, err error, kvs map[string]string)
- func (j *JsonWriterSink) EmitGauge(job string, event string, value float64, kvs map[string]string)
- func (j *JsonWriterSink) EmitTiming(job string, event string, nanoseconds int64, kvs map[string]string)
- type Kvs
- type MutedError
- type Sink
- type StatsDSink
- func (s *StatsDSink) Drain()
- func (s *StatsDSink) EmitComplete(job string, status CompletionStatus, nanos int64, kvs map[string]string)
- func (s *StatsDSink) EmitEvent(job string, event string, kvs map[string]string)
- func (s *StatsDSink) EmitEventErr(job string, event string, inputErr error, kvs map[string]string)
- func (s *StatsDSink) EmitGauge(job string, event string, value float64, kvs map[string]string)
- func (s *StatsDSink) EmitTiming(job string, event string, nanos int64, kvs map[string]string)
- func (s *StatsDSink) Stop()
- type StatsDSinkOptions
- type StatsDSinkSanitizationFunc
- type Stream
- type TimerAggregation
- type UnmutedError
- type WriterSink
- func (s *WriterSink) EmitComplete(job string, status CompletionStatus, nanos int64, kvs map[string]string)
- func (s *WriterSink) EmitEvent(job string, event string, kvs map[string]string)
- func (s *WriterSink) EmitEventErr(job string, event string, inputErr error, kvs map[string]string)
- func (s *WriterSink) EmitGauge(job string, event string, value float64, kvs map[string]string)
- func (s *WriterSink) EmitTiming(job string, event string, nanos int64, kvs map[string]string)
Constants ¶
This section is empty.
Variables ¶
View Source
var Identifier = getIdentifier()
Functions ¶
This section is empty.
Types ¶
type CompletionStatus ¶
type CompletionStatus int
const ( Success CompletionStatus = iota ValidationError Panic Error Junk )
func (CompletionStatus) String ¶
func (cs CompletionStatus) String() string
type ErrorCounter ¶
type ErrorCounter struct { Count int64 `json:"count"` // contains filtered or unexported fields }
func (*ErrorCounter) Clone ¶
func (ec *ErrorCounter) Clone() *ErrorCounter
type EventReceiver ¶
type EventReceiver interface { Event(eventName string) EventKv(eventName string, kvs map[string]string) EventErr(eventName string, err error) error EventErrKv(eventName string, err error, kvs map[string]string) error Timing(eventName string, nanoseconds int64) TimingKv(eventName string, nanoseconds int64, kvs map[string]string) Gauge(eventName string, value float64) GaugeKv(eventName string, value float64, kvs map[string]string) }
type HealthAggregationsResponse ¶
type HealthAggregationsResponse struct { InstanceId string `json:"instance_id"` IntervalDuration time.Duration `json:"interval_duration"` IntervalAggregations []*IntervalAggregation `json:"aggregations"` }
type IntervalAggregation ¶
type IntervalAggregation struct { // The start time of the interval IntervalStart time.Time `json:"interval_start"` // SerialNumber increments every time the aggregation changes. It does not increment if the aggregation does not change. SerialNumber int64 `json:"serial_number"` // Jobs hold a map of job name -> data about that job. // This includes both primary-job information (success vs error, et all) as well as // scoping timers/counters by the job. Jobs map[string]*JobAggregation `json:"jobs"` // contains filtered or unexported fields }
IntervalAggregation will hold data for a given aggregation interval.
func NewIntervalAggregation ¶
func NewIntervalAggregation(intervalStart time.Time) *IntervalAggregation
func (*IntervalAggregation) Clone ¶
func (ia *IntervalAggregation) Clone() *IntervalAggregation
Clone does a deep clone of ia, duplicating all maps and whatnot.
func (*IntervalAggregation) Merge ¶
func (ia *IntervalAggregation) Merge(intAgg *IntervalAggregation)
Merge merges intAgg into ia, mutating ia. Requires that ia and intAgg are a fully valid with no nil maps.
type Job ¶
func (*Job) Complete ¶
func (j *Job) Complete(status CompletionStatus)
func (*Job) CompleteKv ¶
func (j *Job) CompleteKv(status CompletionStatus, kvs map[string]string)
func (*Job) EventErrKv ¶
type JobAggregation ¶
type JobAggregation struct { TimerAggregation CountSuccess int64 `json:"count_success"` CountValidationError int64 `json:"count_validation_error"` CountPanic int64 `json:"count_panic"` CountError int64 `json:"count_error"` CountJunk int64 `json:"count_junk"` // contains filtered or unexported fields }
func (*JobAggregation) Clone ¶
func (ja *JobAggregation) Clone() *JobAggregation
type JsonPollingSink ¶
type JsonPollingSink struct {
// contains filtered or unexported fields
}
func NewJsonPollingSink ¶
func NewJsonPollingSink(intervalDuration time.Duration, retain time.Duration) *JsonPollingSink
func (*JsonPollingSink) EmitComplete ¶
func (s *JsonPollingSink) EmitComplete(job string, status CompletionStatus, nanos int64, kvs map[string]string)
func (*JsonPollingSink) EmitEvent ¶
func (s *JsonPollingSink) EmitEvent(job string, event string, kvs map[string]string)
func (*JsonPollingSink) EmitEventErr ¶
func (*JsonPollingSink) EmitTiming ¶
func (*JsonPollingSink) GetMetrics ¶
func (s *JsonPollingSink) GetMetrics() []*IntervalAggregation
func (*JsonPollingSink) ServeHTTP ¶
func (s *JsonPollingSink) ServeHTTP(rw http.ResponseWriter, r *http.Request)
func (*JsonPollingSink) ShutdownServer ¶
func (s *JsonPollingSink) ShutdownServer()
func (*JsonPollingSink) StartServer ¶
func (s *JsonPollingSink) StartServer(addr string)
type JsonWriterSink ¶
func (*JsonWriterSink) EmitComplete ¶
func (j *JsonWriterSink) EmitComplete(job string, status CompletionStatus, nanoseconds int64, kvs map[string]string)
func (*JsonWriterSink) EmitEvent ¶
func (j *JsonWriterSink) EmitEvent(job string, event string, kvs map[string]string)
func (*JsonWriterSink) EmitEventErr ¶
func (*JsonWriterSink) EmitTiming ¶
type Kvs ¶
This is primarily used as syntactic sugar for libs outside this app for passing in maps easily. We don't rely on it internally b/c I don't want to tie interfaces to the 'health' package.
type MutedError ¶
type MutedError struct {
Err error
}
func Mute ¶
func Mute(err error) *MutedError
func (*MutedError) Error ¶
func (e *MutedError) Error() string
type Sink ¶
type Sink interface { EmitEvent(job string, event string, kvs map[string]string) EmitEventErr(job string, event string, err error, kvs map[string]string) EmitTiming(job string, event string, nanoseconds int64, kvs map[string]string) EmitComplete(job string, status CompletionStatus, nanoseconds int64, kvs map[string]string) EmitGauge(job string, event string, value float64, kvs map[string]string) }
type StatsDSink ¶
type StatsDSink struct {
// contains filtered or unexported fields
}
func NewStatsDSink ¶
func NewStatsDSink(addr string, options *StatsDSinkOptions) (*StatsDSink, error)
func (*StatsDSink) Drain ¶
func (s *StatsDSink) Drain()
func (*StatsDSink) EmitComplete ¶
func (s *StatsDSink) EmitComplete(job string, status CompletionStatus, nanos int64, kvs map[string]string)
func (*StatsDSink) EmitEvent ¶
func (s *StatsDSink) EmitEvent(job string, event string, kvs map[string]string)
func (*StatsDSink) EmitEventErr ¶
func (*StatsDSink) EmitTiming ¶
func (*StatsDSink) Stop ¶
func (s *StatsDSink) Stop()
type StatsDSinkOptions ¶
type StatsDSinkOptions struct { // Prefix is something like "metroid" // Events emitted to StatsD would be metroid.myevent.wat // Eg, don't include a trailing dot in the prefix. // It can be "", that's fine. Prefix string // SanitizationFunc sanitizes jobs and events before sending them to statsd SanitizationFunc StatsDSinkSanitizationFunc // SkipNestedEvents will skip {events,timers,gauges} from sending the job.event version // and will only send the event version. SkipNestedEvents bool // SkipTopLevelEvents will skip {events,timers,gauges} from sending the event version // and will only send the job.event version. SkipTopLevelEvents bool }
type TimerAggregation ¶
type TimerAggregation struct { Count int64 `json:"count"` NanosSum int64 `json:"nanos_sum"` NanosSumSquares float64 `json:"nanos_sum_squares"` // 3seconds^2 overflows an int64 NanosMin int64 `json:"nanos_min"` NanosMax int64 `json:"nanos_max"` }
func (*TimerAggregation) Clone ¶
func (ta *TimerAggregation) Clone() *TimerAggregation
type UnmutedError ¶
func (*UnmutedError) Error ¶
func (e *UnmutedError) Error() string
type WriterSink ¶
This sink writes bytes in a format that a human might like to read in a logfile This can be used to log to Stdout:
.AddSink(&WriterSink{os.Stdout})
And to a file:
f, err := os.OpenFile(fname, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) .AddSink(&WriterSink{f})
And to syslog:
w, err := syslog.New(LOG_INFO, "wat") .AddSink(&WriterSink{w})
func (*WriterSink) EmitComplete ¶
func (s *WriterSink) EmitComplete(job string, status CompletionStatus, nanos int64, kvs map[string]string)
func (*WriterSink) EmitEvent ¶
func (s *WriterSink) EmitEvent(job string, event string, kvs map[string]string)
func (*WriterSink) EmitEventErr ¶
func (*WriterSink) EmitTiming ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.