coopernurse / node-pool

Generic resource pooling for node.js
2.37k stars 259 forks source link

Stats Logging? #222

Open phaddius opened 6 years ago

phaddius commented 6 years ago

Looking through the codebase, doesn't look like there's any code to do any logging. I'm looking to print out pooling stats on my production server, like the current number of clients waiting for a connection, or the time spent waiting for each connection (so I can take an average), etc. With these stats, I can make better informed decision on how to tweak my pool parameters.

Am I missing something, or may I make a request for some logging that can be turned on and off?

(ps I'm using knex, and I tried turning on their logging but its very verbose and irrelevant to pooling)

sandfox commented 6 years ago

There's no logging or metrics built in to the lib, but it's been something I've wanted to get round to doing at some point. Various parts of the internals are half way ready to do things like measure time spent waiting.

At the moment all thats easily available is the properties listed at [here)[https://github.com/coopernurse/node-pool#pool-info] (I know each of them says "returns", but they are all properties, not methods (need to fix that at some point).

intellix commented 6 years ago

Maybe this belongs in a separate request, but in regards to statistics, I'd like to know more about what's currently queued and what currently holds requests.

I'm receiving requests via HTTP to do something and it'd be nice to provide an API to show what/who is using something and what's queued up.

holm commented 6 years ago

We are also looking into have some stats available in our dashboards on the state of our connection pools. Having some interface for getting stats would be very helpful.