summaryrefslogtreecommitdiff
path: root/statsd/src/metrics/GaugeMetricProducer.h
diff options
context:
space:
mode:
Diffstat (limited to 'statsd/src/metrics/GaugeMetricProducer.h')
-rw-r--r--statsd/src/metrics/GaugeMetricProducer.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/statsd/src/metrics/GaugeMetricProducer.h b/statsd/src/metrics/GaugeMetricProducer.h
index af995359..f0a59ce1 100644
--- a/statsd/src/metrics/GaugeMetricProducer.h
+++ b/statsd/src/metrics/GaugeMetricProducer.h
@@ -76,8 +76,14 @@ public:
virtual ~GaugeMetricProducer();
// Handles when the pulled data arrives.
- void onDataPulled(const std::vector<std::shared_ptr<LogEvent>>& data,
- bool pullSuccess, int64_t originalPullTimeNs) override;
+ void onDataPulled(const std::vector<std::shared_ptr<LogEvent>>& data, PullResult pullResult,
+ int64_t originalPullTimeNs) override;
+
+ // Determine if metric needs to pull
+ bool isPullNeeded() const override {
+ std::lock_guard<std::mutex> lock(mMutex);
+ return mIsActive && (mCondition == ConditionState::kTrue);
+ };
// GaugeMetric needs to immediately trigger another pull when we create the partial bucket.
void notifyAppUpgradeInternalLocked(const int64_t eventTimeNs) override {
@@ -143,7 +149,7 @@ private:
// Only call if mCondition == ConditionState::kTrue && metric is active.
void pullAndMatchEventsLocked(const int64_t timestampNs);
- bool onConfigUpdatedLocked(
+ optional<InvalidConfigReason> onConfigUpdatedLocked(
const StatsdConfig& config, const int configIndex, const int metricIndex,
const std::vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
const std::unordered_map<int64_t, int>& oldAtomMatchingTrackerMap,
@@ -221,6 +227,7 @@ private:
FRIEND_TEST(GaugeMetricProducerTest, TestFirstBucket);
FRIEND_TEST(GaugeMetricProducerTest, TestPullOnTrigger);
FRIEND_TEST(GaugeMetricProducerTest, TestRemoveDimensionInOutput);
+ FRIEND_TEST(GaugeMetricProducerTest, TestPullDimensionalSampling);
FRIEND_TEST(GaugeMetricProducerTest_PartialBucket, TestPushedEvents);
FRIEND_TEST(GaugeMetricProducerTest_PartialBucket, TestPulled);