diff options
| author | 2018-05-10 02:37:49 +0000 | |
|---|---|---|
| committer | 2018-05-10 02:37:49 +0000 | |
| commit | c2f44a19b29ba7cbe1e114b7233a99ef70dedbb5 (patch) | |
| tree | 46393e53cde72db4d1de9bfc3f99489358b3f6af | |
| parent | 3f57b16deb78134cf4690819a844f4d941c01710 (diff) | |
| parent | ec3c7a3e58757a23afbb494b5fd9f1a1081fa495 (diff) | |
Merge "Add a sampling method to pull gauge when condition changes to true." into pi-dev
| -rw-r--r-- | cmds/statsd/src/metrics/GaugeMetricProducer.cpp | 6 | ||||
| -rw-r--r-- | cmds/statsd/src/statsd_config.proto | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp index a940d58b7c4d..06d8bcd21ef1 100644 --- a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp +++ b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp @@ -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. } diff --git a/cmds/statsd/src/statsd_config.proto b/cmds/statsd/src/statsd_config.proto index fd365602427d..9b5d72bf56dc 100644 --- a/cmds/statsd/src/statsd_config.proto +++ b/cmds/statsd/src/statsd_config.proto @@ -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] ; |