Skip to content

Commit

Permalink
Publish consistent Proxy metrics
Browse files Browse the repository at this point in the history
Closes gh-92
  • Loading branch information
jonatan-ivanov committed Dec 12, 2024
1 parent ba4b022 commit 9bb6dac
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ public PrometheusController(PrometheusMeterRegistry meterRegistry, PrometheusCon
.tag("exception", "none")
.publishPercentileHistogram()
.register(meterRegistry);

this.scrapeTimerClosed = meterRegistry.timer("prometheus.proxy.scrape", "outcome", "closed", "exception", "none");
this.scrapeTimerClosed = Timer.builder("prometheus.proxy.scrape")
.tag("outcome", "closed")
.tag("exception", "none")
.publishPercentileHistogram()
.register(meterRegistry);
this.scrapePayload = DistributionSummary.builder("prometheus.proxy.scrape.payload")
.publishPercentileHistogram()
.baseUnit("bytes")
Expand Down Expand Up @@ -173,9 +176,13 @@ public Mono<String> prometheus() {
if (throwable instanceof ClosedChannelException) {
sample.stop(scrapeTimerClosed);
} else {
sample.stop(meterRegistry.timer("prometheus.proxy.scrape",
"outcome", "error",
"exception", throwable.getMessage()));
sample.stop(
Timer.builder("prometheus.proxy.scrape")
.tag("outcome", "error")
.tag("exception", throwable.getMessage())
.publishPercentileHistogram()
.register(meterRegistry)
);
}

return connectionState.getDyingPush();
Expand Down

0 comments on commit 9bb6dac

Please sign in to comment.