Joe McDonnell created IMPALA-15088:
--------------------------------------

             Summary: Improve interoperability of IntGauge and FunctionGauge 
for read-only code
                 Key: IMPALA-15088
                 URL: https://issues.apache.org/jira/browse/IMPALA-15088
             Project: IMPALA
          Issue Type: Improvement
          Components: Backend
    Affects Versions: Impala 5.0.0
            Reporter: Joe McDonnell


The IntGauge type is an alias for AtomicMetric<TMetricKind::GAUGE>, which has 
an atomic int64_t that can be updated. However, we also use IntGauge for many 
other things that are read only. Here are some examples:
 * MemTracker can take an IntGauge consumption metric to integrate it into the 
MemTracker hierarchy (e.g. tcmalloc overhead)
 * SumGauge reads multiple IntGauges and returns the sum
 * NegatedGauge reads a single IntGauge and negates it
 * Memory metrics override IntGauge but get the values from gperftools 
MallocExtension (or other equivalents)

These are read only uses of IntGauge or situations where the IntGauge behaves 
more like a FunctionGauge. Since FunctionGauge doesn't inherit from IntGauge, 
it makes it hard to use FunctionGauge with any of these pieces of code.

Since these are all read-only uses, it might make sense to create a 
ReadOnlyIntGauge alias that is the base class of FunctionGauge and IntGauge. 
i.e.
{noformat}
using ReadOnlyIntGauge = ScalarMetric<int64_t, TMetricKind::GAUGE>;{noformat}
Read only uses work properly with this base class, and it makes it possible for 
IntGauges and FunctionGauges to interoperate with this code.

This would be very useful for the memory metrics. In particular, the derived 
metric classes like TotalBytesReservedMetric or the OverheadBytesMetric from 
the MallocUtil change would be unnecessary if they could be expressed as 
FunctionGauges.



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

Reply via email to