[#5575] feat(metrics):add Hive Catalog Metrics for HMS connection pool#12118
Open
yangyuxia wants to merge 1 commit into
Open
[#5575] feat(metrics):add Hive Catalog Metrics for HMS connection pool#12118yangyuxia wants to merge 1 commit into
yangyuxia wants to merge 1 commit into
Conversation
Code Coverage Report
Files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
ClientPoolImpl: AddcurrentSize()andidleCount()getters to expose pool state for monitoring.CachedClientPool: AddtotalCurrentSize(),totalIdleCount(), andtotalPoolSize()methods that aggregate metrics across all per-user pools in the Caffeine cache.MetricsProvider(new): Interface incoremodule that decouplesHiveCatalogMetricsSourcefromCachedClientPool, avoiding circular dependency betweencoreandhive-metastore-common.HiveCatalogMetricsSource(new): DropwizardCatalogMetricsSourceimplementation that registers three Gauges:datasource.active-connections— total connections in use across all user poolsdatasource.idle-connections— total idle connections across all user poolsdatasource.max-connections— total configured pool capacity across all user poolsHiveCatalogOperations: RegisterHiveCatalogMetricsSourceduringinitialize()with aMetricsProvideradapter that delegates toCachedClientPool's aggregated methods. Unregister inclose().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.*")