1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.datastore.v1; 18 19import "google/api/field_behavior.proto"; 20import "google/protobuf/duration.proto"; 21import "google/protobuf/struct.proto"; 22 23option csharp_namespace = "Google.Cloud.Datastore.V1"; 24option go_package = "google.golang.org/genproto/googleapis/datastore/v1;datastore"; 25option java_multiple_files = true; 26option java_outer_classname = "QueryProfileProto"; 27option java_package = "com.google.datastore.v1"; 28option php_namespace = "Google\\Cloud\\Datastore\\V1"; 29option ruby_package = "Google::Cloud::Datastore::V1"; 30 31// Specification of the Datastore Query Profile fields. 32 33// Explain options for the query. 34message ExplainOptions { 35 // Optional. Whether to execute this query. 36 // 37 // When false (the default), the query will be planned, returning only 38 // metrics from the planning stages. 39 // 40 // When true, the query will be planned and executed, returning the full 41 // query results along with both planning and execution stage metrics. 42 bool analyze = 1 [(google.api.field_behavior) = OPTIONAL]; 43} 44 45// Explain metrics for the query. 46message ExplainMetrics { 47 // Planning phase information for the query. 48 PlanSummary plan_summary = 1; 49 50 // Aggregated stats from the execution of the query. Only present when 51 // [ExplainOptions.analyze][google.datastore.v1.ExplainOptions.analyze] is set 52 // to true. 53 ExecutionStats execution_stats = 2; 54} 55 56// Planning phase information for the query. 57message PlanSummary { 58 // The indexes selected for the query. For example: 59 // [ 60 // {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"}, 61 // {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"} 62 // ] 63 repeated google.protobuf.Struct indexes_used = 1; 64} 65 66// Execution statistics for the query. 67message ExecutionStats { 68 // Total number of results returned, including documents, projections, 69 // aggregation results, keys. 70 int64 results_returned = 1; 71 72 // Total time to execute the query in the backend. 73 google.protobuf.Duration execution_duration = 3; 74 75 // Total billable read operations. 76 int64 read_operations = 4; 77 78 // Debugging statistics from the execution of the query. Note that the 79 // debugging stats are subject to change as Firestore evolves. It could 80 // include: 81 // { 82 // "indexes_entries_scanned": "1000", 83 // "documents_scanned": "20", 84 // "billing_details" : { 85 // "documents_billable": "20", 86 // "index_entries_billable": "1000", 87 // "min_query_cost": "0" 88 // } 89 // } 90 google.protobuf.Struct debug_stats = 5; 91} 92