Statsd config TTL
Roughly check the config every hour to see whether the ttl expired.
If so, read the config from disk and recreate the metric manager.
Test: statsd test
BUG: b/77274363
Change-Id: I16838afe5bbe966c3a0f638869751f9b59a5a259
diff --git a/cmds/statsd/src/metrics/GaugeMetricProducer.h b/cmds/statsd/src/metrics/GaugeMetricProducer.h
index 9605b13..f49180f 100644
--- a/cmds/statsd/src/metrics/GaugeMetricProducer.h
+++ b/cmds/statsd/src/metrics/GaugeMetricProducer.h
@@ -65,7 +65,7 @@
void onDataPulled(const std::vector<std::shared_ptr<LogEvent>>& data) override;
// GaugeMetric needs to immediately trigger another pull when we create the partial bucket.
- void notifyAppUpgrade(const uint64_t& eventTimeNs, const string& apk, const int uid,
+ void notifyAppUpgrade(const int64_t& eventTimeNs, const string& apk, const int uid,
const int64_t version) override {
std::lock_guard<std::mutex> lock(mMutex);
@@ -87,32 +87,32 @@
const LogEvent& event) override;
private:
- void onDumpReportLocked(const uint64_t dumpTimeNs,
+ void onDumpReportLocked(const int64_t dumpTimeNs,
android::util::ProtoOutputStream* protoOutput) override;
// for testing
GaugeMetricProducer(const ConfigKey& key, const GaugeMetric& gaugeMetric,
const int conditionIndex, const sp<ConditionWizard>& wizard,
- const int pullTagId, const uint64_t startTimeNs,
+ const int pullTagId, const int64_t startTimeNs,
std::shared_ptr<StatsPullerManager> statsPullerManager);
// Internal interface to handle condition change.
- void onConditionChangedLocked(const bool conditionMet, const uint64_t eventTime) override;
+ void onConditionChangedLocked(const bool conditionMet, const int64_t eventTime) override;
// Internal interface to handle sliced condition change.
- void onSlicedConditionMayChangeLocked(bool overallCondition, const uint64_t eventTime) override;
+ void onSlicedConditionMayChangeLocked(bool overallCondition, const int64_t eventTime) override;
// Internal function to calculate the current used bytes.
size_t byteSizeLocked() const override;
void dumpStatesLocked(FILE* out, bool verbose) const override;
- void dropDataLocked(const uint64_t dropTimeNs) override;
+ void dropDataLocked(const int64_t dropTimeNs) override;
// Util function to flush the old packet.
- void flushIfNeededLocked(const uint64_t& eventTime) override;
+ void flushIfNeededLocked(const int64_t& eventTime) override;
- void flushCurrentBucketLocked(const uint64_t& eventTimeNs) override;
+ void flushCurrentBucketLocked(const int64_t& eventTimeNs) override;
void pullLocked();