Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7fcf00c authored by tsaichristine's avatar tsaichristine
Browse files

Remove data dropping as an invalid bucket case

ValueMetric's #dropData function flushes and clears the current bucket
only if the drop time coincides with the end of the bucket. Otherwise,
if the current bucket is a partial bucket, we keep this bucket for
further aggregation so it should not be marked invalid.

Test: bit statsd_test:*
Bug: 145918755
Change-Id: I73bccf8fe9e223bd7927fffe2f1665744ae1b452
parent 98585a6c
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -183,11 +183,9 @@ void ValueMetricProducer::onSlicedConditionMayChangeLocked(bool overallCondition

void ValueMetricProducer::dropDataLocked(const int64_t dropTimeNs) {
    StatsdStats::getInstance().noteBucketDropped(mMetricId);
    // We are going to flush the data without doing a pull first so we need to invalidte the data.
    bool pullNeeded = mIsPulled && mCondition == ConditionState::kTrue;
    if (pullNeeded) {
        invalidateCurrentBucket();
    }

    // The current partial bucket is not flushed and does not require a pull,
    // so the data is still valid.
    flushIfNeededLocked(dropTimeNs);
    clearPastBucketsLocked(dropTimeNs);
}