db telemetry
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
2026-05-02 16:29:07 +02:00
parent 327bb9c867
commit 52d58583e9
16 changed files with 241 additions and 98 deletions

View File

@@ -11,6 +11,8 @@ import (
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"gorm.io/plugin/opentelemetry/tracing"
)
var (
@@ -42,6 +44,14 @@ func Connect(dsn string) (*gorm.DB, error) {
return
}
if pluginErr := db.Use(tracing.NewPlugin(
tracing.WithoutMetrics(),
tracing.WithoutQueryVariables(),
)); pluginErr != nil {
err = fmt.Errorf("failed to register otel plugin: %w", pluginErr)
return
}
// Configure connection pool for PostgreSQL.
if isPostgres {
sqlDB, poolErr := db.DB()