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

Commit d31a5e3e authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Merge "Add shard ID to statsd atom for procstats collection" into...

Merge "Merge "Add shard ID to statsd atom for procstats collection" into rvc-dev am: b0f26f32 am: ddd439cf" into rvc-d1-dev-plus-aosp am: 0370e42b am: 5c163f44

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11971040

Change-Id: Iad67e8ceddf67e04416d0bda39a94012b276f70d
parents 737a3b28 5c163f44
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -6144,6 +6144,10 @@ message ProcessStatsAvailablePagesProto {
 */
message ProcStats {
    optional ProcessStatsSectionProto proc_stats_section = 1;
    // Data pulled from device into this is sometimes sharded across multiple atoms to work around
    // a size limit. When this happens, this shard ID will contain an increasing 1-indexed integer
    // with the number of this shard.
    optional int32 shard_id = 2;
}

/**
+9 −3
Original line number Diff line number Diff line
@@ -2575,11 +2575,17 @@ public class StatsPullAtomService extends SystemService {
                    lastHighWaterMark, section, true, statsFiles, procStats);
            procStats.dumpAggregatedProtoForStatsd(protoStreams, MAX_PROCSTATS_RAW_SHARD_SIZE);

            for (ProtoOutputStream proto : protoStreams) {
                if (proto.getBytes().length > 0) {
            for (int i = 0; i < protoStreams.length; i++) {
                byte[] bytes = protoStreams[i].getBytes(); // cache the value
                if (bytes.length > 0) {
                    StatsEvent e = StatsEvent.newBuilder()
                            .setAtomId(atomTag)
                            .writeByteArray(proto.getBytes())
                            .writeByteArray(bytes)
                            // This is a shard ID, and is specified in the metric definition to be
                            // a dimension. This will result in statsd using RANDOM_ONE_SAMPLE to
                            // keep all the shards, as it thinks each shard is a different dimension
                            // of data.
                            .writeInt(i)
                            .build();
                    pulledData.add(e);
                }