Skip to content

Commit

Permalink
Merge branch 'master' into remove-blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
Diewa authored Feb 5, 2025
2 parents 1e96c78 + 1a912ce commit 960ce32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ public ConsumerHttpServer(
"/status/subscriptionsCount",
(exchange) -> respondWithObject(exchange, mapper, monitor.check(SUBSCRIPTIONS_COUNT)));
server.createContext(
"/status/prometheus", (exchange) -> respondWithString(exchange, meterRegistry.scrape()));
"/status/prometheus",
(exchange) -> {
exchange
.getResponseHeaders()
.add("Content-Type", "text/plain;version=0.0.4;charset=utf-8");
respondWithString(exchange, meterRegistry.scrape());
});
}

private HttpServer createServer(int port) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
import io.micrometer.prometheusmetrics.PrometheusMeterRegistry;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.HttpString;

public class PrometheusMetricsHandler implements HttpHandler {

private final PrometheusMeterRegistry meterRegistry;
private static final HttpString httpString = new HttpString("Content-Type");

public PrometheusMetricsHandler(PrometheusMeterRegistry meterRegistry) {
this.meterRegistry = meterRegistry;
}

@Override
public void handleRequest(HttpServerExchange exchange) {
exchange.getResponseHeaders().add(httpString, "text/plain;version=0.0.4;charset=utf-8");
response(exchange, OK, meterRegistry.scrape());
}

Expand Down

0 comments on commit 960ce32

Please sign in to comment.