Merge "Add a sampling method to pull gauge when condition changes to true." into pi-dev

This commit is contained in:
Yang Lu
2018-05-10 02:37:49 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 1 deletions

View File

@@ -324,6 +324,10 @@ void GaugeMetricProducer::pullLocked(const int64_t timestampNs) {
triggerPuller = true;
break;
}
case GaugeMetric::CONDITION_CHANGE_TO_TRUE: {
triggerPuller = mCondition;
break;
}
default:
break;
}
@@ -348,7 +352,7 @@ void GaugeMetricProducer::onConditionChangedLocked(const bool conditionMet,
flushIfNeededLocked(eventTimeNs);
mCondition = conditionMet;
if (mPullTagId != -1 && mCondition) {
if (mPullTagId != -1) {
pullLocked(eventTimeNs);
} // else: Push mode. No need to proactively pull the gauge data.
}

View File

@@ -234,6 +234,7 @@ message GaugeMetric {
enum SamplingType {
RANDOM_ONE_SAMPLE = 1;
ALL_CONDITION_CHANGES = 2;
CONDITION_CHANGE_TO_TRUE = 3;
}
optional SamplingType sampling_type = 9 [default = RANDOM_ONE_SAMPLE] ;