Uploaded image for project: 'Cloud Native Runtimes (CNR) Documentation'
  1. Cloud Native Runtimes (CNR) Documentation
  2. CNRDOC-1974

SB runtime guide - prometheus metrics does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • Spring Boot 2.3.4, Spring Boot 2.3.6

      Procedure for using prometheus metrics in springboot application has several faults. Procedure is here.

      Discovered faults:

      • In prerequisites, there is statement that prometheus have to run on your cluster, but rest of the manual is made for localhost.
      • In example pom, there is "micrometer-registry-prometheus" artefacts stated in version 1.1.0. Version 1.1.0 is old and does not work with SB 2.3.4. Up to date version is 1.6.1 which works.
      • Exposing metrics and collecting them in prometheus does not work by default. you have to do these additional steps
      1. Prometheus expects the metrics to be at endpoint "/metrics" by default. But SB exposes them on "/actuator/prometheus" endpoint. Prometheus have to be configured to collect them there.
      2. Metric endpoint is not exposed by default, you have to expose it by adding this pro properties file:
        management.endpoints.web.exposure.include=prometheus
        
      • Querying the prometheus - step. 5 - When I open the prometheus and type "requests" into the expression box I have 3 susggestions: "http_server_requests_seconds_count", "http_server_requests_seconds_max", "http_server_requests_seconds_sum", there is no "http.server.requests" as stated in 5.II
      • Don't know if this is problem of docs or product. Following step 2 to enable metrics collection only at annotated endpoints does not seem to work. I disabled the auto-time-requests using
        management.metrics.web.server.auto-time-requests=false

        and created two endpoints: one with

        @Timed

        and one without it - both have the same prometheus metrics reported.

              amehenda@redhat.com Ashwin Mehendale
              mocenas@redhat.com Martin Ocenas
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: