Commit 36fd746c by Kyle Brandt Committed by GitHub

Influx/flux: include interpolated query with error (#25665)

with execution errors, return a Frame that has Meta.ExecutedQueryString.
parent e2ba0731
...@@ -25,6 +25,11 @@ func ExecuteQuery(ctx context.Context, query QueryModel, runner queryRunner, max ...@@ -25,6 +25,11 @@ func ExecuteQuery(ctx context.Context, query QueryModel, runner queryRunner, max
tables, err := runner.runQuery(ctx, flux) tables, err := runner.runQuery(ctx, flux)
if err != nil { if err != nil {
dr.Error = err dr.Error = err
metaFrame := data.NewFrame("meta for error")
metaFrame.Meta = &data.FrameMeta{
ExecutedQueryString: flux,
}
dr.Frames = append(dr.Frames, metaFrame)
return return
} }
......
...@@ -90,10 +90,7 @@ func RunnerFromDataSource(dsInfo *models.DataSource) (*Runner, error) { ...@@ -90,10 +90,7 @@ func RunnerFromDataSource(dsInfo *models.DataSource) (*Runner, error) {
func backendDataResponseToTSDBResponse(dr *backend.DataResponse, refID string) *tsdb.QueryResult { func backendDataResponseToTSDBResponse(dr *backend.DataResponse, refID string) *tsdb.QueryResult {
qr := &tsdb.QueryResult{RefId: refID} qr := &tsdb.QueryResult{RefId: refID}
if dr.Error != nil {
qr.Error = dr.Error qr.Error = dr.Error
return qr
}
if dr.Frames != nil { if dr.Frames != nil {
qr.Dataframes = tsdb.NewDecodedDataFrames(dr.Frames) qr.Dataframes = tsdb.NewDecodedDataFrames(dr.Frames)
......
...@@ -66,7 +66,7 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery, ...@@ -66,7 +66,7 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery,
} }
} }
// Proces flux queries (data frame request) // Process flux queries (data frame request)
if (hasFlux) { if (hasFlux) {
if (!this.enableFlux) { if (!this.enableFlux) {
throw 'Flux not enabled for this datasource'; throw 'Flux not enabled for this datasource';
......
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