yangyuxia opened a new pull request, #12118:
URL: https://github.com/apache/gravitino/pull/12118
### What changes were proposed in this pull request?
- **`ClientPoolImpl`**: Add `currentSize()` and `idleCount()` getters to
expose pool state for monitoring.
- **`CachedClientPool`**: Add `totalCurrentSize()`, `totalIdleCount()`, and
`totalPoolSize()` methods that aggregate metrics across all per-user pools in
the Caffeine cache.
- **`MetricsProvider`** (new): Interface in `core` module that decouples
`HiveCatalogMetricsSource` from `CachedClientPool`, avoiding circular
dependency between `core` and `hive-metastore-common`.
- **`HiveCatalogMetricsSource`** (new): Dropwizard `CatalogMetricsSource`
implementation that registers three Gauges:
- `datasource.active-connections` — total connections in use across all
user pools
- `datasource.idle-connections` — total idle connections across all user
pools
- `datasource.max-connections` — total configured pool capacity across all
user pools
- **`HiveCatalogOperations`**: Register `HiveCatalogMetricsSource` during
`initialize()` with a `MetricsProvider` adapter that delegates to
`CachedClientPool`'s aggregated methods. Unregister in `close()`.
### Why are the changes needed?
Add Hive Catalog metrics for monitoring HMS (Hive Metastore) connection pool
usage. This enables operators to observe the number of active, idle, and
maximum connections from Gravitino to HMS via Prometheus, which is critical for
capacity planning and troubleshooting connection exhaustion issues.
Fix: #5575
### Does this PR introduce _any_ user-facing change?
Yes. Users who scrape Gravitino's Prometheus endpoint will now see three new
metrics per Hive Catalog:
gravitino_catalog_hive_{metalake}_{catalog}_datasource_active_connections
gravitino_catalog_hive_{metalake}_{catalog}_datasource_idle_connections
gravitino_catalog_hive_{metalake}_{catalog}_datasource_max_connections
### How was this patch tested?
Unit tests (`./gradlew :core:test --tests "org.apache.gravitino.metrics.*"`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]