PostgreSQL: Read postgresDSUsePGX from config (#112170)

* PostgreSQL: Read `postgresDSUsePGX` from config

* Update plugins_test
This commit is contained in:
Zoltán Bedi
2025-10-10 15:55:55 +02:00
committed by GitHub
parent f33e6e47d5
commit 5e8267fcf8
6 changed files with 15 additions and 15 deletions
@@ -128,7 +128,7 @@ func newPostgresPGX(ctx context.Context, userFacingDefaultError string, rowLimit
return p, handler, nil
}
func NewInstanceSettings(logger log.Logger, usePGX bool, dataPath string) datasource.InstanceFactoryFunc {
func NewInstanceSettings(logger log.Logger, dataPath string) datasource.InstanceFactoryFunc {
return func(ctx context.Context, settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
cfg := backend.GrafanaConfigFromContext(ctx)
sqlCfg, err := cfg.SQL()
@@ -171,6 +171,8 @@ func NewInstanceSettings(logger log.Logger, usePGX bool, dataPath string) dataso
return nil, err
}
usePGX := cfg.FeatureToggles().IsEnabled("postgresDSUsePGX")
if usePGX {
pgxlogger := logger.FromContext(ctx).With("driver", "pgx")
pgxTlsManager := newPgxTlsManager(pgxlogger)