# HikariCP JMX – Unable to split Pool metrics by pool name when multiple pools exist in the same JVM

**URL:** <https://community.dynatrace.com/t/hikaricp-jmx-unable-to-split-pool-metrics-by-pool-name-when-multiple-pools-exist-in-the-same-jvm/55797>\
**Category:** Extensions\
**Tags:** jdbc, hikari, extensions, tomcat, connection-pools\
**Created:** [May 5, 2026, 9:38am UTC](https://community.dynatrace.com/t/hikaricp-jmx-unable-to-split-pool-metrics-by-pool-name-when-multiple-pools-exist-in-the-same-jvm/55797 "2026-05-05T09:38:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mouadrhm](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Mouadrhm](https://community.dynatrace.com/u/Mouadrhm)\
**Post date:** [May 5, 2026, 9:38am UTC](https://community.dynatrace.com/t/hikaricp-jmx-unable-to-split-pool-metrics-by-pool-name-when-multiple-pools-exist-in-the-same-jvm/55797/1 "2026-05-05T09:38:56Z")

</div>

Hi everyone,

I’m working with **Dynatrace Managed on prem** and a **custom JMX extension** to collect **HikariCP metrics**.

I can successfully collect metrics from both:

- com.zaxxer.hikari:type=PoolConfig
- com.zaxxer.hikari:type=Pool

There is however an important difference between the two:

- **PoolConfig** exposes a PoolName attribute → I can define a dimension (e.g. pool.name) and split metrics per pool

- **Pool** does **not** expose the pool name as an attribute → the pool name only appears in the ObjectName display, not as a key property

Because of this, when **multiple Hikari pools run in the same JVM** , Dynatrace:

- collects Pool metrics correctly
- but **aggregates them at JVM level**
- making it impossible to split runtime metrics (ActiveConnections, IdleConnections, etc.) per pool

Example:

- Pool A: IdleConnections = 2
- Pool B: IdleConnections = 5
- Dynatrace reports: IdleConnections = 7 for the same process

This makes per‑pool monitoring and alerting unreliable.

Constraints:

- I cannot modify the application code
- I cannot change how HikariCP exposes its JMX MBeans
- Only the Dynatrace side (extension/configuration) can be adjusted

**Question:**  
Is this a known limitation with HikariCP JMX in Dynatrace Managed?  
Is there any supported Dynatrace‑side workaround to avoid Pool metric aggregation when multiple pools exist in the same JVM?

Thanks in advance for any feedback or guidance.  
My extension code :

```javascript
name: custom:hikari.jmx.metrics
version: 1.0.1
minDynatraceVersion: 1.303.0

author:
  name: M
metrics:
  - key: hikari.connections.active
    metadata:
      displayName: Hikari Active Connections
      unit: Count

  - key: hikari.connections.idle
    metadata:
      displayName: Hikari Idle Connections
      unit: Count

  - key: hikari.connections.total
    metadata:
      displayName: Hikari Total Connections
      unit: Count

  - key: hikari.threads.awaiting
    metadata:
      displayName: Hikari Threads Awaiting Connection
      unit: Count

  - key: hikari.connections.acquired
    metadata:
      displayName: Hikari Connections Acquired
      unit: Count

  - key: hikari.connections.created
    metadata:
      displayName: Hikari Connections Created
      unit: Count

  - key: hikari.connections.timeout
    metadata:
      displayName: Hikari Connections Timeout
      unit: Count

  - key: hikari.config.connection.timeout
    metadata:
      displayName: Hikari Connection Timeout
      unit: MilliSecond

  - key: hikari.config.idle.timeout
    metadata:
      displayName: Hikari Idle Timeout
      unit: MilliSecond

  - key: hikari.config.max.lifetime
    metadata:
      displayName: Hikari Max Lifetime
      unit: MilliSecond

  - key: hikari.config.validation.timeout
    metadata:
      displayName: Hikari Validation Timeout
      unit: MilliSecond

  - key: hikari.config.minimum.idle
    metadata:
      displayName: Hikari Minimum Idle
      unit: Count

  - key: hikari.config.maximum.pool.size
    metadata:
      displayName: Hikari Maximum Pool Size
      unit: Count

  - key: hikari.config.leak.detection.threshold
    metadata:
      displayName: Hikari Leak Detection Threshold
      unit: MilliSecond

  - key: hikari.config.keepalive.time
    metadata:
      displayName: Hikari Keepalive Time
      unit: MilliSecond

  - key: hikari.config.initialization.fail.timeout
    metadata:
      displayName: Hikari Initialization Fail Timeout
      unit: MilliSecond

jmx:
  groups:
    - group: hikari
      subgroups:

        # =========================
        # POOL (pool.name depuis ObjectName)
        # =========================
        - subgroup: pool
          query: "com.zaxxer.hikari:type=Pool (*)"

          dimensions:
            - key: pool.name
              value: property:name

          metrics:
            - key: hikari.connections.active
              type: gauge
              value:
                attribute: ActiveConnections

            - key: hikari.connections.idle
              type: gauge
              value:
                attribute: IdleConnections

            - key: hikari.connections.total
              type: gauge
              value:
                attribute: TotalConnections

            - key: hikari.threads.awaiting
              type: gauge
              value:
                attribute: ThreadsAwaitingConnection

            - key: hikari.connections.acquired
              type: count
              value:
                attribute: ConnectionsAcquired

            - key: hikari.connections.created
              type: count
              value:
                attribute: ConnectionsCreated

            - key: hikari.connections.timeout
              type: count
              value:
                attribute: ConnectionsTimeout

        # =========================
        # POOL CONFIG (pool.name via attribute)
        # =========================
        - subgroup: poolconfig
          query: "com.zaxxer.hikari:type=PoolConfig (*)"

          dimensions:
            - key: pool.name
              value:
                attribute: PoolName

          metrics:
            - key: hikari.config.connection.timeout
              type: gauge
              value:
                attribute: ConnectionTimeout

            - key: hikari.config.idle.timeout
              type: gauge
              value:
                attribute: IdleTimeout

            - key: hikari.config.max.lifetime
              type: gauge
              value:
                attribute: MaxLifetime

            - key: hikari.config.validation.timeout
              type: gauge
              value:
                attribute: ValidationTimeout

            - key: hikari.config.minimum.idle
              type: gauge
              value:
                attribute: MinimumIdle

            - key: hikari.config.maximum.pool.size
              type: gauge
              value:
                attribute: MaximumPoolSize

            - key: hikari.config.leak.detection.threshold
              type: gauge
              value:
                attribute: LeakDetectionThreshold

            - key: hikari.config.keepalive.time
              type: gauge
              value:
                attribute: KeepaliveTime

            - key: hikari.config.initialization.fail.timeout
              type: gauge
              value:
                attribute: InitializationFailTimeout

```
