mysql_async icon indicating copy to clipboard operation
mysql_async copied to clipboard

Performance counters, metrics, tracing

Open cloneable opened this issue 2 years ago • 5 comments

Hi! We would like to get more insight into how well we're handling DB connections, but we're having difficulty measuring some things where we would need deeper access to pool, recycler, etc.

Would you be receptive to adding some lightweight telemetry to mysql_async? Not heavy histograms, but some (atomic) counters for connection creation, returnal, recycling of unclean conns and of expired conns, failed conns, etc.. I would prepare a PR.

And then I would also like to ask how you feel about instrumenting functions and futures via tracing package? This could be behind a feature flag and the spans would be at debug or even trace level. That's a bigger change and completely separate from the metrics above.

cloneable avatar Jan 20 '23 11:01 cloneable

Hi. Both telemetry and tracing seem to be useful. I'll try not to drag out the review process.

blackbeam avatar Jan 23 '23 08:01 blackbeam

Great, thank you! I just created the first of at least two PRs (#224) which instruments some futures. Please have a look and see if you're okay with this. Maybe you have some ideas what can be done better. I'm not happy yet with how queries and params are added. That's a bit inefficient, but it's done only at debug level anyway.

cloneable avatar Jan 26 '23 17:01 cloneable

I need a bit more time working on the perf counters. In the meantime, it would be great if we could merge #230 and then publish a new release. Would that be possible?

cloneable avatar Feb 14 '23 10:02 cloneable

Published as v0.31.3.

blackbeam avatar Feb 15 '23 15:02 blackbeam

Thanks a lot! I'll return soon once I have a good design for the perf counters. I'll also try to add a test tracing subscriber that can capture tracing events, so they can be checked.

cloneable avatar Feb 15 '23 15:02 cloneable