Open rafaell-lycan opened 1 year ago
At my company we use newrelic and they perfectly integrate w/ node-postgres w/o having any changes to our code (via their own package doing significant monkey patching and so on for runtime metrics on query times). I'd be surprised if datadog didn't have the same thing.
For a custom statsd aggregator you could use some custom events on pool.on('aquire')
and pool.on('release')
to measure how long connections are used...but that doesn't track individual queries on each client (say you check out a client and run multiple queries).
You could do something like this:
pool.on('connect', (client) => {
//monkey-patch the client query function and track before each query is executed and after it completes
})
Can we add events on how long it takes to process queries?
Scenario:
Similarly with how we track errors events
pool.on('error', ... )
, is there any way to track down query events and send them to your favorite stats aggregator (e.g.: StatsD) or tracer (e.g.: Datadog)?e.g.: