Skip to content

Commit

Permalink
fix(metrics): hold strong reference to probes results in micrometer g…
Browse files Browse the repository at this point in the history
…auge
  • Loading branch information
wbabyte committed Oct 4, 2024
1 parent 90eaf81 commit e17fa16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,8 @@ public CompletableFuture<Map<Probe, Result>> evaluate(final Set<String> probeIds
}
});
}

public Map<Probe, Result> getCachedResults() {
return lastProbeResults;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void bindTo(@NonNull MeterRegistry registry) {
try {
for (Map.Entry<Probe, Result> entry : probeRegistry.evaluate().get().entrySet()) {
Gauge
.builder("node", entry, e -> e.getValue().isHealthy() ? 1d : 0d)
.builder("node", probeRegistry, e -> e.getCachedResults().get(entry.getKey()).isHealthy() ? 1d : 0d)
.tag("probe", entry.getKey().id())
.description("The health-check probes of the node")
.baseUnit("health")
Expand Down

0 comments on commit e17fa16

Please sign in to comment.