1// Copyright 2022 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.cloud.datacatalog.v1;
18
19import "google/api/field_behavior.proto";
20import "google/protobuf/timestamp.proto";
21
22option cc_enable_arenas = true;
23option csharp_namespace = "Google.Cloud.DataCatalog.V1";
24option go_package = "cloud.google.com/go/datacatalog/apiv1/datacatalogpb;datacatalogpb";
25option java_multiple_files = true;
26option java_package = "com.google.cloud.datacatalog.v1";
27option php_namespace = "Google\\Cloud\\DataCatalog\\V1";
28option ruby_package = "Google::Cloud::DataCatalog::V1";
29
30// Detailed statistics on the entry's usage.
31//
32// Usage statistics have the following limitations:
33//
34// - Only BigQuery tables have them.
35// - They only include BigQuery query jobs.
36// - They might be underestimated because wildcard table references
37//   are not yet counted. For more information, see
38//   [Querying multiple tables using a wildcard table]
39//   (https://cloud.google.com/bigquery/docs/querying-wildcard-tables)
40message UsageStats {
41  // The number of successful uses of the underlying entry.
42  float total_completions = 1;
43
44  // The number of failed attempts to use the underlying entry.
45  float total_failures = 2;
46
47  // The number of cancelled attempts to use the underlying entry.
48  float total_cancellations = 3;
49
50  // Total time spent only on successful uses, in milliseconds.
51  float total_execution_time_for_completions_millis = 4;
52}
53
54// Common statistics on the entry's usage.
55//
56// They can be set on any system.
57message CommonUsageStats {
58  // View count in source system.
59  optional int64 view_count = 1;
60}
61
62// The set of all usage signals that Data Catalog stores.
63//
64// Note: Usually, these signals are updated daily. In rare cases, an update may
65// fail but will be performed again on the next day.
66message UsageSignal {
67  // The end timestamp of the duration of usage statistics.
68  google.protobuf.Timestamp update_time = 1;
69
70  // Output only. BigQuery usage statistics over each of the predefined time
71  // ranges.
72  //
73  // Supported time ranges are `{"24H", "7D", "30D"}`.
74  map<string, UsageStats> usage_within_time_range = 2
75      [(google.api.field_behavior) = OUTPUT_ONLY];
76
77  // Common usage statistics over each of the predefined time ranges.
78  //
79  // Supported time ranges are `{"24H", "7D", "30D", "Lifetime"}`.
80  map<string, CommonUsageStats> common_usage_within_time_range = 3;
81
82  // Favorite count in the source system.
83  optional int64 favorite_count = 4;
84}
85