Alerting: Fix image rendering and uploading timeout preventing to send alert notifications (#21536)

* svc alerting - use a shorter ctx to upload the img
This will prevent timeout on img upload to cancel the notifications from being sent

* components img uploader - pass the ctx to aws lib

* make webdavuploader use the ctx

* make azureblobuploader use the ctx

* rename uploadImage() to renderAndUploadImage()
for better clarity about what this method work

* Use timeout + 2s for plugin renderer (same as service and phantomjs)

* Make sure that original EvalContext is updated after render and upload

* Verify notification sent even if render or image upload times out

* fix lint

* fixes after review

Co-authored-by: Edouard Hur <3418467+hekmon@users.noreply.github.com>

Fixes #21018
This commit is contained in:
Marcus Efraimsson
2020-01-17 12:07:16 +01:00
committed by GitHub
co-authored by Edouard Hur
parent 6e412d88c9
commit 71ffd1d108
8 changed files with 141 additions and 28 deletions
+3 -1
View File
@@ -3,6 +3,7 @@ package rendering
import (
"context"
"fmt"
"time"
pluginModel "github.com/grafana/grafana-plugin-model/go/renderer"
)
@@ -22,7 +23,8 @@ func (rs *RenderingService) renderViaPlugin(ctx context.Context, opts Opts) (*Re
return nil, err
}
ctx, cancel := context.WithTimeout(ctx, opts.Timeout)
// gives plugin some additional time to timeout and return possible errors.
ctx, cancel := context.WithTimeout(ctx, opts.Timeout+time.Second*2)
defer cancel()
req := &pluginModel.RenderRequest{