alerting

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

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

Go to latest
Published: Jun 30, 2016 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ResultQueue chan *m.AlertingJob
)

Functions

func ChanExecutor

func ChanExecutor(fn GraphiteReturner, jobQueue <-chan *m.AlertingJob, cache *lru.Cache)

func Construct

func Construct()

func Dispatcher

func Dispatcher()

Dispatcher dispatches, every second, all jobs that should run for that second every job has an id so that you can run multiple dispatchers (for HA) while still only processing each job once. (provided jobs get consistently routed to executors)

func GraphiteAuthContextReturner

func GraphiteAuthContextReturner(org_id int64) (bgraphite.Context, error)

func Init

func Init(metrics met.Backend)

Init initalizes all metrics run this function when statsd is ready, so we can create the series

func InitJobQueue

func InitJobQueue(jobQueue chan<- *m.AlertingJob)

func InitResultHandler

func InitResultHandler()

func LoadOrSetOffset

func LoadOrSetOffset() int

func ProcessResult

func ProcessResult(job *m.AlertingJob)

func PublishJob

func PublishJob(job *m.AlertingJob) error

func StoreResult

func StoreResult(job *m.AlertingJob)

Types

type Check

type Check struct {
	// do we need these members here?
	//Id           int64
	//OrgId        int64
	//DataSourceId int64
	Definition m.CheckDef
}

type CheckEvaluator

type CheckEvaluator interface {
	Eval() (*m.CheckEvalResult, error)
}

type GraphiteCheckEvaluator

type GraphiteCheckEvaluator struct {
	Context graphite.Context
	Check   m.CheckDef
	// contains filtered or unexported fields
}

func NewGraphiteCheckEvaluator

func NewGraphiteCheckEvaluator(c graphite.Context, check m.CheckDef) (*GraphiteCheckEvaluator, error)

func (*GraphiteCheckEvaluator) Eval

TODO instrument error scenarios Eval evaluates the crit/warn expression and returns the result, and any non-fatal error (implying the query should be retried later, when a temporary infra problem restores) as well as fatal errors.

type GraphiteReturner

type GraphiteReturner func(org_id int64) (bgraphite.Context, error)

type Ticker

type Ticker struct {
	C chan time.Time
	// contains filtered or unexported fields
}

ticker is a ticker to power the alerting scheduler. it's like a time.Ticker, except:

  • it doesn't drop ticks for slow receivers, rather, it queues up. so that callers are in control to instrument what's going on.
  • it automatically ticks every second, which is the right thing in our current design
  • it ticks on second marks or very shortly after. this provides a predictable load pattern (this shouldn't cause too much load contention issues because the next steps in the pipeline just process at their own pace)
  • the timestamps are used to mark "last datapoint to query for" and as such, are a configurable amount of seconds in the past
  • because we want to allow:
  • a clean "resume where we left off" and "don't yield ticks we already did"
  • adjusting offset over time to compensate for storage backing up or getting fast and providing lower latency you specify a lastProcessed timestamp as well as an offset at creation, or runtime

func NewTicker

func NewTicker(last time.Time, initialOffset time.Duration, c clock.Clock) *Ticker

NewTicker returns a ticker that ticks on second marks or very shortly after, and never drops ticks

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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