[erlang-questions] Reporting gen_server timings

Roger Lipscombe roger@REDACTED
Fri May 30 17:02:30 CEST 2014


We're using poolboy and pgsql. I'd like to report (to graphite; we're
using folsomite) the time taken for the gen_server and database calls.

When you use poolboy, you provide it with a worker (usually a
gen_server), and call it like this:

    poolboy:transaction(?POOL, fun(W) -> gen_server:call(W, {equery,
Stmt}) end).

I'd like to instrument this -- without having to add too much wrapper
code -- such that I get measurements of:

- How long the overall transaction took.
- How much of that was spent waiting for poolboy to get an available worker.
- How much of that was spent waiting on the database.

I could decorate the code with timer:tc calls everywhere, but that
gets ugly really quickly. Is there a better way?

Thanks,
Roger.



More information about the erlang-questions mailing list