Skip to content

Commit

Permalink
Prometheus now requires Content-Type
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Jan 9, 2025
1 parent 2abaefa commit 68eff1d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions jpos/src/main/java/org/jpos/metrics/PrometheusService.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ protected void startService() throws ConfigurationException {
server = HttpServer.create(new InetSocketAddress(port), 0);
server.createContext(path, httpExchange -> {
String response = registry.scrape();
httpExchange.getResponseHeaders().add("Content-Type", "text/plain; version=0.0.4");
httpExchange.sendResponseHeaders(200, response.getBytes().length);
try (OutputStream os = httpExchange.getResponseBody()) {
os.write(response.getBytes());
Expand Down

0 comments on commit 68eff1d

Please sign in to comment.