diff options
author | 2023-05-09 19:19:48 +0200 | |
---|---|---|
committer | 2023-05-09 18:19:48 +0100 | |
commit | 6392e00653d3b81062ef60d8ae2fa2621873533f (patch) | |
tree | 761d0ff445c2c6a85020cecdc58f92ae1cf78513 /internal/db | |
parent | [bugfix] Don't try to get user when serializing local instance account (#1757) (diff) | |
download | gotosocial-6392e00653d3b81062ef60d8ae2fa2621873533f.tar.xz |
feat: initial tracing support (#1623)
Diffstat (limited to 'internal/db')
-rw-r--r-- | internal/db/bundb/bundb.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/db/bundb/bundb.go b/internal/db/bundb/bundb.go index 71433dbc2..ecf8752ea 100644 --- a/internal/db/bundb/bundb.go +++ b/internal/db/bundb/bundb.go @@ -42,6 +42,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/id" "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/state" + "github.com/superseriousbusiness/gotosocial/internal/tracing" "github.com/uptrace/bun" "github.com/uptrace/bun/dialect/pgdialect" "github.com/uptrace/bun/dialect/sqlitedialect" @@ -134,6 +135,10 @@ func NewBunDBService(ctx context.Context, state *state.State) (db.DB, error) { // Add database query hook conn.DB.AddQueryHook(queryHook{}) + if config.GetTracingEnabled() { + conn.DB.AddQueryHook(tracing.InstrumentBun()) + } + // execute sqlite pragmas *after* adding database hook; // this allows the pragma queries to be logged if t == "sqlite" { |