aboutsummaryrefslogtreecommitdiff
path: root/proto/icing/proto/logging.proto
blob: ca795cd591867e5b7be1c96f9c6a396e306f1c1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto2";

package icing.lib;

import "icing/proto/scoring.proto";

option java_package = "com.google.android.icing.proto";
option java_multiple_files = true;
option objc_class_prefix = "ICNG";

// Stats of the top-level function IcingSearchEngine::Initialize().
// Next tag: 14
message InitializeStatsProto {
  // Overall time used for the function call.
  optional int32 latency_ms = 1;

  // The cause of IcingSearchEngine recovering from a previous bad state during
  // initialization.
  enum RecoveryCause {
    // No recovery happened.
    NONE = 0;

    // Data loss in ground truth.
    DATA_LOSS = 1;

    // Data in index is inconsistent with ground truth.
    INCONSISTENT_WITH_GROUND_TRUTH = 2;

    // Changes were made to the schema, but possibly not fully applied to the
    // document store and the index - requiring a recovery.
    SCHEMA_CHANGES_OUT_OF_SYNC = 3;

    // Random I/O errors.
    IO_ERROR = 4;

    // The document log is using legacy format.
    LEGACY_DOCUMENT_LOG_FORMAT = 5;

    // The current code version is different from existing data version.
    VERSION_CHANGED = 6;
  }

  // Possible recovery causes for document store:
  // - DATA_LOSS
  // - SCHEMA_CHANGES_OUT_OF_SYNC
  // - IO_ERROR
  optional RecoveryCause document_store_recovery_cause = 2;

  // Possible recovery causes for index:
  // - INCONSISTENT_WITH_GROUND_TRUTH
  // - SCHEMA_CHANGES_OUT_OF_SYNC
  // - IO_ERROR
  optional RecoveryCause index_restoration_cause = 3;

  // Possible recovery causes for index:
  // - IO_ERROR
  optional RecoveryCause schema_store_recovery_cause = 4;

  // Time used to recover the document store.
  optional int32 document_store_recovery_latency_ms = 5;

  // Time used to restore the index.
  optional int32 index_restoration_latency_ms = 6;

  // Time used to restore the index.
  optional int32 schema_store_recovery_latency_ms = 7;

  // Status regarding how much data is lost during the initialization.
  enum DocumentStoreDataStatus {
    // Document store is successfully initialized or fully recovered.
    NO_DATA_LOSS = 0;

    // Ground truth data is partially lost.
    PARTIAL_LOSS = 1;

    // Ground truth data is completely lost.
    COMPLETE_LOSS = 2;
  }
  optional DocumentStoreDataStatus document_store_data_status = 8;

  // Number of documents currently in document store. Those may
  // include alive, deleted, and expired documents.
  optional int32 num_documents = 9;

  // Number of schema types currently in schema store.
  optional int32 num_schema_types = 10;

  // Number of consecutive initialization failures that immediately preceded
  // this initialization.
  optional int32 num_previous_init_failures = 11;

  // Possible recovery causes for integer index:
  // - INCONSISTENT_WITH_GROUND_TRUTH
  // - SCHEMA_CHANGES_OUT_OF_SYNC
  // - IO_ERROR
  optional RecoveryCause integer_index_restoration_cause = 12;

  // Possible recovery causes for qualified id join index:
  // - INCONSISTENT_WITH_GROUND_TRUTH
  // - SCHEMA_CHANGES_OUT_OF_SYNC
  // - IO_ERROR
  optional RecoveryCause qualified_id_join_index_restoration_cause = 13;
}

// Stats of the top-level function IcingSearchEngine::Put().
// Next tag: 10
message PutDocumentStatsProto {
  // Overall time used for the function call.
  optional int32 latency_ms = 1;

  // Time used to store the document.
  optional int32 document_store_latency_ms = 2;

  // Time used to index the document.
  optional int32 index_latency_ms = 3;

  // Time used to merge the indices.
  optional int32 index_merge_latency_ms = 4;

  // Document size in bytes.
  optional int32 document_size = 5;

  message TokenizationStats {
    // Number of tokens added to the index.
    optional int32 num_tokens_indexed = 1;

    reserved 2;
  }
  optional TokenizationStats tokenization_stats = 6;

  // Time used to index all indexable string terms in the document. It does not
  // include the time to merge indices.
  optional int32 term_index_latency_ms = 7;

  // Time used to index all indexable integers in the document.
  optional int32 integer_index_latency_ms = 8;

  // Time used to index all qualified id join strings in the document.
  optional int32 qualified_id_join_index_latency_ms = 9;
}

// Stats of the top-level function IcingSearchEngine::Search() and
// IcingSearchEngine::GetNextPage().
// Next tag: 23
message QueryStatsProto {
  // The UTF-8 length of the query string
  optional int32 query_length = 16;

  // Number of terms in the query string.
  optional int32 num_terms = 1;

  // Number of namespaces filtered.
  optional int32 num_namespaces_filtered = 2;

  // Number of schema types filtered.
  optional int32 num_schema_types_filtered = 3;

  // Strategy of scoring and ranking.
  optional ScoringSpecProto.RankingStrategy.Code ranking_strategy = 4;

  // Whether the function call is querying the first page. If it’s
  // not, Icing will fetch the results from cache so that some steps
  // may be skipped.
  optional bool is_first_page = 5;

  // The requested number of results in one page.
  optional int32 requested_page_size = 6;

  // The actual number of results returned in the current page.
  optional int32 num_results_returned_current_page = 7;

  // Number of documents scored.
  optional int32 num_documents_scored = 8;

  // How many of the results in the page returned were snippeted.
  optional int32 num_results_with_snippets = 15;

  // Overall time used for the function call.
  optional int32 latency_ms = 10;

  // Time used to parse the query, including 2 parts: tokenizing and
  // transforming tokens into an iterator tree.
  optional int32 parse_query_latency_ms = 11;

  // Time used to score the raw results.
  optional int32 scoring_latency_ms = 12;

  // Time used to rank the scored results.
  optional int32 ranking_latency_ms = 13;

  // Time used to fetch the document protos. Note that it includes the
  // time to snippet if ‘has_snippets’ is true.
  optional int32 document_retrieval_latency_ms = 14;

  // Time passed while waiting to acquire the lock before query execution.
  optional int32 lock_acquisition_latency_ms = 17;

  // Timestamp taken just before sending proto across the JNI boundary from
  // native to java side.
  optional int64 native_to_java_start_timestamp_ms = 18;

  // Time used to send protos across the JNI boundary from java to native side.
  optional int32 java_to_native_jni_latency_ms = 19;

  // Time used to send protos across the JNI boundary from native to java side.
  optional int32 native_to_java_jni_latency_ms = 20;

  // The native latency due to the join operation.
  optional int32 join_latency_ms = 21;

  // Number of documents scored.
  optional int32 num_joined_results_returned_current_page = 22;

  reserved 9;
}

// Stats of the top-level functions IcingSearchEngine::Delete,
// IcingSearchEngine::DeleteByNamespace, IcingSearchEngine::DeleteBySchemaType.
// Next tag: 4
message DeleteStatsProto {
  // Overall time used for the function call.
  optional int32 latency_ms = 1;

  message DeleteType {
    enum Code {
      // Default. Should never be used.
      UNKNOWN = 0;

      // Delete one document.
      SINGLE = 1;

      // Delete by query. This value is deprecated.
      // IcingSearchEngine::DeleteByQuery will return a DeleteByQueryStatsProto
      // rather than a DeleteStatsProto.
      DEPRECATED_QUERY = 2 [deprecated = true];

      // Delete by namespace.
      NAMESPACE = 3;

      // Delete by schema type.
      SCHEMA_TYPE = 4;
    }
  }
  optional DeleteType.Code delete_type = 2;

  // Number of documents deleted by this call.
  optional int32 num_documents_deleted = 3;
}

// Stats of the top-level functions IcingSearchEngine::DeleteByQuery.
// Next tag: 9
message DeleteByQueryStatsProto {
  // Overall time used for the function call.
  optional int32 latency_ms = 1;

  // Number of documents deleted by this call.
  optional int32 num_documents_deleted = 2;

  // The UTF-8 length of the query string
  optional int32 query_length = 3;

  // Number of terms in the query string.
  optional int32 num_terms = 4;

  // Number of namespaces filtered.
  optional int32 num_namespaces_filtered = 5;

  // Number of schema types filtered.
  optional int32 num_schema_types_filtered = 6;

  // Time used to parse the query, including 2 parts: tokenizing and
  // transforming tokens into an iterator tree.
  optional int32 parse_query_latency_ms = 7;

  // Time used to delete each document.
  optional int32 document_removal_latency_ms = 8;
}