SQL Expressions: Add sql expression specific timeout and output limit (#104834)
Adds settings for SQL expressions: sql_expression_cell_output_limit Set the maximum number of cells that can be returned from a SQL expression. Default is 100000. sql_expression_timeout The duration a SQL expression will run before being cancelled. The default is 10s.
This commit is contained in:
@@ -5,6 +5,7 @@ package sql
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
@@ -14,6 +15,22 @@ type DB struct{}
|
||||
|
||||
// Stub out the QueryFrames method for ARM builds
|
||||
// See github.com/dolthub/go-mysql-server/issues/2837
|
||||
func (db *DB) QueryFrames(_ context.Context, _ tracing.Tracer, _, _ string, _ []*data.Frame) (*data.Frame, error) {
|
||||
func (db *DB) QueryFrames(_ context.Context, _ tracing.Tracer, _, _ string, _ []*data.Frame, _...QueryOption) (*data.Frame, error) {
|
||||
return nil, fmt.Errorf("sql expressions not supported in arm")
|
||||
}
|
||||
|
||||
func WithTimeout(_ time.Duration) QueryOption {
|
||||
return func(_ *QueryOptions) {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
||||
func WithMaxOutputCells(_ int64) QueryOption {
|
||||
return func(_ *QueryOptions) {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
||||
type QueryOptions struct{}
|
||||
|
||||
type QueryOption func(*QueryOptions)
|
||||
|
||||
Reference in New Issue
Block a user