New Relic Java Agent HikariCP Pool Exhaustion Timestamp Granularity Limits
0 reputation · 05 Jul 2024, 18:32 UTC
0 reputation · 05 Jul 2024, 18:32 UTC
The goal is to determine whether the New Relic Java agent records the exact moment a HikariCP connection pool reaches its maximum size, or only reports aggregated connection counts at each harvest window.
The agent collects pool metrics on a default 60‑second harvest cycle, and Java agent 8.x renamed the metric namespace from Database/ConnectionPool/* to Datastore/ConnectionPool/*, which affects historical queries. The setting connection_pool_monitoring.enabled controls collection, and disabling it removes all pool visibility.
Specific questions: 1) Does the agent capture a precise timestamp when the pool hits max connections, or only per‑harvest aggregates? 2) How does the metric name change between Database/ConnectionPool/* and Datastore/ConnectionPool/* impact querying for exhaustion events? 3) Can NRQL alerts on max(Database/ConnectionPool/Active) reliably detect sub‑minute spikes given the 60‑second harvest interval?
31775 reputation · 06 Jul 2024, 04:41 UTC
1) Timestamp granularity – The New Relic Java agent does not emit a separate event with a sub‑second timestamp when a HikariCP pool reaches its maximum size. It samples the pool metrics at each harvest interval (default 60 s) and stores the aggregated Active, Idle, and Max values for that window. Therefore you can only see the exact moment of exhaustion if the pool stays at or above the limit for an entire harvest period.
2) Metric‑name change impact – Starting with Java agent 8.x the metric namespace shifted from Database/ConnectionPool/* to Datastore/ConnectionPool/*. Historical data collected with agents ≤ 7.x remains under the old prefix, while newer agents use the new prefix. To query both eras in a single NRQL statement you can use a wildcard, e.g.: FROM Metric SELECT max(*) WHERE name LIKE '%ConnectionPool/Active%'. If you query only the old prefix you will miss data from agents 8.x+, and vice‑versa.
3) NRQL alert reliability for sub‑minute spikes – An alert that evaluates max(Database/ConnectionPool/Active) (or the new Datastore/ConnectionPool/Active) over a 60‑second window can only trigger when the elevated value persists for at least one full harvest interval. Shorter bursts that last less than the harvest period are averaged with lower values and may never cross the alert threshold. To detect sub‑minute exhaustion you must either reduce the harvest interval (e.g., to 10 s) or rely on application‑level logging.
connection_pool_monitoring.enabled=true in newrelic.yml.common.structure.metrics.enabled=true
common.structure.metrics.interval=10 (values in seconds). Restart the Java agent after changing.maximumPoolSize for a known short duration (e.g., 15 s). After the test, run an NRQL query like: SELECT max(active) FROM Metric WHERE name LIKE '%ConnectionPool/Active%' TIMESERIES 10 seconds and observe whether the spike appears in the returned series.Database/ConnectionPool/Active and Datastore/ConnectionPool/Active; you should see data only from the respective agent versions unless you use a wildcard.connection_pool_monitoring.enabled=false), verify that no pool‑related metrics appear in the UI or NRQL (SELECT * FROM Metric WHERE name LIKE '%ConnectionPool%' returns empty).Note: Changing the harvest interval increases metric volume and may affect ingestion costs; adjust only after evaluating the trade‑off.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.