[ 
https://issues.apache.org/jira/browse/SOLR-15083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17626835#comment-17626835
 ] 

Houston Putman commented on SOLR-15083:
---------------------------------------

I don't really have an issue with the underlying Solr metrics being in 
nanoseconds/milliseconds. If we want to have general consistency across our 
time metrics out of Solr, then converting it to milliseconds (for the Solr 
response) is fine with me. 

bq. Another option I didn't list but of course applies as well, is just to 
change the math in the prometheus XML to convert to seconds.

Ahhh I misunderstood and thought that was what your suggestion was. I vote for 
this. (independently of changing from nano -> micro inside of Solr)

> prometheus-exporter metric solr_metrics_jvm_os_cpu_time_seconds is misnamed
> ---------------------------------------------------------------------------
>
>                 Key: SOLR-15083
>                 URL: https://issues.apache.org/jira/browse/SOLR-15083
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - prometheus-exporter
>    Affects Versions: 8.6, 9.0
>            Reporter: Mathieu Marie
>            Assignee: David Smiley
>            Priority: Blocker
>              Labels: monitoring, newdev, prometheus
>
> *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]
>  {code}
>           <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>
> {code}
> In the above config we see that the metric came from  *os.processCpuTime*, 
> which itself came from JMX call 
> [getProcessCpuTime()|https://docs.oracle.com/javase/7/docs/jre/api/management/extension/com/sun/management/OperatingSystemMXBean.html#getProcessCpuTime()].
> That javadoc says
> {code}
> 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.
> {code}
> Nanoseconds / 1000 is microseconds.
> Either the name or the computation should be updated.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to