-
-
Notifications
You must be signed in to change notification settings - Fork 472
Logging traces globally with transactions and JDBC when using a pool-based setup #4877
-
I have an application I'm working on which I've added sentry JDBC logging to and it somewhat works, but because it uses a central database pool it's kind of a strange way I've had to implement it. From what I've seen in the examples/documentation, I'm stuck requiring a global Transaction with setBindToScope = true; but this doesn't ever flush unless if I call finish() on it periodically and then replace it with another Transaction. Is there some magical auto-flushing at a certain interval Transaction option?
Are all the examples (even the JDBC one) that you'd be tracing a small portion and not every JDBC call?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
Hey @nickcviamentis what kind of application are you building? Is it a server, a desktop application or something else?
Ideally whatever wraps the database calls has a transaction and any queries that are part of that task are added to the transaction as child spans.
If you're only interested in database spans, you could give our OpenTelemetry integration a try. It should simply report each query as a separate transaction if there's no span/transaction to attach to. However you'll miss out on details like where that query was initiated, so having a parent span is useful.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks, I'll try that. It's a server that handles client requests, so I ended up just setting up an ITransaction on every client request it handled in the end. It seems to work well enough given they're each handled on their own individual thread and that seems to be the level the scope is defined on. It just would've been nice to have a periodically flushed database level transaction that could be set specifically somehow on the JDBC automatic integration, but this will do for now :)
Beta Was this translation helpful? Give feedback.