Alerting/Expr: New SSE Request/QueryType, alerting move data source UID (#33282)

This commit is contained in:
Kyle Brandt
2021-04-23 16:52:32 +02:00
committed by GitHub
parent 659ea20c3c
commit 5e818146de
19 changed files with 179 additions and 248 deletions
+3 -4
View File
@@ -6,7 +6,6 @@ import (
"strings"
"time"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/components/gtime"
"github.com/grafana/grafana/pkg/expr/mathexp"
)
@@ -139,12 +138,12 @@ type ResampleCommand struct {
VarToResample string
Downsampler string
Upsampler string
TimeRange backend.TimeRange
TimeRange TimeRange
refID string
}
// NewResampleCommand creates a new ResampleCMD.
func NewResampleCommand(refID, rawWindow, varToResample string, downsampler string, upsampler string, tr backend.TimeRange) (*ResampleCommand, error) {
func NewResampleCommand(refID, rawWindow, varToResample string, downsampler string, upsampler string, tr TimeRange) (*ResampleCommand, error) {
// TODO: validate reducer here, before execution
window, err := gtime.ParseDuration(rawWindow)
if err != nil {
@@ -218,7 +217,7 @@ func (gr *ResampleCommand) Execute(ctx context.Context, vars mathexp.Vars) (math
if !ok {
return newRes, fmt.Errorf("can only resample type series, got type %v", val.Type())
}
num, err := series.Resample(gr.refID, gr.Window, gr.Downsampler, gr.Upsampler, gr.TimeRange)
num, err := series.Resample(gr.refID, gr.Window, gr.Downsampler, gr.Upsampler, gr.TimeRange.From, gr.TimeRange.To)
if err != nil {
return newRes, err
}