Commit b856d7e1 by bergquist

fix(prometheus): remove timerange from context

parent ae7345b0
......@@ -34,8 +34,8 @@ type AlertQuery struct {
}
func (c *QueryCondition) Eval(context *alerting.EvalContext) {
context.TimeRange = tsdb.NewTimerange(c.Query.From, c.Query.To)
seriesList, err := c.executeQuery(context)
timerange := tsdb.NewTimerange(c.Query.From, c.Query.To)
seriesList, err := c.executeQuery(context, timerange)
if err != nil {
context.Error = err
return
......@@ -69,7 +69,7 @@ func (c *QueryCondition) Eval(context *alerting.EvalContext) {
context.Firing = len(context.EvalMatches) > 0
}
func (c *QueryCondition) executeQuery(context *alerting.EvalContext) (tsdb.TimeSeriesSlice, error) {
func (c *QueryCondition) executeQuery(context *alerting.EvalContext, timerange tsdb.TimeRange) (tsdb.TimeSeriesSlice, error) {
getDsInfo := &m.GetDataSourceByIdQuery{
Id: c.Query.DatasourceId,
OrgId: context.Rule.OrgId,
......@@ -79,7 +79,7 @@ func (c *QueryCondition) executeQuery(context *alerting.EvalContext) (tsdb.TimeS
return nil, fmt.Errorf("Could not find datasource")
}
req := c.getRequestForAlertRule(getDsInfo.Result, context.TimeRange)
req := c.getRequestForAlertRule(getDsInfo.Result, timerange)
result := make(tsdb.TimeSeriesSlice, 0)
resp, err := c.HandleRequest(req)
......
......@@ -8,7 +8,6 @@ import (
"github.com/grafana/grafana/pkg/log"
m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tsdb"
)
type EvalContext struct {
......@@ -29,7 +28,6 @@ type EvalContext struct {
ImageOnDiskPath string
NoDataFound bool
RetryCount int
TimeRange tsdb.TimeRange
}
type StateDescription struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment