I implemented a Prometheus Counter to get the no. of requests to a service. When I called the service I got the following error.
Exception in thread "HTTP-Listener I/O dispatcher-1" java.lang.NoClassDefFoundError: io/prometheus/client/Counter
I added the following dependencies to the pom.xml file.
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<version>0.8.1</version>
</dependency>
<!-- Hotspot JVM metrics-->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_hotspot</artifactId>
<version>0.8.1</version>
</dependency>
<!-- Exposition HTTPServer-->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_httpserver</artifactId>
<version>0.8.1</version>
</dependency>
This is my java instrumentation
private Counter requestsReceived;
requestsReceived = Counter.build().name("requests_total_Sample").help("Total
requests.").register();
requestsReceived.inc();
How can I solve this issue?