Record cluster worker scrape failures - #850
Open
nightjard wants to merge 1 commit into
Open
Conversation
Signed-off-by: SirGundir <crstalhopkin@gmail.com>
nightjard
force-pushed
the
fix/cluster-worker-failure-histogram-290
branch
from
September 4, 2026 19:31
94a6e40 to
801c14c
Compare
jdmarshall
reviewed
Sep 4, 2026
| } | ||
|
|
||
| if (failedWorkers > 0) { | ||
| clusterWorkerScrapeFailures.observe(failedWorkers); |
Contributor
There was a problem hiding this comment.
I think observing 0's when there are no workers is probably unlikely to happen but is also extra information about the class of failure we may be dealing with. As written this will never catch unclassified errors such as an NPE in the try block.
For instance, regressions in the Node API are not unknown. I work on a project that doesn't work on node 24.7-24.16, for instance, due to breaking changes in child_process.fork()
jdmarshall
requested changes
Sep 4, 2026
jdmarshall
left a comment
Contributor
There was a problem hiding this comment.
This same change should be made in worker.js as well, please, to retain feature parity.
| const metrics = await Promise.all( | ||
| registries.map(r => r.getMetricsAsJSON()), | ||
| ); | ||
| metrics.push([await clusterWorkerScrapeFailures.get()]); |
Contributor
There was a problem hiding this comment.
Are you sure you're not double-reporting this? That should be in the default registry.
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.
Summary
Add an internal histogram named
prom_client_cluster_worker_scrape_failuresto record failed cluster metriccollections.
Each observation contains the number of workers that failed to return metrics:
clusterMetrics()call.A histogram preserves information from consecutive failures instead of only
retaining the most recent value, as a gauge would.
Testing
Added tests covering: