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
This commit is contained in:
tsaichristine
2019-12-06 18:40:47 -08:00
parent 98585a6c0c
commit b7fcf00c77

View File

@@ -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);
}