Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df8db0e0 authored by David Chen's avatar David Chen Committed by android-build-merger
Browse files

Merge "Fix statsd dropping metrics data." into pi-dev

am: dc2dda5c

Change-Id: I83ef6b23ecd0083658f011c5248e0c6cfe9bec92
parents 3c0ad631 dc2dda5c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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()) {
+7 −3
Original line number Diff line number Diff line
@@ -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.