Search code examples
restmonitoringprometheusspark-java

How can I expose metrics with spark framework?


I'm using spark framework (http://sparkjava.com).

I need to expose metrics in order to use with prometheus.

for example I have a get request:

get("/hello", (req, res) -> 1000);

How can I now expose the metrics ?


Solution

  • Prometheus provides client library for java, Client_java. You can integrate it with your framework.

    Here is a working example.