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.
14syntax = "proto3";
15
16package cobalt;
17
18import "metric_definition.proto";
19
20option java_multiple_files = true;
21option java_package = "com.google.cobalt";
22
23////////////////////////////////////////////////////////////////////////////////
24// NOTE: This file is used by the Cobalt client and the Cobalt servers.
25// The source-of-truth of this file is located in Cobalt's open source code
26// repository, and the file is copied to Android where it is used by the Cobalt
27// client. Do not edit the copy of this file in this Android repo as those edits
28// will be overwritten when the file is next copied.
29////////////////////////////////////////////////////////////////////////////////
30
31// ProjectConfigFile is a representation of a yaml config file for a single
32// cobalt project.
33message ProjectConfigFile {
34  reserved 1, 2, 3;
35
36  // Cobalt metric registration.
37  repeated MetricDefinition metric_definitions = 4;
38
39  // Metric IDs that have been previously used and deleted from this project.
40  // These IDs must not be reused in new metrics.
41  repeated uint32 deleted_metric_ids = 5;
42}
43
44// Configuration for the Cobalt projects of a customer.
45message CustomerConfig {
46  string customer_name = 1;
47  uint32 customer_id = 2;
48  repeated ProjectConfig projects = 3;
49
50  // If no experiments_namespaces are specified for individual projects, the
51  // customer's experiments namespaces are used as default.
52  repeated string experiments_namespaces = 4;
53
54  // Project IDs that have been previously used and deleted from this customer.
55  // These IDs must not be reused in new projects.
56  repeated uint32 deleted_project_ids = 5;
57}
58
59// Configuration for a Cobalt project.
60message ProjectConfig {
61  string project_name = 1;
62  uint32 project_id = 2;
63  repeated MetricDefinition metrics = 3;
64  string project_contact = 4;
65
66  // Identifier of the app that is expected to log the metrics for this project.
67  // Depending on the platform, this may represent an "app" or "component", and
68  // the format of package identifiers may be different.
69  string app_package_identifier = 7;
70
71  // Experiment namespaces supported for experiment ids in this project.
72  repeated string experiments_namespaces = 5;
73
74  // Metric IDs that have been previously used and deleted from this project.
75  // These IDs must not be reused in new metrics.
76  repeated uint32 deleted_metric_ids = 6;
77}
78
79// CobaltRegistry holds a set of metrics and reports registered with Cobalt.
80//
81// A CobaltRegistry can be in one of two states:
82//
83// (1) It can contain data for a single Cobalt project. In this case, there is a single
84//     CustomerConfig which contains a single ProjectConfig.
85//
86// (2) It can contain data for multiple Cobalt projects. In this case, there may be any number of
87//     |customers|, which in turn may contain any number of ProjectConfigs.
88message CobaltRegistry {
89  reserved 1, 2, 3, 4;
90  // Cobalt customer registration.
91  repeated CustomerConfig customers = 5;
92
93  // Customer IDs that have been previously used and deleted from the registry.
94  // These IDs must not be reused for new customers.
95  repeated uint32 deleted_customer_ids = 6;
96}
97