mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 22:57:16 +08:00
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:
@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestNewCommand(t *testing.T) {
|
||||
cmd, err := NewSQLCommand("a", "", "select a from foo, bar", 0)
|
||||
cmd, err := NewSQLCommand("a", "", "select a from foo, bar", 0, 0, 0)
|
||||
if err != nil && strings.Contains(err.Error(), "feature is not enabled") {
|
||||
return
|
||||
}
|
||||
@ -125,7 +125,7 @@ func TestSQLCommandCellLimits(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cmd, err := NewSQLCommand("a", "", "select a from foo, bar", tt.limit)
|
||||
cmd, err := NewSQLCommand("a", "", "select a from foo, bar", tt.limit, 0, 0)
|
||||
require.NoError(t, err, "Failed to create SQL command")
|
||||
|
||||
vars := mathexp.Vars{}
|
||||
@ -153,7 +153,7 @@ func TestSQLCommandMetrics(t *testing.T) {
|
||||
m := metrics.NewTestMetrics()
|
||||
|
||||
// Create a command
|
||||
cmd, err := NewSQLCommand("A", "someformat", "select * from foo", 0)
|
||||
cmd, err := NewSQLCommand("A", "someformat", "select * from foo", 0, 0, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Execute successful command
|
||||
|
Reference in New Issue
Block a user