go icon indicating copy to clipboard operation
go copied to clipboard

Add metric for new DB conections

Open jacekn opened this issue 3 years ago • 0 comments

What problem does your feature solve?

Currently horizon exposes horizon_db_open_connections metric as a gauge. It's very useful but it doesn't tell us if we have connection "churn". For example horizon could be closing and establishing new connection every few seconds and we wouldn't know about it. Opening new connection is fairly resource intensive process on the postgres side and I think it would be useful to see when that happens.

What would you like to see?

I'd like horizon to expose new metric. Maybe horizon_db_open_connections_total or horizon_db_new_connection_total. The metric should be a counter that increments each time new DB connection is established. Counter will let us see when and at what rate new DB connections are established. This is of course in addition to existing horizon_db_open_connections gauge which should stay there.

If it's easy maybe we can also add horizon_db_closed_connections_total?

What alternatives are there?

jacekn avatar May 10 '22 09:05 jacekn