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:
Kyle Brandt
2025-05-13 15:22:20 -04:00
committed by GitHub
parent 02d977e1af
commit 5e056c2a3f
12 changed files with 183 additions and 22 deletions
+8
View File
@@ -428,6 +428,12 @@ type Cfg struct {
// SQLExpressionCellLimit is the maximum number of cells (rows × columns, across all frames) that can be accepted by a SQL expression.
SQLExpressionCellLimit int64
// SQLExpressionOutputCellLimit is the maximum number of cells (rows × columns) that can be outputted by a SQL expression.
SQLExpressionOutputCellLimit int64
// SQLExpressionTimeoutSeconds is the duration a SQL expression will run before timing out
SQLExpressionTimeout time.Duration
ImageUploadProvider string
// LiveMaxConnections is a maximum number of WebSocket connections to
@@ -800,6 +806,8 @@ func (cfg *Cfg) readExpressionsSettings() {
expressions := cfg.Raw.Section("expressions")
cfg.ExpressionsEnabled = expressions.Key("enabled").MustBool(true)
cfg.SQLExpressionCellLimit = expressions.Key("sql_expression_cell_limit").MustInt64(100000)
cfg.SQLExpressionOutputCellLimit = expressions.Key("sql_expression_output_cell_limit").MustInt64(100000)
cfg.SQLExpressionTimeout = expressions.Key("sql_expression_timeout").MustDuration(time.Second * 10)
}
type AnnotationCleanupSettings struct {