[v9.5.x] SQL Datasources: Update Max Connection and Max Idle Connection Defaults to 100 and add auto mode (#66651)
* SQL Datasources: Update Max Connection and Max Idle Connection Defaults to 100 and add auto mode (#65834)
* Update connection configuration for SQL datasources
* Working auto state for connection numbers
* Add migration
* Use defaults from constants file
* Remove dead code
* Add tests and restructure useMigrateDatabaseField
* Update function names
* Update docs
* Make sure we don't continually issue updates
* Update docs
* Use onOptionsChnage in ConnectionLimits
* Update docs
* Clean up docs
* Update migration
* Fix default values in docs
* Fix spacing issue
* Fix test
* Update default values for SQL connections
* Include consts
* Allow override for default SQL datasource connection parameters
* Fix linter errors
* Remove extra @ts-ignore
* Centralize logic for default values
* Remove debugging
* Remove unecessary function
* Update configuration docs
* minor suggested change
* Fix comment misspelling
* Remove unecessary default setting code
* Update docs to indicate that code was included for backport version
* Remove dead code
---------
Co-authored-by: lwandz13 <larissa.wandzura@grafana.com>
(cherry picked from commit 92d92187d9)
* Add brackets around property name so that it's dynamic
---------
Co-authored-by: Kyle Cunningham <codeincarnate@users.noreply.github.com>
Co-authored-by: Kyle Cunningham <kyle@codeincarnate.com>
This commit is contained in:
co-authored by
Kyle Cunningham
Kyle Cunningham
parent
68d2179aa2
commit
c035abf529
@@ -369,6 +369,11 @@ type Cfg struct {
|
||||
// Data sources
|
||||
DataSourceLimit int
|
||||
|
||||
// SQL Data sources
|
||||
SqlDatasourceMaxOpenConnsDefault int
|
||||
SqlDatasourceMaxIdleConnsDefault int
|
||||
SqlDatasourceMaxConnLifetimeDefault int
|
||||
|
||||
// Snapshots
|
||||
SnapshotEnabled bool
|
||||
ExternalSnapshotUrl string
|
||||
@@ -1115,6 +1120,7 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
|
||||
}
|
||||
|
||||
cfg.readDataSourcesSettings()
|
||||
cfg.readSqlDataSourceSettings()
|
||||
|
||||
cfg.DashboardPreviews = readDashboardPreviewsSettings(iniFile)
|
||||
cfg.Storage = readStorageSettings(iniFile)
|
||||
@@ -1837,6 +1843,13 @@ func (cfg *Cfg) readDataSourcesSettings() {
|
||||
cfg.DataSourceLimit = datasources.Key("datasource_limit").MustInt(5000)
|
||||
}
|
||||
|
||||
func (cfg *Cfg) readSqlDataSourceSettings() {
|
||||
sqlDatasources := cfg.Raw.Section("sql_datasources")
|
||||
cfg.SqlDatasourceMaxOpenConnsDefault = sqlDatasources.Key("max_open_conns_default").MustInt(100)
|
||||
cfg.SqlDatasourceMaxIdleConnsDefault = sqlDatasources.Key("max_idle_conns_default").MustInt(100)
|
||||
cfg.SqlDatasourceMaxConnLifetimeDefault = sqlDatasources.Key("max_conn_lifetime_default").MustInt(14400)
|
||||
}
|
||||
|
||||
func GetAllowedOriginGlobs(originPatterns []string) ([]glob.Glob, error) {
|
||||
allowedOrigins := originPatterns
|
||||
originGlobs := make([]glob.Glob, 0, len(allowedOrigins))
|
||||
|
||||
Reference in New Issue
Block a user