-
Notifications
You must be signed in to change notification settings - Fork 63
Add a traceable Diesel connection structure #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
So I went ahead and added some "print" statements here, just as a quick check before actually bothering to put probes anywhere. Looks like "diesel::Connection::load" is getting hit for just about every single invocation here. I still think we should also instrument the "execute" functions, but load seems like the big one to inspect. I left my print statement in, as they currently show how to extract the outgoing query to a string, but we should definitely replace them in the probed world. |
|
I asked about this on the Diesel gitter, and got the following response from Georg (Diesel maintainer):
(welp, that's lucky! didn't know those existed before throwing this PR here)
I suspect a judicious use of "only doing work in probe closures" can help avoid this - but good to know that they're interested in feedback. |
|
@smklein Thanks for putting this together, it's definitely encouraging. For some context, is this intended to model how we might extend |
Thanks to the Joy of Generics, this is actually somewhat decoupled from ... Or it can be this new So, TL;DR, I don't think async-bb8-diesel needs to be updated for this to work. Now, the question of "where should this thing live", IMO, it could go in one of two places:
|
|
@smklein Thanks for that context, definitely helpful. I'd be inclined to put this into a new crate. Yes, it's a new dependency, but I think the ability to use it in other contexts might be helpful. But I'd love to hear your thoughts. |
|
@smklein I'm finally circling back to this. I started to implement this in a standalone crate that we can push on crates.io, but it seems we're actually using a bleeding-edge version of diesel in omicron. I assume that's intentional and required, but it might mean it'd be easier or more appropriate to keep the traced connection in this repo. WDYT? |
Yeah, we use Diesel 2, which hasn't been released, so I depend on the github version. This prevents publishing to crates.io, but doesn't necessarily mean we can't split it out. As an example, async-bb8-diesel depends on the unreleased version of Diesel, but exists as a separate crate (just unpublished). Either way is fine with me though. Easy to split out later if that's preferable. |
|
@smklein Sounds good, I'll make it a separate crate on GH, a la |
|
I'm closing this as we've now merged #488 based off this. |
FYI @bnaecker - this might be an alternative to the issues we had in oxidecomputer/async-bb8-diesel#7.
I believe all the "Span" fundamentals mentioned in that PR are still relevant, but this attempts to expose the "raw DB interface to Diesel" a little more explicitly.