• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package android.os.statsd.statsd;
20
21import "frameworks/proto_logging/stats/atoms.proto";
22import "frameworks/proto_logging/stats/atom_field_options.proto";
23import "frameworks/proto_logging/stats/attribution_node.proto";
24
25option java_package = "com.android.os.statsd";
26
27extend Atom {
28    optional TestExtensionAtomReported test_extension_atom_reported =
29            660 [(module) = "cts", (module) = "statsdtest"];
30    optional TestRestrictedAtomReported test_restricted_atom_reported = 672
31    [(module) = "cts", (restriction_category) = RESTRICTION_DIAGNOSTIC];
32    optional StatsSocketLossReported stats_socket_loss_reported =
33            752 [(module) = "statsdsocket", (module) = "statsd", (module) = "statsdtest"];
34}
35
36message TestExtensionAtomNestedMessage {
37    repeated int64 long_field = 1;
38}
39
40/* Test atom, is not logged anywhere */
41message TestExtensionAtomReported {
42    repeated AttributionNode attribution_node = 1;
43    optional int32 int_field = 2;
44    optional int64 long_field = 3;
45    optional float float_field = 4;
46    optional string string_field = 5;
47    optional bool boolean_field = 6;
48    enum State {
49        UNKNOWN = 0;
50        OFF = 1;
51        ON = 2;
52    }
53    optional State state = 7;
54    optional TestExtensionAtomNestedMessage bytes_field =
55            8 [(android.os.statsd.log_mode) = MODE_BYTES];
56    repeated int32 repeated_int_field = 9;
57    repeated int64 repeated_long_field = 10;
58    repeated float repeated_float_field = 11;
59    repeated string repeated_string_field = 12;
60    repeated bool repeated_boolean_field = 13;
61    repeated State repeated_enum_field = 14;
62}
63
64/* Test restricted atom, is not logged anywhere */
65message TestRestrictedAtomReported {
66    optional int32 int_field = 1;
67    optional int64 long_field = 2;
68    optional float float_field = 3;
69    optional string string_field = 4;
70    optional bool boolean_field = 5;
71}
72
73/**
74 * Represents the atom loss info from libstatssocket
75 */
76message StatsSocketLossReported {
77
78    /**
79     * initial set of errors defined based on write() API potential codes
80     * and what is observed via statsdstats LogLosStats.last_error
81     */
82    enum SocketLossError {
83        SOCKET_LOSS_ERROR_UNKNOWN = 0;
84
85        // errno based error codes are negated to not overlap with internal codes
86        // Values are aligned with what is reported by StatsdStatsReport::LogLossStats
87        SOCKET_LOSS_ERROR_ON_WRITE_EDQUOT = -122;
88        SOCKET_LOSS_ERROR_ON_WRITE_EDESTADDRREQ = -89;
89        SOCKET_LOSS_ERROR_ON_WRITE_EPIPE = -32;
90        SOCKET_LOSS_ERROR_ON_WRITE_ENOSPC = -28;
91        SOCKET_LOSS_ERROR_ON_WRITE_EFBIG = -27;
92        SOCKET_LOSS_ERROR_ON_WRITE_EINVAL = -22;
93        SOCKET_LOSS_ERROR_ON_WRITE_ENODEV = -19;
94        SOCKET_LOSS_ERROR_ON_WRITE_EFAULT = -14;
95        SOCKET_LOSS_ERROR_ON_WRITE_EAGAIN = -11; // same as EWOULDBLOCK
96        SOCKET_LOSS_ERROR_ON_WRITE_EBADF = -9;
97        SOCKET_LOSS_ERROR_ON_WRITE_EIO = -5;
98        SOCKET_LOSS_ERROR_ON_WRITE_EINTR = -4;
99        SOCKET_LOSS_ERROR_ON_WRITE_EPERM = -1;
100
101        // internal error codes are positive
102        SOCKET_LOSS_ERROR_QUEUE_OVERFLOW = 1;
103    }
104
105    optional int32 uid = 1 [(is_uid) = true];
106
107    /* denotes timestamp when first socket loss event detected */
108    optional int64 first_timestamp_nanos = 2;
109
110    /* denotes timestamp when last socket loss event detected */
111    optional int64 last_timestamp_nanos = 3;
112
113    /* represents number of times loss info container hits guardrail */
114    optional int32 overflow_count = 4;
115
116    /**
117     * below tuples represent number of times atom loss detected for the pair [error, tag],
118     * where for each pair such as [errors[i], tags[i]] there is a matching counts[i] element
119     *
120     * For ex:
121     * errors [EBUSY,ERROR1,EBUSY,ERROR2]
122     * tags   [    5,     6,    6,     5]
123     * counts [    2,     1,    1,     1]
124     */
125    repeated SocketLossError errors = 5;
126
127    repeated int32 tags = 6;
128
129    repeated int32 counts = 7;
130}
131