summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author tsaichristine <tsaichristine@google.com> 2019-12-06 18:40:47 -0800
committer tsaichristine <tsaichristine@google.com> 2019-12-09 15:57:53 -0800
commitb7fcf00c776a7a04d0b45c1f6c0099cf9bd20885 (patch)
treee9182c263c73af5ca0e86742f9c8c51404af12dd
parent98585a6c0ca86e855ffb6b8674efe79b0dfb2444 (diff)
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
-rw-r--r--cmds/statsd/src/metrics/ValueMetricProducer.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/cmds/statsd/src/metrics/ValueMetricProducer.cpp b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
index eb78ebc521e1..975a230df765 100644
--- a/cmds/statsd/src/metrics/ValueMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
@@ -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);
}