Fork me on GitHub
#hugsql
<
2021-12-23
>
rgm18:12:23

does anyone have any experience instrumenting hugsql? I want to throw some timings for SQL calls into statsd and I'm considering hacking up my own wrapper around def-db-fns, so that I don't need to add a timing wrapper around every call site.

lukasz18:12:27

Usually drivers and/or connection pools help with that - e.g. hikaricp accepts a metric registry, it's based on Dropwizard metrics so it should be pretty flexible

rgm18:12:36

oh right, yeah, thanks ... working at the level of the pool or the adapter probably makes more sense for timings and counts.

rgm18:12:42

Might have to come back to this idea for doing traces & the execution hierarchy since that's not going to be just hugsql.

lukasz18:12:21

You can also turn the problem on its head and have slow query log setup in your database - a bit harder to tie it to the code, but requires no changes in your app

rgm18:12:44

true ... unfortunately using a postgres appliance at DO so a bit limited in how much messing around with config I can do. Suppose there's a bunch that can be done from a psql session though.

lukasz18:12:47

Ah that's true - I'm spoiled with RDS, and even though it is a managed service, it does expose enough useful info to see what's going on

rgm18:12:00

yeah, true. DO improves day by day and honestly most of the time it's probably better I can't disappear down a tuning rabbit hole