Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-2091

Update Quarkus services to expose metrics in localhost:9000/metrics

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Undefined Undefined
    • 2024-03-06 - API
    • None
    • None
    • None

      By default, the Quarkus services expose the metrics endpoint in localhost:8000/q/metrics where 8000 is the server port.
      However, the Clowder enviroment expects the endpoint to be on localhost:9000/metrics where 9000 is the "metricsPort" property and "/metrics" is the "metricsPath" property in the clowder config file. Example:

      {
      "kafka": {
       "brokers": [
         {
           "hostname": "localhost",
           "port": 9092
         }
       ],
       "topics": []
      },
      "metricsPath": "/metrics",
      "metricsPort": 9000,
      "privatePort": 10000,
      "publicPort": 8000,
      "webPort": 8000
      }
      

      So far, we had a custom ServiceMonitor for Quarkus to redirect from "localhost:8000/q/metrics" to "localhost:9000/metrics". This ServiceMonitor only works in the prod and stage environments, and for the pods with a label "prometheus: quarkus".

      The problem is that when porting services from Spring Boot to Quarkus, we can't modify the label (are immutable). This is a known limitation that is meant to be eventually fixed by RHCLOUD-30608.

      Moreover, we can't dinamically configure the metrics path because these are managed by build-time properties.

      Therefore, the ideal solution is to always configure the metrics path to listen on localhost:9000/metrics, so the behaviour will be the same on ephemeral, stage, and prod environments, and for quarkus and spring services.

      This was already done for the swatch-metrics service by SWATCH-2192.

      Acceptance Criteria

      • Apply the same changes from SWATCH-2192 to all Quarkus services.
      • Remove the Quarkus Service Monitor for stage and prod from the app-interface repository.

              jcarvaja@redhat.com Jose Carvajal Hilario
              jcarvaja@redhat.com Jose Carvajal Hilario
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: