Sfoglia il codice sorgente

improve error message for timeouts

closes #9220
bergquist 8 anni fa
parent
commit
057b8a6b2d
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      pkg/services/alerting/conditions/query.go

+ 6 - 0
pkg/services/alerting/conditions/query.go

@@ -5,6 +5,8 @@ import (
 	"strings"
 	"time"
 
+	gocontext "context"
+
 	"github.com/grafana/grafana/pkg/bus"
 	"github.com/grafana/grafana/pkg/components/null"
 	"github.com/grafana/grafana/pkg/components/simplejson"
@@ -112,6 +114,10 @@ func (c *QueryCondition) executeQuery(context *alerting.EvalContext, timeRange *
 
 	resp, err := c.HandleRequest(context.Ctx, req)
 	if err != nil {
+		if err == gocontext.DeadlineExceeded {
+			return nil, fmt.Errorf("Alert execution exceeded the timeout")
+		}
+
 		return nil, fmt.Errorf("tsdb.HandleRequest() error %v", err)
 	}