Documentation
¶
Index ¶
- Variables
- func ChanExecutor(fn GraphiteReturner, jobQueue <-chan *m.AlertingJob, cache *lru.Cache)
- func Construct()
- func Dispatcher()
- func GraphiteAuthContextReturner(org_id int64) (bgraphite.Context, error)
- func Init(metrics met.Backend)
- func InitJobQueue(jobQueue chan<- *m.AlertingJob)
- func InitResultHandler()
- func LoadOrSetOffset() int
- func ProcessResult(job *m.AlertingJob)
- func PublishJob(job *m.AlertingJob) error
- func StoreResult(job *m.AlertingJob)
- type Check
- type CheckEvaluator
- type GraphiteCheckEvaluator
- type GraphiteReturner
- type Ticker
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 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 Init ¶
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 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 (*GraphiteCheckEvaluator) Eval ¶
func (ce *GraphiteCheckEvaluator) Eval(ts time.Time) (m.CheckEvalResult, error)
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 Ticker ¶
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
Source Files
¶
Click to show internal directories.
Click to hide internal directories.