diff options
author | Yao Chen <yaochen@google.com> | 2019-04-10 10:43:20 -0700 |
---|---|---|
committer | Yao Chen <yaochen@google.com> | 2019-04-11 14:15:43 -0700 |
commit | 9a43b4f02763872a7843d23b2fe050976669f021 (patch) | |
tree | 6dd431ed58ddb4a635172f34b5329f3b8f37a0dc /cmds/statsd/src/metrics/MetricsManager.cpp | |
parent | 8d3cb6b3fd2e0f85c8dac16b2413f3256cde307a (diff) |
Add a config option to save the metrics data locally.
Usually after config owner calls statsd to get data, statsd will remove that data
forever. This cl adds an option to save historical data locally so that when a bugreport
is taken, it contains historical statsd metrics for debugging.
+ All existing guardrail on storage still apply, and local history data has lower
priority when the guardrail is hit. On top of that, statsd will remove history
files that are more than 2 days old.
+ Also fixed issues inside StorageManager (e.g.,
using string::compare to sort by timestamp is problematic, redundant file size read, etc)
Test: statsd_test and manually
Fix: 126562025
Change-Id: I5238b9fd3069cbef5bcccabd2212bc4d6c734702
Diffstat (limited to 'cmds/statsd/src/metrics/MetricsManager.cpp')
-rw-r--r-- | cmds/statsd/src/metrics/MetricsManager.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmds/statsd/src/metrics/MetricsManager.cpp b/cmds/statsd/src/metrics/MetricsManager.cpp index 095f9dde6129..6a55289bc8a2 100644 --- a/cmds/statsd/src/metrics/MetricsManager.cpp +++ b/cmds/statsd/src/metrics/MetricsManager.cpp @@ -65,7 +65,8 @@ MetricsManager::MetricsManager(const ConfigKey& key, const StatsdConfig& config, mTtlNs(config.has_ttl_in_seconds() ? config.ttl_in_seconds() * NS_PER_SEC : -1), mTtlEndNs(-1), mLastReportTimeNs(currentTimeNs), - mLastReportWallClockNs(getWallClockNs()) { + mLastReportWallClockNs(getWallClockNs()), + mShouldPersistHistory(config.persist_locally()) { // Init the ttl end timestamp. refreshTtl(timeBaseNs); |