[
https://issues.apache.org/jira/browse/KUDU-2934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16930353#comment-16930353
]
YifanZhang edited comment on KUDU-2934 at 9/17/19 10:07 AM:
------------------------------------------------------------
The metric 'average_diskrowset_height' is now defined as a type of
'AtomicGauge' metric, however, 'AtomicGauge' is only for types that are
convertible to/from int64_t, when setting value for the metric, the double
value will be converted to int64_t value, which will lost precision.
{code:java}
virtual void set_value(const T& value){
value_.Store(static_cast<int64_t>(value), kMemOrderNoBarrier);
}{code}
Furthermore, for this kind of 'average' metric, we should also store the
original value of numerator and denominator, and then we can calculate the
overall average value when merge metrics.
Based on the above two reasons, maybe we should add a new gauge type for
'average' metrics.
was (Author: zhangyifan27):
The metric 'average_diskrowset_height' is AtomicGauge type, even though it was
declared as AtomicGauge<double> type, the value of the metric will be converted
to an int64_t value. It seems unreasonable. Maybe we can add a new type of
metric for 'average_xxx' metrics and then we can merge the metric in another
way.
> Bad merge behavior for some metrics
> -----------------------------------
>
> Key: KUDU-2934
> URL: https://issues.apache.org/jira/browse/KUDU-2934
> Project: Kudu
> Issue Type: Bug
> Components: metrics
> Affects Versions: 1.11.0
> Reporter: Yingchun Lai
> Priority: Minor
>
> We added a feature to merge metrics by commit
> fe6e5cc0c9c1573de174d1ce7838b449373ae36e ([metrics] Merge metrics by the same
> attribute), for AtomicGauge type metrics, we sum up of merged metrics, this
> work for almost all of metrics in Kudu.
> But I found a metric that could not be merged like this simply, i.e.
> "average_diskrowset_height", because it's a "average" value.
--
This message was sent by Atlassian Jira
(v8.3.2#803003)