Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Logging traces globally with transactions and JDBC when using a pool-based setup #4877

nickcviamentis started this conversation in General
Discussion options

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?

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

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.

You must be logged in to vote
1 reply
Comment options

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /