prometheus: fix scrape duration growing unbounded (#13667)#13696
Open
PrashantBhanage wants to merge 1 commit into
Open
prometheus: fix scrape duration growing unbounded (#13667)#13696PrashantBhanage wants to merge 1 commit into
PrashantBhanage wants to merge 1 commit into
Conversation
Three changes scoped exclusively to the prometheus exporter plugin: 1. Bounded HTTP executor — give the HttpServer a FixedThreadPool(2) instead of the JDK default single-threaded executor; shut it down cleanly in stop(). 2. TTL guard on updateMetrics() — add a synchronized guard with a last-run timestamp so scrapes arriving faster than the configurable minimum interval (prometheus.exporter.metrics.min.refresh.interval, default 5 s) reuse the previously computed metrics instead of triggering a new recomputation. 3. Timing instrumentation — wrap updateMetrics() body with System.nanoTime() start/end and log elapsed wall-clock time at info level on every run (including exception path), so slow sub-collectors can be identified from logs. Fixes: apache#13667 Ref: apache#13586
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.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A — backend-only change, no UI impact.
How Has This Been Tested?
How did you try to break this feature and the system with this change?
/metricsscrape requests to verify the bounded executor and synchronization prevent overlapping recomputation.stop().prometheus.exporter.metrics.min.refresh.intervalat runtime changes the refresh behavior without requiring a restart.