diff options
author | 2018-03-23 17:40:18 +0000 | |
---|---|---|
committer | 2018-03-23 17:40:18 +0000 | |
commit | dc2dda5c49ebf76a0004a7a95aa9af4cfea84763 (patch) | |
tree | de02d6a33e91b8ed37e550523a4a8bafee268cfb | |
parent | 14372aaabcebec33c1b8f0a19b665bf65503c758 (diff) | |
parent | 4c6d97a1e4e3f758d8725a980af0679f57f95ac8 (diff) |
Merge "Fix statsd dropping metrics data." into pi-dev
-rw-r--r-- | cmds/statsd/src/StatsLogProcessor.cpp | 2 | ||||
-rw-r--r-- | cmds/statsd/src/guardrail/StatsdStats.h | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/cmds/statsd/src/StatsLogProcessor.cpp b/cmds/statsd/src/StatsLogProcessor.cpp index 82274a6e4c59..a35570bd7bba 100644 --- a/cmds/statsd/src/StatsLogProcessor.cpp +++ b/cmds/statsd/src/StatsLogProcessor.cpp @@ -360,7 +360,7 @@ void StatsLogProcessor::flushIfNecessaryLocked( metricsManager.dropData(timestampNs); StatsdStats::getInstance().noteDataDropped(key); VLOG("StatsD had to toss out metrics for %s", key.ToString().c_str()); - } else if (totalBytes > .9 * StatsdStats::kMaxMetricsBytesPerConfig) { + } else if (totalBytes > StatsdStats::kBytesPerConfigTriggerGetData) { // Send broadcast so that receivers can pull data. auto lastBroadcastTime = mLastBroadcastTimes.find(key); if (lastBroadcastTime != mLastBroadcastTimes.end()) { diff --git a/cmds/statsd/src/guardrail/StatsdStats.h b/cmds/statsd/src/guardrail/StatsdStats.h index c42514a04925..a4f64ddfd3a5 100644 --- a/cmds/statsd/src/guardrail/StatsdStats.h +++ b/cmds/statsd/src/guardrail/StatsdStats.h @@ -96,9 +96,13 @@ public: const static int kMaxLogSourceCount = 50; - // Max memory allowed for storing metrics per configuration. When this limit is approached, - // statsd will send a broadcast so that the client can fetch the data and clear this memory. - static const size_t kMaxMetricsBytesPerConfig = 128 * 1024; + // Max memory allowed for storing metrics per configuration. If this limit is exceeded, statsd + // drops the metrics data in memory. + static const size_t kMaxMetricsBytesPerConfig = 256 * 1024; + + // Soft memory limit per configuration. Once this limit is exceeded, we begin notifying the + // data subscriber that it's time to call getData. + static const size_t kBytesPerConfigTriggerGetData = 128 * 1024; // Cap the UID map's memory usage to this. This should be fairly high since the UID information // is critical for understanding the metrics. |