Skip to content

Commit

Permalink
Merge pull request #129 from magnusbaeck/connpool-sql-db
Browse files Browse the repository at this point in the history
fix(otelgorm): Make metric reporting work with prepared statements
  • Loading branch information
vmihailenco committed Jun 13, 2024
2 parents 33d1fd3 + d3f269a commit aeefc42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions otelgorm/otelgorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ type gormRegister interface {

func (p otelPlugin) Initialize(db *gorm.DB) (err error) {
if !p.excludeMetrics {
if db, ok := db.ConnPool.(*sql.DB); ok {
otelsql.ReportDBStatsMetrics(db)
if sqlDB, err := db.DB(); err == nil {
otelsql.ReportDBStatsMetrics(sqlDB)
}
}

Expand Down

0 comments on commit aeefc42

Please sign in to comment.