diff options
author | 2025-02-06 12:14:37 +0100 | |
---|---|---|
committer | 2025-02-06 12:14:37 +0100 | |
commit | dd094e401282e135989f57c0ca3dee7dea3f5207 (patch) | |
tree | 74cb77830f621840273255a17565ced73b4fa997 /internal/db/bundb/bundb.go | |
parent | [feature] Use `X-Robots-Tag` headers to instruct scrapers/crawlers (#3737) (diff) | |
download | gotosocial-dd094e401282e135989f57c0ca3dee7dea3f5207.tar.xz |
[chore] update otel libraries (#3740)
* chore: update otel dependencies
* refactor: combine tracing & metrics in observability package
* chore: update example tracing compose file
Diffstat (limited to 'internal/db/bundb/bundb.go')
-rw-r--r-- | internal/db/bundb/bundb.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/internal/db/bundb/bundb.go b/internal/db/bundb/bundb.go index c9dd7866d..18fe5384c 100644 --- a/internal/db/bundb/bundb.go +++ b/internal/db/bundb/bundb.go @@ -41,9 +41,8 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/db/bundb/migrations" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" - "github.com/superseriousbusiness/gotosocial/internal/metrics" + "github.com/superseriousbusiness/gotosocial/internal/observability" "github.com/superseriousbusiness/gotosocial/internal/state" - "github.com/superseriousbusiness/gotosocial/internal/tracing" "github.com/uptrace/bun" "github.com/uptrace/bun/dialect" "github.com/uptrace/bun/dialect/pgdialect" @@ -324,11 +323,10 @@ func bunDB(sqldb *sql.DB, dialect func() schema.Dialect) *bun.DB { // Add our SQL connection hooks. db.AddQueryHook(queryHook{}) - if config.GetTracingEnabled() { - db.AddQueryHook(tracing.InstrumentBun()) - } - if config.GetMetricsEnabled() { - db.AddQueryHook(metrics.InstrumentBun()) + metricsEnabled := config.GetMetricsEnabled() + tracingEnabled := config.GetTracingEnabled() + if metricsEnabled || tracingEnabled { + db.AddQueryHook(observability.InstrumentBun(tracingEnabled, metricsEnabled)) } // table registration is needed for many-to-many, see: |