• 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
42/**
43 * Logs detailed stats for setting schema in AppSearch.
44 *
45 * stats pushed from:
46 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
47 *
48 * Next tag: 26
49 */
50message AppSearchSetSchemaStatsReported {
51    // The sampling interval for this specific type of stats
52    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
53    optional int32 sampling_interval = 1;
54
55    // # of previous skipped sample for this specific type of stats
56    // We can't push atoms too closely, so some samples might be skipped
57    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
58    // For example, the true count of an event could be estimated as:
59    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
60    optional int32 num_skipped_sample = 2;
61
62    // Package UID of the application.
63    optional int32 uid = 3 [(is_uid) = true];
64
65    // Hash of the database name within AppSearch
66    optional int32 database = 4;
67
68    // Needs to be sync with AppSearchResult#ResultCode in
69    // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
70    optional int32 status_code = 5;
71
72    // Overall time used for setting schema including the binder latency
73    optional int32 total_latency_millis = 6;
74
75    // Number of newly added schema types
76    optional int32 new_type_count = 7;
77
78    // Number of deleted schema types
79    optional int32 deleted_type_count = 8;
80
81    // Number of compatible schema type changes
82    optional int32 compatible_type_change_count = 9;
83
84    // Number of index-incompatible schema type changes
85    optional int32 index_incompatible_type_change_count = 10;
86
87    // Number of backwards-incompatible schema type changes
88    optional int32 backwards_incompatible_type_change_count = 11;
89
90    // Time used for verifying the incoming call.
91    optional int32  verify_incoming_call_latency_millis = 12;
92
93    // Time used for creating or waiting the user executor.
94    optional int32  executor_acquisition_latency_millis = 13;
95
96    // Time used for rebuilding objects from bundles.
97    optional int32  rebuild_from_bundle_latency_millis = 14;
98
99    // Time passed while waiting to acquire the lock during Java function calls.
100    optional int32  java_lock_acquisition_latency_millis = 15;
101
102    // Time used for the rewrite schema to proto.
103    optional int32  rewrite_schema_latency_millis = 16;
104
105    // Overall time used for the native function call.
106    optional int32  total_native_latency_millis = 17;
107
108    // Time used for the apply visibility settings function call.
109    optional int32  visibility_setting_latency_millis = 18;
110
111    // Time used for the dispatch change notification function call.
112    optional int32  dispatch_change_notifications_latency_millis = 19;
113
114    // Time used for the optimization function call.
115    optional int32  optimize_latency_millis = 20;
116
117    /** Whether this package is observed. */
118    optional bool is_package_observed = 21;
119
120    /** Time used for the get old schema. */
121    optional int32  get_old_schema_latency_millis = 22;
122
123    /** Time used for the get registered observer function call. */
124    optional int32  get_observer_latency_millis = 23;
125
126    /** Time used for the preparing change notification action. */
127    optional int32  preparing_change_notification_latency_millis = 24;
128
129    // Type of the SetSchema call relative to SchemaMigration case.
130    // This is in sync with
131    // packages/modules/AppSearch/service/java/com/android/server/appsearch/external/localstorage/stats/SetSchemaStats.java
132    optional int32 schema_migration_call_type = 25;
133}
134
135/**
136 * Logs detailed stats for schema migration in AppSearch.
137 *
138 * stats pushed from:
139 *   packages/modules/AppSearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
140 *
141 * Next tag: 15
142 */
143message AppSearchSchemaMigrationStatsReported {
144    // The sampling interval for this specific type of stats
145    // For example, sampling_interval=10 means that one out of every 10 stats was logged.
146    optional int32 sampling_interval = 1;
147
148    // # of previous skipped sample for this specific type of stats
149    // We can't push atoms too closely, so some samples might be skipped
150    // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
151    // For example, the true count of an event could be estimated as:
152    //   SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
153    optional int32 num_skipped_sample = 2;
154
155    // Package UID of the application.
156    optional int32 uid = 3 [(is_uid) = true];
157
158    // Hash of the database name within AppSearch
159    optional int32 database = 4;
160
161    // Needs to be sync with AppSearchResult#ResultCode in
162    // packages/modules/AppSearch/framework/java/external/android/app/appsearch/AppSearchResult.java
163    optional int32 status_code = 5;
164
165    // Overall time used for setting schema including the binder latency
166    optional int32 total_latency_millis = 6;
167
168    // Overall time used for getting schema during schema migration
169    optional int32 schema_migration_get_schema_latency_millis = 7;
170
171    // Overall time used for querying and transforming documents during schema migration
172    optional int32 schema_migration_query_and_transform_latency_millis = 8;
173
174    // Overall time used for first setSchema during schema migration
175    optional int32 schema_migration_first_set_schema_latency_millis = 9;
176
177    // Overall time used for second setSchema during schema migration
178    optional int32 schema_migration_second_set_schema_latency_millis = 10;
179
180    // Overall time used for saving documents during schema migration
181    optional int32 schema_migration_save_document_latency_millis = 11;
182
183    // Number of document that need to be migrated to another version
184    optional int32 total_need_migrated_document_count = 12;
185
186    // Number of successfully migrated and saved in Icing
187    optional int32 total_success_migrated_document_count = 13;
188
189    // Number of migration failure during schema migration
190    optional int32 schema_migration_failure_count = 14;
191}
192
193/**
194 * Usage detailed stats (excluding raw query string) for search intent in AppSearch.
195 *
196 * stats pushed from:
197 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
198 *
199 * Next tag: 10
200 */
201message AppSearchUsageSearchIntentStatsReported {
202    // Package UID of the application.
203    optional int32 uid = 1 [(is_uid) = true];
204
205    // Hash of the database name within AppSearch.
206    optional int32 database = 2;
207
208    // Timestamp of search request issued by the client.
209    optional int64 search_intent_timestamp_millis = 3;
210
211    // How many result documents being fetched in this search intent.
212    optional int32 num_results_fetched = 4;
213
214    // The correction type of the query in this search intent compared with the previous search
215    // intent.
216    optional android.appsearch.QueryCorrectionType query_correction_type = 5;
217
218    // The following fields with prefix "clicks_" contain numbers (e.g. timestamp, rank) for all
219    // clicks associated with the search intent.
220    // Due to statsd restriction, we have to separate them into multiple repeated fields with
221    // primitive type.
222    repeated int64 clicks_timestamp_millis = 6;
223    repeated int64 clicks_time_stay_on_result_millis = 7;
224    repeated int32 clicks_result_rank_in_block = 8;
225    repeated int32 clicks_result_rank_global = 9;
226}
227
228/**
229 * Privacy preserved usage detailed stats (including raw query strings) for search intent in
230 * AppSearch.
231 *
232 * stats pushed from:
233 *   frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
234 *
235 * Next tag: 9
236 */
237message AppSearchUsageSearchIntentRawQueryStatsReported {
238    // Package name of the application.
239    optional string package_name = 1;
240
241    // Hash of the database name within AppSearch.
242    optional int32 database = 2;
243
244    // Raw query string of the previous search intent.
245    optional string prev_query = 3 [(field_restriction_option).system_search = true];
246
247    // Raw query string of the current search intent.
248    optional string curr_query = 4 [(field_restriction_option).system_search = true];
249
250    // How many result documents being fetched in this search intent.
251    optional int32 num_results_fetched = 5;
252
253    // How many click actions being taken in this search intent.
254    optional int32 num_clicks = 6;
255
256    // How many good click actions (i.e. the user stays on the clicked results for reasonable time)
257    // being taken in this search intent.
258    optional int32 num_good_clicks = 7;
259
260    // The correction type of the query in this search intent compared with the previous search
261    // intent.
262    optional android.appsearch.QueryCorrectionType query_correction_type = 8;
263}
264