rightjoin
rightjoin

Reputation: 77

Quarkus - Pushing Micrometer metrics to prometheus

I have gone through the guide at https://quarkus.io/guides/micrometer. I want to capture a basic metric telling me how many times a particular endpoint is called, and have used MeterRegistry for my purpose.

registry.counter("request").increment();

I am able to see this metric at http://localhost:8080/hello/q/metrics. Now I want to push this metric to prometheus, but I haven't been able to find any guide for that, which shows how to register/integrate the metrics with prometheus. Ideally, I would like to push them to graphite, but that isn't supported. So I would like to know how to push these metrics so I can visualise them in Grafana.

Upvotes: 1

Views: 2215

Answers (1)

ebullient
ebullient

Reputation: 1280

A few things (integrating also comments above).

Out of the box (unless you turn them off), all endpoint requests are already measured using a timer called "http.server.requests", as noted in the guide here: https://quarkus.io/guides/micrometer#review-automatically-generated-metrics. If you look at prometheus output (using the /q/metrics endpoint), you will see http_server_requests_seconds_count indicating how many times your endpoint has been invoked (the URL is in a tag).

There is a graphite extension in Quarkiverse. Add the graphite extension to your pom:

<dependency>
    <groupId>io.quarkiverse.micrometer.registry</groupId>
    <artifactId>quarkus-micrometer-registry-graphite</artifactId>
</dependency>

And update the quarkus configuration in application.properties as described in the docs: https://quarkiverse.github.io/quarkiverse-docs/quarkus-micrometer-registry/dev/micrometer-registry-graphite.html

Upvotes: 1

Related Questions