[jboss-jira] [JBoss JIRA] (WFLY-11458) Timed - difference between Prometheus and JSON format

Jan Martiska (Jira) issues at jboss.org
Fri Dec 14 07:12:00 EST 2018


    [ https://issues.jboss.org/browse/WFLY-11458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13674745#comment-13674745 ] 

Jan Martiska edited comment on WFLY-11458 at 12/14/18 7:11 AM:
---------------------------------------------------------------

I guess the problem is here https://github.com/smallrye/smallrye-metrics/blob/1.1.2/implementation/src/main/java/io/smallrye/metrics/exporters/PrometheusExporter.java#L273 - IIUC {{scaleToBase}} is for converting to seconds (which is the unit in which we should always be presenting snapshot summaries), but as the input unit param, it is being given {{md.getUnit()}} which denotes the base unit of the metric, but it should instead be NANOSECONDS because that's the unit in which the data is internally stored. So in our case it converts to seconds, but converts from the wrong input unit.
I suppose the {{scaleToBase}} method be rather named {{convertToSecondsOrBytes}} which is what it really does. I was confused at first because I thought "base" referred to the base unit that the metric uses.

Current proposal for fix, but will need some more testing (and adding some more comments because the code is very hard to read IMO): https://github.com/jmartisk/smallrye-metrics/commits/issue-40

Surprisingly this does not seem to be covered in the TCKs either, I will consider adding some tests for that


was (Author: jmartisk):
I guess the problem is here https://github.com/smallrye/smallrye-metrics/blob/1.1.2/implementation/src/main/java/io/smallrye/metrics/exporters/PrometheusExporter.java#L273 - IIUC {{scaleToBase}} is for converting to seconds (which is the unit in which we should always be presenting snapshot summaries), but as the input unit param, it is being given {{md.getUnit()}} which denotes the base unit of the metric, but it should instead be NANOSECONDS because that's the unit in which the data is internally stored. So in our case it converts to seconds, but converts from the wrong input unit.
I suppose the {{scaleToBase}} method be rather named {{convertToSecondsOrBytes}} which is what it really does.

Current proposal for fix, but will need some more testing (and adding some more comments because the code is very hard to read IMO): https://github.com/jmartisk/smallrye-metrics/commits/issue-40

Surprisingly this does not seem to be covered in the TCKs either, I will consider adding some tests for that

> Timed - difference between Prometheus and JSON format
> -----------------------------------------------------
>
>                 Key: WFLY-11458
>                 URL: https://issues.jboss.org/browse/WFLY-11458
>             Project: WildFly
>          Issue Type: Bug
>          Components: MP Metrics
>    Affects Versions: 15.0.0.Final
>            Reporter: Rostislav Svoboda
>            Assignee: Bartosz Baranowski
>            Priority: Critical
>
> There are differences in reported results between Prometheus and JSON format.
> When using the same deployment with OpenLiberty there are no differences in reported results between Prometheus and JSON format.
> https://github.com/smallrye/smallrye-metrics/issues/40



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list