1
|
package eu.dnetlib.metrics;
|
2
|
|
3
|
import io.micrometer.prometheus.PrometheusMeterRegistry;
|
4
|
import org.apache.commons.logging.Log;
|
5
|
import org.apache.commons.logging.LogFactory;
|
6
|
import org.springframework.beans.factory.annotation.Autowired;
|
7
|
import org.springframework.stereotype.Controller;
|
8
|
import org.springframework.web.bind.annotation.RequestMapping;
|
9
|
import org.springframework.web.bind.annotation.RequestMethod;
|
10
|
import org.springframework.web.bind.annotation.ResponseBody;
|
11
|
|
12
|
/**
|
13
|
* Created by Alessia Bardi on 2019-06-21.
|
14
|
*
|
15
|
* @author Alessia Bardi
|
16
|
*/
|
17
|
@Controller
|
18
|
@RequestMapping(value = "/prom")
|
19
|
public final class PrometheusEndpoint {
|
20
|
|
21
|
private static final Log log = LogFactory.getLog(PrometheusEndpoint.class);
|
22
|
|
23
|
@Autowired
|
24
|
private PrometheusMeterRegistry registry;
|
25
|
|
26
|
@RequestMapping(method = RequestMethod.GET)
|
27
|
@ResponseBody
|
28
|
public String getStudents() {
|
29
|
log.info("/prometheus [GET]");
|
30
|
return registry.scrape();
|
31
|
}
|
32
|
}
|