All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.actuate.prometheus.PrometheusActuatorEndpoint Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
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