Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-16137

prometheus_exporter configuration generates duplicated values for 1 metric

    XMLWordPrintableJSON

Details

    Description

      The prometheus-exporter comes with a default configuration in the file `solr_exporter_config.xml`. It seems that the `jq` configuration to parse metrics from Solr to Prometheus has a small bug for one metric:

      In the selection done for `solr_metrics_core_requests_total`, the condition assumes that there will be 1 result, but there are actually 3 because there are these paths in the JSON (for a given core):

      "QUERY./select.requestTimes"
      "QUERY./select.local.requestTimes"
      "QUERY./select.distrib.requestTimes"

      and the selection is done like:

      $jq:core(requests_total, select(.key | endswith(".requestTimes")) | select (.value | type == "object"), count) 

      The generated Prometheus metrics have the same name and set of labels, thus they are identical for Prometheus and trigger a "duplicated metric" error further in the processing.

       

      A simple solution is to fix the select condition, like:

      $jq:core(requests_total, select(.key | endswith(".requestTimes") and (contains(".local.") or contains(".distrib.") | not)) | select (.value | type == "object"), count) 

      (assuming that we want the total requestTimes count).

      Attachments

        Activity

          People

            Unassigned Unassigned
            cesarfm César Fuentes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: