[chore] update otel libraries (#3740)

* chore: update otel dependencies

* refactor: combine tracing & metrics in observability package

* chore: update example tracing compose file
This commit is contained in:
Dominik Süß 2025-02-06 12:14:37 +01:00 committed by GitHub
commit dd094e4012
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
217 changed files with 6873 additions and 2734 deletions

View file

@ -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: