diff --git a/cmd/bosun/expr/elastic.go b/cmd/bosun/expr/elastic.go index e708fece85..ed632826b3 100644 --- a/cmd/bosun/expr/elastic.go +++ b/cmd/bosun/expr/elastic.go @@ -286,10 +286,10 @@ func timeESRequest(e *State, T miniprofiler.Timer, req *ElasticRequest) (resp *e } T.StepCustomTiming("elastic", "query", string(b), func() { getFn := func() (interface{}, error) { - return e.elasticHosts.Query(req) + return e.ElasticHosts.Query(req) } var val interface{} - val, err = e.cache.Get(string(b), getFn) + val, err = e.Cache.Get(string(b), getFn) resp = val.(*elastic.SearchResult) }) return @@ -314,14 +314,14 @@ func ESLS(e *State, T miniprofiler.Timer, indexRoot string) (*Results, error) { func ESDaily(e *State, T miniprofiler.Timer, timeField, indexRoot, layout string) (*Results, error) { var r Results - err := e.elasticHosts.InitClient() + err := e.ElasticHosts.InitClient() if err != nil { return &r, err } indexer := ESIndexer{} indexer.TimeField = timeField indexer.Generate = func(start, end *time.Time) ([]string, error) { - err := e.elasticHosts.InitClient() + err := e.ElasticHosts.InitClient() if err != nil { return []string{}, err } @@ -365,7 +365,7 @@ func ESStat(e *State, T miniprofiler.Timer, indexer ESIndexer, keystring string, func ESDateHistogram(e *State, T miniprofiler.Timer, indexer ESIndexer, keystring string, filter elastic.Query, interval, sduration, eduration, stat_field, rstat string, size int) (r *Results, err error) { r = new(Results) - req, err := ESBaseQuery(e.now, indexer, e.elasticHosts, filter, sduration, eduration, size) + req, err := ESBaseQuery(e.now, indexer, filter, sduration, eduration, size) if err != nil { return nil, err } @@ -423,7 +423,7 @@ func ESDateHistogram(e *State, T miniprofiler.Timer, indexer ESIndexer, keystrin var desc func(*elastic.AggregationBucketKeyItem, opentsdb.TagSet, []string) error desc = func(b *elastic.AggregationBucketKeyItem, tags opentsdb.TagSet, keys []string) error { if ts, found := b.DateHistogram("ts"); found { - if e.squelched(tags) { + if e.Squelched(tags) { return nil } series := make(Series) @@ -467,7 +467,7 @@ func ESDateHistogram(e *State, T miniprofiler.Timer, indexer ESIndexer, keystrin } // ESBaseQuery builds the base query that both ESCount and ESStat share -func ESBaseQuery(now time.Time, indexer ESIndexer, l ElasticHosts, filter elastic.Query, sduration, eduration string, size int) (*ElasticRequest, error) { +func ESBaseQuery(now time.Time, indexer ESIndexer, filter elastic.Query, sduration, eduration string, size int) (*ElasticRequest, error) { start, err := opentsdb.ParseDuration(sduration) if err != nil { return nil, err diff --git a/cmd/bosun/expr/expr.go b/cmd/bosun/expr/expr.go index f67b6f7f37..cd2da289dc 100644 --- a/cmd/bosun/expr/expr.go +++ b/cmd/bosun/expr/expr.go @@ -26,33 +26,38 @@ import ( type State struct { *Expr now time.Time - cache *cache.Cache enableComputations bool + unjoinedOk bool + autods int - // OpenTSDB - Search *search.Search - autods int - tsdbContext opentsdb.Context - tsdbQueries []opentsdb.Request - unjoinedOk bool - squelched func(tags opentsdb.TagSet) bool + *Backends + + // Bosun Internal + *BosunProviders // Graphite graphiteQueries []graphite.Request - graphiteContext graphite.Context - // LogstashElastic (for pre ES v2) logstashQueries []elasticOld.SearchSource - logstashHosts LogstashElasticHosts - // Elastic (for post ES v2) elasticQueries []elastic.SearchSource - elasticHosts ElasticHosts + // OpenTSDB + tsdbQueries []opentsdb.Request +} - // InfluxDB - InfluxConfig client.Config +type Backends struct { + TSDBContext opentsdb.Context + GraphiteContext graphite.Context + LogstashHosts LogstashElasticHosts + ElasticHosts ElasticHosts + InfluxConfig client.Config +} - History AlertStatusProvider +type BosunProviders struct { + Squelched func(tags opentsdb.TagSet) bool + Search *search.Search + History AlertStatusProvider + Cache *cache.Cache } // Alert Status Provider is used to provide information about alert results. @@ -85,26 +90,19 @@ func New(expr string, funcs ...map[string]parse.Func) (*Expr, error) { // Execute applies a parse expression to the specified OpenTSDB context, and // returns one result per group. T may be nil to ignore timings. -func (e *Expr) Execute(c opentsdb.Context, g graphite.Context, l LogstashElasticHosts, eh ElasticHosts, influxConfig client.Config, cache *cache.Cache, T miniprofiler.Timer, now time.Time, autods int, unjoinedOk bool, search *search.Search, squelched func(tags opentsdb.TagSet) bool, history AlertStatusProvider) (r *Results, queries []opentsdb.Request, err error) { - if squelched == nil { - squelched = func(tags opentsdb.TagSet) bool { +func (e *Expr) Execute(backends *Backends, providers *BosunProviders, T miniprofiler.Timer, now time.Time, autods int, unjoinedOk bool) (r *Results, queries []opentsdb.Request, err error) { + if providers.Squelched == nil { + providers.Squelched = func(tags opentsdb.TagSet) bool { return false } } s := &State{ - Expr: e, - cache: cache, - tsdbContext: c, - graphiteContext: g, - logstashHosts: l, - elasticHosts: eh, - InfluxConfig: influxConfig, - now: now, - autods: autods, - unjoinedOk: unjoinedOk, - Search: search, - squelched: squelched, - History: history, + Expr: e, + now: now, + autods: autods, + unjoinedOk: unjoinedOk, + Backends: backends, + BosunProviders: providers, } return e.ExecuteState(s, T) } diff --git a/cmd/bosun/expr/expr_test.go b/cmd/bosun/expr/expr_test.go index de337e41d3..dffe77b99a 100644 --- a/cmd/bosun/expr/expr_test.go +++ b/cmd/bosun/expr/expr_test.go @@ -64,7 +64,11 @@ func TestExprSimple(t *testing.T) { t.Error(err) break } - r, _, err := e.Execute(nil, nil, nil, nil, client.Config{}, nil, nil, time.Now(), 0, false, nil, nil, nil) + backends := &Backends{ + InfluxConfig: client.Config{}, + } + providers := &BosunProviders{} + r, _, err := e.Execute(backends, providers, nil, time.Now(), 0, false) if err != nil { t.Error(err) break @@ -205,7 +209,12 @@ func TestQueryExpr(t *testing.T) { if err != nil { t.Fatal(err) } - results, _, err := e.Execute(&opentsdb.LimitContext{Host: u.Host, Limit: 1e10, TSDBVersion: opentsdb.Version2_1}, nil, nil, nil, client.Config{}, nil, nil, queryTime, 0, false, nil, nil, nil) + backends := &Backends{ + TSDBContext: &opentsdb.LimitContext{Host: u.Host, Limit: 1e10, TSDBVersion: opentsdb.Version2_1}, + InfluxConfig: client.Config{}, + } + providers := &BosunProviders{} + results, _, err := e.Execute(backends, providers, nil, queryTime, 0, false) if err != nil { t.Fatal(err) } diff --git a/cmd/bosun/expr/funcs_test.go b/cmd/bosun/expr/funcs_test.go index 19d8ed2b73..102a2f3b2c 100644 --- a/cmd/bosun/expr/funcs_test.go +++ b/cmd/bosun/expr/funcs_test.go @@ -20,7 +20,11 @@ func testExpression(eio exprInOut) error { if err != nil { return err } - r, _, err := e.Execute(nil, nil, nil, nil, client.Config{}, nil, nil, time.Now(), 0, false, nil, nil, nil) + backends := &Backends{ + InfluxConfig: client.Config{}, + } + providers := &BosunProviders{} + r, _, err := e.Execute(backends, providers, nil, queryTime, 0, false) if err != nil { return err } diff --git a/cmd/bosun/expr/graphite.go b/cmd/bosun/expr/graphite.go index 4e72e0dccb..ed6297cac5 100644 --- a/cmd/bosun/expr/graphite.go +++ b/cmd/bosun/expr/graphite.go @@ -215,10 +215,10 @@ func timeGraphiteRequest(e *State, T miniprofiler.Timer, req *graphite.Request) T.StepCustomTiming("graphite", "query", string(b), func() { key := req.CacheKey() getFn := func() (interface{}, error) { - return e.graphiteContext.Query(req) + return e.GraphiteContext.Query(req) } var val interface{} - val, err = e.cache.Get(key, getFn) + val, err = e.Cache.Get(key, getFn) resp = val.(graphite.Response) }) return diff --git a/cmd/bosun/expr/influx.go b/cmd/bosun/expr/influx.go index 7f40411254..f927eda232 100644 --- a/cmd/bosun/expr/influx.go +++ b/cmd/bosun/expr/influx.go @@ -53,7 +53,7 @@ func InfluxQuery(e *State, T miniprofiler.Timer, db, query, startDuration, endDu r := new(Results) for _, row := range qres { tags := opentsdb.TagSet(row.Tags) - if e.squelched(tags) { + if e.Squelched(tags) { continue } if len(row.Columns) != 2 { @@ -216,7 +216,7 @@ func timeInfluxRequest(e *State, T miniprofiler.Timer, db, query, startDuration, } var val interface{} var ok bool - val, err = e.cache.Get(q, getFn) + val, err = e.Cache.Get(q, getFn) if s, ok = val.([]influxModels.Row); !ok { err = fmt.Errorf("influx: did not get a valid result from InfluxDB") } diff --git a/cmd/bosun/expr/influx_test.go b/cmd/bosun/expr/influx_test.go index 263ccaa443..b083be3494 100644 --- a/cmd/bosun/expr/influx_test.go +++ b/cmd/bosun/expr/influx_test.go @@ -52,10 +52,14 @@ func TestInfluxQueryDuration(t *testing.T) { func TestInfluxQuery(t *testing.T) { e := State{ - now: time.Date(2015, time.February, 25, 0, 0, 0, 0, time.UTC), - InfluxConfig: client.Config{}, - squelched: func(tags opentsdb.TagSet) bool { - return false + now: time.Date(2015, time.February, 25, 0, 0, 0, 0, time.UTC), + Backends: &Backends{ + InfluxConfig: client.Config{}, + }, + BosunProviders: &BosunProviders{ + Squelched: func(tags opentsdb.TagSet) bool { + return false + }, }, } _, err := InfluxQuery(&e, new(miniprofiler.Profile), "db", "select * from alh limit 10", "1n", "", "") diff --git a/cmd/bosun/expr/logstash.go b/cmd/bosun/expr/logstash.go index 6f8616bdfa..f28e5f9412 100644 --- a/cmd/bosun/expr/logstash.go +++ b/cmd/bosun/expr/logstash.go @@ -107,10 +107,10 @@ func timeLSRequest(e *State, T miniprofiler.Timer, req *LogstashRequest) (resp * b, _ := json.MarshalIndent(req.Source.Source(), "", " ") T.StepCustomTiming("logstash", "query", string(b), func() { getFn := func() (interface{}, error) { - return e.logstashHosts.Query(req) + return e.LogstashHosts.Query(req) } var val interface{} - val, err = e.cache.Get(string(b), getFn) + val, err = e.Cache.Get(string(b), getFn) resp = val.(*elastic.SearchResult) }) return @@ -206,7 +206,7 @@ func LSStat(e *State, T miniprofiler.Timer, index_root, keystring, filter, field // that Bosun can understand func LSDateHistogram(e *State, T miniprofiler.Timer, index_root, keystring, filter, interval, sduration, eduration, stat_field, rstat string, size int) (r *Results, err error) { r = new(Results) - req, err := LSBaseQuery(e.now, index_root, e.logstashHosts, keystring, filter, sduration, eduration, size) + req, err := LSBaseQuery(e.now, index_root, keystring, filter, sduration, eduration, size) if err != nil { return nil, err } @@ -264,7 +264,7 @@ func LSDateHistogram(e *State, T miniprofiler.Timer, index_root, keystring, filt var desc func(*elastic.AggregationBucketKeyItem, opentsdb.TagSet, []lsKeyMatch) error desc = func(b *elastic.AggregationBucketKeyItem, tags opentsdb.TagSet, keys []lsKeyMatch) error { if ts, found := b.DateHistogram("ts"); found { - if e.squelched(tags) { + if e.Squelched(tags) { return nil } series := make(Series) @@ -339,7 +339,7 @@ func processBucketItem(b *elastic.AggregationBucketHistogramItem, rstat string) } // LSBaseQuery builds the base query that both LSCount and LSStat share -func LSBaseQuery(now time.Time, indexRoot string, l LogstashElasticHosts, keystring string, filter, sduration, eduration string, size int) (*LogstashRequest, error) { +func LSBaseQuery(now time.Time, indexRoot string, keystring string, filter, sduration, eduration string, size int) (*LogstashRequest, error) { start, err := opentsdb.ParseDuration(sduration) if err != nil { return nil, err diff --git a/cmd/bosun/expr/tsdb.go b/cmd/bosun/expr/tsdb.go index bd05591116..05c0c3f57e 100644 --- a/cmd/bosun/expr/tsdb.go +++ b/cmd/bosun/expr/tsdb.go @@ -79,10 +79,10 @@ func timeTSDBRequest(e *State, T miniprofiler.Timer, req *opentsdb.Request) (s o for { T.StepCustomTiming("tsdb", "query", string(b), func() { getFn := func() (interface{}, error) { - return e.tsdbContext.Query(req) + return e.TSDBContext.Query(req) } var val interface{} - val, err = e.cache.Get(string(b), getFn) + val, err = e.Cache.Get(string(b), getFn) s = val.(opentsdb.ResponseSet).Copy() }) @@ -113,11 +113,11 @@ func bandTSDB(e *State, T miniprofiler.Timer, query, duration, period string, nu err = fmt.Errorf("num out of bounds") } var q *opentsdb.Query - q, err = opentsdb.ParseQuery(query, e.tsdbContext.Version()) + q, err = opentsdb.ParseQuery(query, e.TSDBContext.Version()) if err != nil { return } - if !e.tsdbContext.Version().FilterSupport() { + if !e.TSDBContext.Version().FilterSupport() { if err = e.Search.Expand(q); err != nil { return } @@ -141,7 +141,7 @@ func bandTSDB(e *State, T miniprofiler.Timer, query, duration, period string, nu return } for _, res := range s { - if e.squelched(res.Tags) { + if e.Squelched(res.Tags) { continue } //offset := e.now.Sub(now.Add(time.Duration(p-d))) @@ -308,11 +308,11 @@ func Over(e *State, T miniprofiler.Timer, query, duration, period string, num fl err = fmt.Errorf("num out of bounds") } var q *opentsdb.Query - q, err = opentsdb.ParseQuery(query, e.tsdbContext.Version()) + q, err = opentsdb.ParseQuery(query, e.TSDBContext.Version()) if err != nil { return } - if !e.tsdbContext.Version().FilterSupport() { + if !e.TSDBContext.Version().FilterSupport() { if err = e.Search.Expand(q); err != nil { return } @@ -331,7 +331,7 @@ func Over(e *State, T miniprofiler.Timer, query, duration, period string, num fl } offset := e.now.Sub(now) for _, res := range s { - if e.squelched(res.Tags) { + if e.Squelched(res.Tags) { continue } values := make(Series) @@ -356,11 +356,11 @@ func Over(e *State, T miniprofiler.Timer, query, duration, period string, num fl func Query(e *State, T miniprofiler.Timer, query, sduration, eduration string) (r *Results, err error) { r = new(Results) - q, err := opentsdb.ParseQuery(query, e.tsdbContext.Version()) + q, err := opentsdb.ParseQuery(query, e.TSDBContext.Version()) if q == nil && err != nil { return } - if !e.tsdbContext.Version().FilterSupport() { + if !e.TSDBContext.Version().FilterSupport() { if err = e.Search.Expand(q); err != nil { return } @@ -390,7 +390,7 @@ func Query(e *State, T miniprofiler.Timer, query, sduration, eduration string) ( return } for _, res := range s { - if e.squelched(res.Tags) { + if e.Squelched(res.Tags) { continue } values := make(Series) diff --git a/cmd/bosun/sched/check.go b/cmd/bosun/sched/check.go index 170e19f490..109bc3e3b4 100644 --- a/cmd/bosun/sched/check.go +++ b/cmd/bosun/sched/check.go @@ -9,13 +9,11 @@ import ( "bosun.org/cmd/bosun/conf" "bosun.org/cmd/bosun/expr" "bosun.org/collect" - "bosun.org/graphite" "bosun.org/metadata" "bosun.org/models" "bosun.org/opentsdb" "bosun.org/slog" "github.com/MiniProfiler/go/miniprofiler" - "github.com/influxdata/influxdb/client" ) func init() { @@ -49,14 +47,9 @@ func NewIncident(ak models.AlertKey) *models.IncidentState { } type RunHistory struct { - Cache *cache.Cache - Start time.Time - Context opentsdb.Context - GraphiteContext graphite.Context - InfluxConfig client.Config - Logstash expr.LogstashElasticHosts - Elastic expr.ElasticHosts - + Cache *cache.Cache + Start time.Time + Backends *expr.Backends Events map[models.AlertKey]*models.Event schedule *Schedule } @@ -70,17 +63,20 @@ func (rh *RunHistory) AtTime(t time.Time) *RunHistory { } func (s *Schedule) NewRunHistory(start time.Time, cache *cache.Cache) *RunHistory { - return &RunHistory{ - Cache: cache, - Start: start, - Events: make(map[models.AlertKey]*models.Event), - Context: s.Conf.TSDBContext(), - GraphiteContext: s.Conf.GraphiteContext(), - InfluxConfig: s.Conf.InfluxConfig, - Logstash: s.Conf.LogstashElasticHosts, - Elastic: s.Conf.ElasticHosts, - schedule: s, - } + r := &RunHistory{ + Cache: cache, + Start: start, + Events: make(map[models.AlertKey]*models.Event), + schedule: s, + Backends: &expr.Backends{ + TSDBContext: s.Conf.TSDBContext(), + GraphiteContext: s.Conf.GraphiteContext(), + InfluxConfig: s.Conf.InfluxConfig, + LogstashHosts: s.Conf.LogstashElasticHosts, + ElasticHosts: s.Conf.ElasticHosts, + }, + } + return r } // RunHistory processes an event history and triggers notifications if needed. @@ -589,7 +585,13 @@ func (s *Schedule) executeExpr(T miniprofiler.Timer, rh *RunHistory, a *conf.Ale if e == nil { return nil, nil } - results, _, err := e.Execute(rh.Context, rh.GraphiteContext, rh.Logstash, rh.Elastic, rh.InfluxConfig, rh.Cache, T, rh.Start, 0, a.UnjoinedOK, s.Search, s.Conf.AlertSquelched(a), s) + providers := &expr.BosunProviders{ + Cache: rh.Cache, + Search: s.Search, + Squelched: s.Conf.AlertSquelched(a), + History: s, + } + results, _, err := e.Execute(rh.Backends, providers, T, rh.Start, 0, a.UnjoinedOK) return results, err } diff --git a/cmd/bosun/sched/template.go b/cmd/bosun/sched/template.go index 6f81fa4918..c6177d140c 100644 --- a/cmd/bosun/sched/template.go +++ b/cmd/bosun/sched/template.go @@ -198,7 +198,13 @@ func (c *Context) evalExpr(e *expr.Expr, filter bool, series bool, autods int) ( if series && e.Root.Return() != models.TypeSeriesSet { return nil, "", fmt.Errorf("need a series, got %T (%v)", e, e) } - res, _, err := e.Execute(c.runHistory.Context, c.runHistory.GraphiteContext, c.runHistory.Logstash, c.runHistory.Elastic, c.runHistory.InfluxConfig, c.runHistory.Cache, nil, c.runHistory.Start, autods, c.Alert.UnjoinedOK, c.schedule.Search, c.schedule.Conf.AlertSquelched(c.Alert), c.schedule) + providers := &expr.BosunProviders{ + Cache: c.runHistory.Cache, + Search: c.schedule.Search, + Squelched: c.schedule.Conf.AlertSquelched(c.Alert), + History: c.schedule, + } + res, _, err := e.Execute(c.runHistory.Backends, providers, nil, c.runHistory.Start, autods, c.Alert.UnjoinedOK) if err != nil { return nil, "", fmt.Errorf("%s: %v", e, err) } @@ -483,11 +489,11 @@ func (c *Context) LSQuery(index_root, filter, sduration, eduration string, size } func (c *Context) LSQueryAll(index_root, keystring, filter, sduration, eduration string, size int) (interface{}, error) { - req, err := expr.LSBaseQuery(c.runHistory.Start, index_root, c.runHistory.Logstash, keystring, filter, sduration, eduration, size) + req, err := expr.LSBaseQuery(c.runHistory.Start, index_root, keystring, filter, sduration, eduration, size) if err != nil { return nil, err } - results, err := c.runHistory.Logstash.Query(req) + results, err := c.runHistory.Backends.LogstashHosts.Query(req) if err != nil { return nil, err } @@ -504,11 +510,11 @@ func (c *Context) LSQueryAll(index_root, keystring, filter, sduration, eduration func (c *Context) ESQuery(indexRoot expr.ESIndexer, filter expr.ESQuery, sduration, eduration string, size int) (interface{}, error) { newFilter := expr.ScopeES(c.Group(), filter.Query) - req, err := expr.ESBaseQuery(c.runHistory.Start, indexRoot, c.runHistory.Elastic, newFilter, sduration, eduration, size) + req, err := expr.ESBaseQuery(c.runHistory.Start, indexRoot, newFilter, sduration, eduration, size) if err != nil { return nil, err } - results, err := c.runHistory.Elastic.Query(req) + results, err := c.runHistory.Backends.ElasticHosts.Query(req) if err != nil { return nil, err } @@ -524,11 +530,11 @@ func (c *Context) ESQuery(indexRoot expr.ESIndexer, filter expr.ESQuery, sdurati } func (c *Context) ESQueryAll(indexRoot expr.ESIndexer, filter expr.ESQuery, sduration, eduration string, size int) (interface{}, error) { - req, err := expr.ESBaseQuery(c.runHistory.Start, indexRoot, c.runHistory.Elastic, filter.Query, sduration, eduration, size) + req, err := expr.ESBaseQuery(c.runHistory.Start, indexRoot, filter.Query, sduration, eduration, size) if err != nil { return nil, err } - results, err := c.runHistory.Elastic.Query(req) + results, err := c.runHistory.Backends.ElasticHosts.Query(req) if err != nil { return nil, err } diff --git a/cmd/bosun/web/chart.go b/cmd/bosun/web/chart.go index a570cf8e90..328c30c6cd 100644 --- a/cmd/bosun/web/chart.go +++ b/cmd/bosun/web/chart.go @@ -236,12 +236,20 @@ func ExprGraph(t miniprofiler.Timer, w http.ResponseWriter, r *http.Request) (in return nil, fmt.Errorf("egraph: requires an expression that returns a series") } // it may not strictly be necessary to recreate the contexts each time, but we do to be safe - tsdbContext := schedule.Conf.TSDBContext() - graphiteContext := schedule.Conf.GraphiteContext() - ls := schedule.Conf.LogstashElasticHosts - influx := schedule.Conf.InfluxConfig - es := schedule.Conf.ElasticHosts - res, _, err := e.Execute(tsdbContext, graphiteContext, ls, es, influx, cacheObj, t, now, autods, false, schedule.Search, nil, nil) + backends := &expr.Backends{ + TSDBContext: schedule.Conf.TSDBContext(), + GraphiteContext: schedule.Conf.GraphiteContext(), + InfluxConfig: schedule.Conf.InfluxConfig, + LogstashHosts: schedule.Conf.LogstashElasticHosts, + ElasticHosts: schedule.Conf.ElasticHosts, + } + providers := &expr.BosunProviders{ + Cache: cacheObj, + Search: schedule.Search, + Squelched: nil, + History: nil, + } + res, _, err := e.Execute(backends, providers, t, now, autods, false) if err != nil { return nil, err } diff --git a/cmd/bosun/web/expr.go b/cmd/bosun/web/expr.go index 88907c5a56..e5d9cfd527 100644 --- a/cmd/bosun/web/expr.go +++ b/cmd/bosun/web/expr.go @@ -72,12 +72,20 @@ func Expr(t miniprofiler.Timer, w http.ResponseWriter, r *http.Request) (v inter return nil, err } // it may not strictly be necessary to recreate the contexts each time, but we do to be safe - tsdbContext := schedule.Conf.TSDBContext() - graphiteContext := schedule.Conf.GraphiteContext() - ls := schedule.Conf.LogstashElasticHosts - influx := schedule.Conf.InfluxConfig - es := schedule.Conf.ElasticHosts - res, queries, err := e.Execute(tsdbContext, graphiteContext, ls, es, influx, cacheObj, t, now, 0, false, schedule.Search, nil, nil) + backends := &expr.Backends{ + TSDBContext: schedule.Conf.TSDBContext(), + GraphiteContext: schedule.Conf.GraphiteContext(), + InfluxConfig: schedule.Conf.InfluxConfig, + LogstashHosts: schedule.Conf.LogstashElasticHosts, + ElasticHosts: schedule.Conf.ElasticHosts, + } + providers := &expr.BosunProviders{ + Cache: cacheObj, + Search: schedule.Search, + Squelched: nil, + History: nil, + } + res, queries, err := e.Execute(backends, providers, t, now, 0, false) if err != nil { return nil, err }