|
|
@@ -28,23 +28,7 @@ type EvalContext struct {
|
|
|
NoDataFound bool
|
|
|
RetryCount int
|
|
|
|
|
|
- Context context.Context
|
|
|
-}
|
|
|
-
|
|
|
-func (evalContext *EvalContext) Deadline() (deadline time.Time, ok bool) {
|
|
|
- return evalContext.Deadline()
|
|
|
-}
|
|
|
-
|
|
|
-func (evalContext *EvalContext) Done() <-chan struct{} {
|
|
|
- return evalContext.Context.Done()
|
|
|
-}
|
|
|
-
|
|
|
-func (evalContext *EvalContext) Err() error {
|
|
|
- return evalContext.Context.Err()
|
|
|
-}
|
|
|
-
|
|
|
-func (evalContext *EvalContext) Value(key interface{}) interface{} {
|
|
|
- return evalContext.Context.Value(key)
|
|
|
+ Ctx context.Context
|
|
|
}
|
|
|
|
|
|
type StateDescription struct {
|
|
|
@@ -103,6 +87,10 @@ func (c *EvalContext) GetDashboardSlug() (string, error) {
|
|
|
}
|
|
|
|
|
|
func (c *EvalContext) GetRuleUrl() (string, error) {
|
|
|
+ if c.IsTestRun {
|
|
|
+ return setting.AppUrl, nil
|
|
|
+ }
|
|
|
+
|
|
|
if slug, err := c.GetDashboardSlug(); err != nil {
|
|
|
return "", err
|
|
|
} else {
|
|
|
@@ -113,7 +101,7 @@ func (c *EvalContext) GetRuleUrl() (string, error) {
|
|
|
|
|
|
func NewEvalContext(alertCtx context.Context, rule *Rule) *EvalContext {
|
|
|
return &EvalContext{
|
|
|
- Context: alertCtx,
|
|
|
+ Ctx: alertCtx,
|
|
|
StartTime: time.Now(),
|
|
|
Rule: rule,
|
|
|
Logs: make([]*ResultLogEntry, 0),
|