• 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.appsearch;
20
21import "frameworks/proto_logging/stats/atom_field_options.proto";
22import "frameworks/proto_logging/stats/atoms.proto";
23import "frameworks/proto_logging/stats/enums/appsearch/enums.proto";
24
25option java_package = "com.android.os.appsearch";
26option java_multiple_files = true;
27
28extend Atom {
29  // Pushed atoms
30  optional AppSearchSetSchemaStatsReported app_search_set_schema_stats_reported = 385 [(module) = "appsearch"];
31  optional AppSearchSchemaMigrationStatsReported
32          app_search_schema_migration_stats_reported = 579 [(module) = "appsearch"];
33
34  optional AppSearchUsageSearchIntentStatsReported
35          app_search_usage_search_intent_stats_reported = 825 [(module) = "appsearch"];
36
37  optional AppSearchUsageSearchIntentRawQueryStatsReported
38          app_search_usage_search_intent_raw_query_stats_reported = 826
39          [(module) = "appsearch", (restriction_category) = RESTRICTION_SYSTEM_INTELLIGENCE];
40
41  optional AppSearchAppsIndexerStatsReported
42          app_search_apps_indexer_stats_reported = 909 [(module) = "appsearch"];
43
44  optional AppSearchVmPayloadStatsReported
45          app_search_vm_payload_stats_reported = 1047 [(module) = "appsearch"];
46}
47
48// Keep in sync with
49// packages/modules/AppSearch/framework/java/external/android/app/appsearch/stats/BaseStats.java
50enum AppSearchEnabledFeatures {
51    APP_SEARCH_ENABLED_UNKNOWN = 0;
52    APP_SEARCH_ENABLED_LAUNCH_VM = 0x0001; // 1 << 0
53}
54
55/**
56 * Logs detailed stats for setting schema in AppSearch.
57 *
58 * stats pushed from:
59 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
60 *
61 * Next tag: 27
62 */
63message AppSearchSetSchemaStatsReported {
64    // The sampling interval for this specific type of stats
65    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
66    optional int32 sampling_interval = 1;
67
68    // # of previous skipped sample for this specific type of stats
69    // We can't push atoms too closely, so some samples might be skipped
70    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
71    // For example, the true count of an event could be estimated as:
72    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
73    optional int32 num_skipped_sample = 2;
74
75    // Package UID of the application.
76    optional int32 uid = 3 [(is_uid) = true];
77
78    // Hash of the database name within AppSearch
79    optional int32 database = 4;
80
81    // Needs to be sync with AppSearchResult#ResultCode in
82    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
83    optional int32 status_code = 5;
84
85    // Overall time used for setting schema including the binder latency
86    optional int32 total_latency_millis = 6;
87
88    // Number of newly added schema types
89    optional int32 new_type_count = 7;
90
91    // Number of deleted schema types
92    optional int32 deleted_type_count = 8;
93
94    // Number of compatible schema type changes
95    optional int32 compatible_type_change_count = 9;
96
97    // Number of index-incompatible schema type changes
98    optional int32 index_incompatible_type_change_count = 10;
99
100    // Number of backwards-incompatible schema type changes
101    optional int32 backwards_incompatible_type_change_count = 11;
102
103    // Time used for verifying the incoming call.
104    optional int32  verify_incoming_call_latency_millis = 12;
105
106    // Time used for creating or waiting the user executor.
107    optional int32  executor_acquisition_latency_millis = 13;
108
109    // Time used for rebuilding objects from bundles.
110    optional int32  rebuild_from_bundle_latency_millis = 14;
111
112    // Time passed while waiting to acquire the lock during Java function calls.
113    optional int32  java_lock_acquisition_latency_millis = 15;
114
115    // Time used for the rewrite schema to proto.
116    optional int32  rewrite_schema_latency_millis = 16;
117
118    // Overall time used for the native function call.
119    optional int32  total_native_latency_millis = 17;
120
121    // Time used for the apply visibility settings function call.
122    optional int32  visibility_setting_latency_millis = 18;
123
124    // Time used for the dispatch change notification function call.
125    optional int32  dispatch_change_notifications_latency_millis = 19;
126
127    // Time used for the optimization function call.
128    optional int32  optimize_latency_millis = 20;
129
130    /** Whether this package is observed. */
131    optional bool is_package_observed = 21;
132
133    /** Time used for the get old schema. */
134    optional int32  get_old_schema_latency_millis = 22;
135
136    /** Time used for the get registered observer function call. */
137    optional int32  get_observer_latency_millis = 23;
138
139    /** Time used for the preparing change notification action. */
140    optional int32  preparing_change_notification_latency_millis = 24;
141
142    // Type of the SetSchema call relative to SchemaMigration case.
143    // This is in sync with
144    // packages/modules/AppSearch/service/java/com/android/server/appsearch/external/localstorage/stats/SetSchemaStats.java
145    optional int32 schema_migration_call_type = 25;
146
147    // The bitmask for all enabled features on this device. Must be one or a combination of the
148    // types AppSearchEnabledFeatures.
149    optional int64 enabled_features = 26;
150}
151
152/**
153 * Logs detailed stats for schema migration in AppSearch.
154 *
155 * stats pushed from:
156 *   packages/modules/AppSearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
157 *
158 * Next tag: 16
159 */
160message AppSearchSchemaMigrationStatsReported {
161    // The sampling interval for this specific type of stats
162    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
163    optional int32 sampling_interval = 1;
164
165    // # of previous skipped sample for this specific type of stats
166    // We can't push atoms too closely, so some samples might be skipped
167    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
168    // For example, the true count of an event could be estimated as:
169    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
170    optional int32 num_skipped_sample = 2;
171
172    // Package UID of the application.
173    optional int32 uid = 3 [(is_uid) = true];
174
175    // Hash of the database name within AppSearch
176    optional int32 database = 4;
177
178    // Needs to be sync with AppSearchResult#ResultCode in
179    // packages/modules/AppSearch/framework/java/external/android/app/appsearch/AppSearchResult.java
180    optional int32 status_code = 5;
181
182    // Overall time used for setting schema including the binder latency
183    optional int32 total_latency_millis = 6;
184
185    // Overall time used for getting schema during schema migration
186    optional int32 schema_migration_get_schema_latency_millis = 7;
187
188    // Overall time used for querying and transforming documents during schema migration
189    optional int32 schema_migration_query_and_transform_latency_millis = 8;
190
191    // Overall time used for first setSchema during schema migration
192    optional int32 schema_migration_first_set_schema_latency_millis = 9;
193
194    // Overall time used for second setSchema during schema migration
195    optional int32 schema_migration_second_set_schema_latency_millis = 10;
196
197    // Overall time used for saving documents during schema migration
198    optional int32 schema_migration_save_document_latency_millis = 11;
199
200    // Number of document that need to be migrated to another version
201    optional int32 total_need_migrated_document_count = 12;
202
203    // Number of successfully migrated and saved in Icing
204    optional int32 total_success_migrated_document_count = 13;
205
206    // Number of migration failure during schema migration
207    optional int32 schema_migration_failure_count = 14;
208
209    // The bitmask for all enabled features on this device. Must be one or a combination of the
210    // types AppSearchEnabledFeatures.
211    optional int64 enabled_features = 15;
212}
213
214/**
215 * Usage detailed stats (excluding raw query string) for search intent in AppSearch.
216 *
217 * stats pushed from:
218 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
219 *
220 * Next tag: 11
221 */
222message AppSearchUsageSearchIntentStatsReported {
223    // Package UID of the application.
224    optional int32 uid = 1 [(is_uid) = true];
225
226    // Hash of the database name within AppSearch.
227    optional int32 database = 2;
228
229    // Timestamp of search request issued by the client.
230    optional int64 search_intent_timestamp_millis = 3;
231
232    // How many result documents being fetched in this search intent.
233    optional int32 num_results_fetched = 4;
234
235    // The correction type of the query in this search intent compared with the previous search
236    // intent.
237    optional android.appsearch.QueryCorrectionType query_correction_type = 5;
238
239    // The following fields with prefix "clicks_" contain numbers (e.g. timestamp, rank) for all
240    // clicks associated with the search intent.
241    // Due to statsd restriction, we have to separate them into multiple repeated fields with
242    // primitive type.
243    repeated int64 clicks_timestamp_millis = 6;
244    repeated int64 clicks_time_stay_on_result_millis = 7;
245    repeated int32 clicks_result_rank_in_block = 8;
246    repeated int32 clicks_result_rank_global = 9;
247
248    // The bitmask for all enabled features on this device. Must be one or a combination of the
249    // types AppSearchEnabledFeatures.
250    optional int64 enabled_features = 10;
251}
252
253/**
254 * Privacy preserved usage detailed stats (including raw query strings) for search intent in
255 * AppSearch.
256 *
257 * stats pushed from:
258 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
259 *
260 * Next tag: 10
261 */
262message AppSearchUsageSearchIntentRawQueryStatsReported {
263    // Package name of the application.
264    optional string package_name = 1;
265
266    // Hash of the database name within AppSearch.
267    optional int32 database = 2;
268
269    // Raw query string of the previous search intent.
270    optional string prev_query = 3 [(field_restriction_option).system_search = true];
271
272    // Raw query string of the current search intent.
273    optional string curr_query = 4 [(field_restriction_option).system_search = true];
274
275    // How many result documents being fetched in this search intent.
276    optional int32 num_results_fetched = 5;
277
278    // How many click actions being taken in this search intent.
279    optional int32 num_clicks = 6;
280
281    // How many good click actions (i.e. the user stays on the clicked results for reasonable time)
282    // being taken in this search intent.
283    optional int32 num_good_clicks = 7;
284
285    // The correction type of the query in this search intent compared with the previous search
286    // intent.
287    optional android.appsearch.QueryCorrectionType query_correction_type = 8;
288
289    // The bitmask for all enabled features on this device. Must be one or a combination of the
290    // types AppSearchEnabledFeatures.
291    optional int64 enabled_features = 9;
292}
293
294/**
295 * Reported when AppSearch Apps Indexer syncs apps from PackageManager to AppSearch.
296 *
297 * Logged from:
298 *   packages/modules/AppSearch/service/java/com/android/server/appsearch/appsindexer/AppsIndexerManagerService.java
299 * Estimated Logging Rate:
300 *    Peak: 20 times in 10*1000 ms | Avg: 1 per device per day
301 *
302 * Next tag: 19
303 */
304message AppSearchAppsIndexerStatsReported {
305  enum UpdateType {
306    UNKNOWN = 0;
307    FULL = 1;
308  }
309
310  // Type of the update. An additional "package intent" update type may be added
311  optional UpdateType update_type = 1;
312
313  // Status codes for inserting/updating apps. If everything succeeds, this only contains [0]. If
314  // something fails, this contains all the error codes we got.
315  repeated int32 update_status_codes = 2;
316
317  // Update counts
318  optional int32 number_of_apps_added = 3;
319  optional int32 number_of_apps_removed = 4;
320  optional int32 number_of_apps_updated = 5;
321  optional int32 number_of_apps_unchanged = 6;
322
323  // Latencies
324  optional int64 total_latency_millis = 7;
325  optional int64 package_manager_latency_millis = 8;
326  optional int64 get_all_apps_from_appsearch_latency_millis = 9;
327  optional int64 set_schema_for_all_apps_latency_millis = 10;
328  optional int64 index_all_apps_to_appsearch_latency_millis = 11;
329
330  // Timestamps
331  optional int64 update_start_wallclock_timestamp_millis = 12;
332  optional int64 last_app_updated_wallclock_timestamp_millis = 13;
333
334  // App Function counts
335  optional int32 number_of_functions_added = 14;
336  optional int32 number_of_functions_removed = 15;
337  optional int32 number_of_functions_updated = 16;
338  optional int32 number_of_functions_unchanged = 17;
339
340  // App Function removal latency
341  optional int64 remove_functions_from_appsearch_appsearch_latency_millis = 18;
342}
343
344/**
345 * Reported when AppSearch VM payload statistics are collected and reported.
346 *
347 * This message encapsulates various metrics related to the execution and outcome of
348 * a pVM payload.
349 *
350 * Next tag: 7
351 */
352message AppSearchVmPayloadStatsReported {
353
354  // The sampling interval for this specific type of stats
355  // For example, sampling_interval=10 means that one out of every 10 stats was logged.
356  optional int32 sampling_interval = 1;
357
358  // # of previous skipped sample for this specific type of stats
359  // We can't push atoms too closely, so some samples might be skipped
360  // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
361  // For example, the true count of an event could be estimated as:
362  //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
363  optional int32 num_skipped_sample = 2;
364
365  /**  The type of VMCallback that triggered this report.  */
366  optional int32 callback_type = 3;
367
368  /**
369   * The exit code of the AppSearch {@code IsolateStorageService.VMCallback#onPayloadFinished()}
370   * call.
371   */
372  optional int32 exit_code = 4;
373
374  /**
375   * The error code associated with the AppSearch {@code IsolateStorageService.VMCallback.onError()}
376   * call.
377   */
378  optional int32 error_code = 5;
379
380  /**
381   * The reason for stopping the AppSearch {@code IsolateStorageService.VMCallback.onStopped()}
382   * call.
383   */
384  optional int32 stop_reason = 6;
385}
386