import io.prometheus.client.Counter;
import io.prometheus.client.exporter.HTTPServer;
public class SimpleMetricExporter {
public static void main(String[] args) throws Exception {
Counter requestsCounter = Counter.build()
.name("http_requests_total")
.labelNames("method", "status")
.help("Total HTTP requests")
.register();
for (int i = 0; i < 10; i++) {
requestsCounter.labels("GET", "200").inc();
}
HTTPServer server = new HTTPServer(8080);
server.start();
}
}