org.zodiac.actuate.prometheus.PrometheusActuatorEndpoint Maven / Gradle / Ivy
package org.zodiac.actuate.prometheus;
import java.io.IOException;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import io.micrometer.prometheus.PrometheusMeterRegistry;
@RestControllerEndpoint(id = "prometheus-scrape")
public class PrometheusActuatorEndpoint {
private PrometheusMeterRegistry prometheusMeterRegistry;
public PrometheusActuatorEndpoint(PrometheusMeterRegistry prometheusMeterRegistry) {
this.prometheusMeterRegistry = prometheusMeterRegistry;
}
@ResponseBody
@RequestMapping(produces = MediaType.TEXT_PLAIN_VALUE)
public String writeMetrics() throws IOException {
return prometheusMeterRegistry.scrape();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy