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

prometheus-exporter metric solr_metrics_jvm_os_cpu_time_seconds is misnamed

    XMLWordPrintableJSON

    Details

      Description

      solr_metrics_jvm_os_cpu_time_seconds metric exported by prometheus-exporter has seconds in its name, however it appears that it is microseconds.

      This name can create confusion when one wants to report it in a dashboard.
      That metric is defined in https://github.com/apache/lucene-solr/blob/branch_8_5/solr/contrib/prometheus-exporter/conf/solr-exporter-config.xml#L247

       

                <str>
                  .metrics["solr.jvm"] | to_entries | .[] | select(.key == "os.processCpuTime") as $object |
                  ($object.value / 1000.0) as $value |
                  {
                    name         : "solr_metrics_jvm_os_cpu_time_seconds",
                    type         : "COUNTER",
                    help         : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html",
                    label_names  : ["item"],
                    label_values : ["processCpuTime"],
                    value        : $value
                  }
                </str>
      

      In the above config we see that the metric came from  os.processCpuTime, which itself came from JMX call getProcessCpuTime().

      That javadoc says

      long getProcessCpuTime()
      Returns the CPU time used by the process on which the Java virtual machine is running in nanoseconds. The returned value is of nanoseconds precision but not necessarily nanoseconds accuracy. This method returns -1 if the the platform does not support this operation.
      Returns:
      the CPU time used by the process in nanoseconds, or -1 if this operation is not supported.
      

      Nanoseconds / 1000 is microseconds.
      Either the name or the computation should be updated.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              matmarie Mathieu Marie
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: