You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're undergoing some changes in our multi-module Spring app, and I need to collect a few Micrometer HikariCP metrics (more specifically, the hikaricp_connections_active) in a customized way.
Currently, it tags the metrics per data source pool:
# TYPE hikaricp_connections_active gaugehikaricp_connections_active{pool="reading-pool",} 0.0hikaricp_connections_active{pool="writing-pool",} 0.0
We have several modules in the app, and I'd like to tag the connections per module as well, something like:
# TYPE hikaricp_connections_active gaugehikaricp_connections_active{pool="reading-pool",module="a",} 0.0hikaricp_connections_active{pool="writing-pool",module="a",} 0.0hikaricp_connections_active{pool="reading-pool",module="b",} 0.0hikaricp_connections_active{pool="writing-pool",module="b",} 0.0
Initially, I thought about creating my own IMetricsTracker along with an interceptor (to identify which module code is requesting a connection) to set the metric I need, but the problem is it's a Gauge, and it relies on PoolStats and all the machinery behind the HikariPool (especially the ConcurrentBag) to feed the pool stats.
I couldn't find any way to customize the Hikari pool metrics management classes (most of them are package-protected, I believe purposefully).
Has anyone ever had to do something like this? Any suggestion on what direction I could take here? I really appreciate your time and feedback! 🙏
The text was updated successfully, but these errors were encountered:
We're undergoing some changes in our multi-module Spring app, and I need to collect a few Micrometer HikariCP metrics (more specifically, the
hikaricp_connections_active
) in a customized way.Currently, it tags the metrics per data source pool:
We have several modules in the app, and I'd like to tag the connections per module as well, something like:
Initially, I thought about creating my own
IMetricsTracker
along with an interceptor (to identify which module code is requesting a connection) to set the metric I need, but the problem is it's aGauge
, and it relies onPoolStats
and all the machinery behind theHikariPool
(especially the ConcurrentBag) to feed the pool stats.I couldn't find any way to customize the Hikari pool metrics management classes (most of them are package-protected, I believe purposefully).
Has anyone ever had to do something like this? Any suggestion on what direction I could take here? I really appreciate your time and feedback! 🙏
The text was updated successfully, but these errors were encountered: