Instrumentation: re-enable database wrapper feature to expose counter and histogram for database queries (#29662)

ref https://github.com/grafana/grafana/issues/29489
This commit is contained in:
Dafydd
2021-01-07 07:21:35 +00:00
committed by GitHub
parent e270a2de9e
commit 08fbe345a9
3 changed files with 26 additions and 22 deletions
+4
View File
@@ -259,6 +259,10 @@ func (ss *SQLStore) getEngine() (*xorm.Engine, error) {
return nil, err
}
if ss.Cfg.IsDatabaseMetricsEnabled() {
ss.dbCfg.Type = WrapDatabaseDriverWithHooks(ss.dbCfg.Type)
}
sqlog.Info("Connecting to DB", "dbtype", ss.dbCfg.Type)
if ss.dbCfg.Type == migrator.SQLite && strings.HasPrefix(connectionString, "file:") {
exists, err := fs.Exists(ss.dbCfg.Path)