sfackler / r2d2

A generic connection pool for Rust
Apache License 2.0
1.51k stars 82 forks source link

Add an event handler #78

Closed sfackler closed 5 years ago

sfackler commented 5 years ago

This can be used by applications to better monitor their connection pool usage. For example, you could maintain a histogram of pool checkout times and alert if the p95 gets too high, indicating oversaturating.

cc #75

sfackler commented 5 years ago

cc @Diggsey

Diggsey commented 5 years ago

This seems like a great starting point - the next thing I would add is some kind of opaque connection ID, just so that it's possible to match up the different events.

sfackler commented 5 years ago

Oh, interesting. I've always thought about the events in aggregate, but I guess there's no reason not to allow you to correlate various events.

We could have an opaque connection ID, but I wonder if it'll be simpler for it just to be a u64? We're going to be generating them ourselves either way so it's not like that's really limiting in any significant way.

Diggsey commented 5 years ago

Yeah, I have no opinion on that. As long as I can correlate the events somehow it doesn't really matter.