diff --git a/tracing/tracing.go b/tracing/tracing.go index 5b591e1..539d810 100644 --- a/tracing/tracing.go +++ b/tracing/tracing.go @@ -62,8 +62,8 @@ type gormRegister interface { func (p otelPlugin) Initialize(db *gorm.DB) (err error) { if !p.excludeMetrics { - if db, ok := db.ConnPool.(*sql.DB); ok { - metrics.ReportDBStatsMetrics(db) + if sqlDB, err := db.DB(); err == nil { + metrics.ReportDBStatsMetrics(sqlDB) } }