diff options
| author | 2019-02-28 10:47:04 +0000 | |
|---|---|---|
| committer | 2019-02-28 10:47:04 +0000 | |
| commit | 3e4cc422bdc56c95c50943bc89e76abf8337508f (patch) | |
| tree | c15ed2d2bfca2488348535331ee5586e4c22eb78 | |
| parent | 606210ec8b7f60d332da7b43450cdba2b8765b83 (diff) | |
| parent | e35b282c0c2e71a1b2642980048381f4b1cbc104 (diff) | |
Merge "Reset the condition to the initial state."
| -rw-r--r-- | cmds/statsd/src/metrics/MetricProducer.h | 6 | ||||
| -rw-r--r-- | cmds/statsd/src/metrics/ValueMetricProducer.cpp | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/cmds/statsd/src/metrics/MetricProducer.h b/cmds/statsd/src/metrics/MetricProducer.h index 99cb5d4389c7..046f9963b351 100644 --- a/cmds/statsd/src/metrics/MetricProducer.h +++ b/cmds/statsd/src/metrics/MetricProducer.h @@ -69,7 +69,7 @@ public: mTimeBaseNs(timeBaseNs), mCurrentBucketStartTimeNs(timeBaseNs), mCurrentBucketNum(0), - mCondition(conditionIndex >= 0 ? ConditionState::kUnknown : ConditionState::kTrue), + mCondition(initialCondition(conditionIndex)), mConditionSliced(false), mWizard(wizard), mConditionTrackerIndex(conditionIndex), @@ -82,6 +82,10 @@ public: virtual ~MetricProducer(){}; + ConditionState initialCondition(const int conditionIndex) const { + return conditionIndex >= 0 ? ConditionState::kUnknown : ConditionState::kTrue; + } + /** * Forces this metric to split into a partial bucket right now. If we're past a full bucket, we * first call the standard flushing code to flush up to the latest full bucket. Then we call diff --git a/cmds/statsd/src/metrics/ValueMetricProducer.cpp b/cmds/statsd/src/metrics/ValueMetricProducer.cpp index 9de62a2cce03..27ee57013fda 100644 --- a/cmds/statsd/src/metrics/ValueMetricProducer.cpp +++ b/cmds/statsd/src/metrics/ValueMetricProducer.cpp @@ -394,7 +394,7 @@ void ValueMetricProducer::onConditionChangedLocked(const bool condition, invalidateCurrentBucket(); // Something weird happened. If we received another event if the future, the condition might // be wrong. - mCondition = ConditionState::kUnknown; + mCondition = initialCondition(mConditionTrackerIndex); } // This part should alway be called. |