Merge "Add a sampling method to pull gauge when condition changes to true." into pi-dev am: c2f44a19b2
am: 85d7b2a060
Change-Id: I0ca761b2a13c95c86c604873d80597ba91a3d8bb
diff --git a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
index a940d58..06d8bcd 100644
--- a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
@@ -324,6 +324,10 @@
triggerPuller = true;
break;
}
+ case GaugeMetric::CONDITION_CHANGE_TO_TRUE: {
+ triggerPuller = mCondition;
+ break;
+ }
default:
break;
}
@@ -348,7 +352,7 @@
flushIfNeededLocked(eventTimeNs);
mCondition = conditionMet;
- if (mPullTagId != -1 && mCondition) {
+ if (mPullTagId != -1) {
pullLocked(eventTimeNs);
} // else: Push mode. No need to proactively pull the gauge data.
}
diff --git a/cmds/statsd/src/statsd_config.proto b/cmds/statsd/src/statsd_config.proto
index fd36560..9b5d72b 100644
--- a/cmds/statsd/src/statsd_config.proto
+++ b/cmds/statsd/src/statsd_config.proto
@@ -234,6 +234,7 @@
enum SamplingType {
RANDOM_ONE_SAMPLE = 1;
ALL_CONDITION_CHANGES = 2;
+ CONDITION_CHANGE_TO_TRUE = 3;
}
optional SamplingType sampling_type = 9 [default = RANDOM_ONE_SAMPLE] ;