xref: /aosp_15_r20/external/googleapis/google/api/servicecontrol/v1/distribution.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2021 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.api.servicecontrol.v1;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/api/distribution.proto";
20*d5c09012SAndroid Build Coastguard Worker
21*d5c09012SAndroid Build Coastguard Workeroption cc_enable_arenas = true;
22*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Cloud.ServiceControl.V1";
23*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/servicecontrol/apiv1/servicecontrolpb;servicecontrolpb";
24*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
25*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "DistributionProto";
26*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.api.servicecontrol.v1";
27*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\ServiceControl\\V1";
28*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::ServiceControl::V1";
29*d5c09012SAndroid Build Coastguard Worker
30*d5c09012SAndroid Build Coastguard Worker// Distribution represents a frequency distribution of double-valued sample
31*d5c09012SAndroid Build Coastguard Worker// points. It contains the size of the population of sample points plus
32*d5c09012SAndroid Build Coastguard Worker// additional optional information:
33*d5c09012SAndroid Build Coastguard Worker//
34*d5c09012SAndroid Build Coastguard Worker// * the arithmetic mean of the samples
35*d5c09012SAndroid Build Coastguard Worker// * the minimum and maximum of the samples
36*d5c09012SAndroid Build Coastguard Worker// * the sum-squared-deviation of the samples, used to compute variance
37*d5c09012SAndroid Build Coastguard Worker// * a histogram of the values of the sample points
38*d5c09012SAndroid Build Coastguard Workermessage Distribution {
39*d5c09012SAndroid Build Coastguard Worker  // Describing buckets with constant width.
40*d5c09012SAndroid Build Coastguard Worker  message LinearBuckets {
41*d5c09012SAndroid Build Coastguard Worker    // The number of finite buckets. With the underflow and overflow buckets,
42*d5c09012SAndroid Build Coastguard Worker    // the total number of buckets is `num_finite_buckets` + 2.
43*d5c09012SAndroid Build Coastguard Worker    // See comments on `bucket_options` for details.
44*d5c09012SAndroid Build Coastguard Worker    int32 num_finite_buckets = 1;
45*d5c09012SAndroid Build Coastguard Worker
46*d5c09012SAndroid Build Coastguard Worker    // The i'th linear bucket covers the interval
47*d5c09012SAndroid Build Coastguard Worker    //   [offset + (i-1) * width, offset + i * width)
48*d5c09012SAndroid Build Coastguard Worker    // where i ranges from 1 to num_finite_buckets, inclusive.
49*d5c09012SAndroid Build Coastguard Worker    // Must be strictly positive.
50*d5c09012SAndroid Build Coastguard Worker    double width = 2;
51*d5c09012SAndroid Build Coastguard Worker
52*d5c09012SAndroid Build Coastguard Worker    // The i'th linear bucket covers the interval
53*d5c09012SAndroid Build Coastguard Worker    //   [offset + (i-1) * width, offset + i * width)
54*d5c09012SAndroid Build Coastguard Worker    // where i ranges from 1 to num_finite_buckets, inclusive.
55*d5c09012SAndroid Build Coastguard Worker    double offset = 3;
56*d5c09012SAndroid Build Coastguard Worker  }
57*d5c09012SAndroid Build Coastguard Worker
58*d5c09012SAndroid Build Coastguard Worker  // Describing buckets with exponentially growing width.
59*d5c09012SAndroid Build Coastguard Worker  message ExponentialBuckets {
60*d5c09012SAndroid Build Coastguard Worker    // The number of finite buckets. With the underflow and overflow buckets,
61*d5c09012SAndroid Build Coastguard Worker    // the total number of buckets is `num_finite_buckets` + 2.
62*d5c09012SAndroid Build Coastguard Worker    // See comments on `bucket_options` for details.
63*d5c09012SAndroid Build Coastguard Worker    int32 num_finite_buckets = 1;
64*d5c09012SAndroid Build Coastguard Worker
65*d5c09012SAndroid Build Coastguard Worker    // The i'th exponential bucket covers the interval
66*d5c09012SAndroid Build Coastguard Worker    //   [scale * growth_factor^(i-1), scale * growth_factor^i)
67*d5c09012SAndroid Build Coastguard Worker    // where i ranges from 1 to num_finite_buckets inclusive.
68*d5c09012SAndroid Build Coastguard Worker    // Must be larger than 1.0.
69*d5c09012SAndroid Build Coastguard Worker    double growth_factor = 2;
70*d5c09012SAndroid Build Coastguard Worker
71*d5c09012SAndroid Build Coastguard Worker    // The i'th exponential bucket covers the interval
72*d5c09012SAndroid Build Coastguard Worker    //   [scale * growth_factor^(i-1), scale * growth_factor^i)
73*d5c09012SAndroid Build Coastguard Worker    // where i ranges from 1 to num_finite_buckets inclusive.
74*d5c09012SAndroid Build Coastguard Worker    // Must be > 0.
75*d5c09012SAndroid Build Coastguard Worker    double scale = 3;
76*d5c09012SAndroid Build Coastguard Worker  }
77*d5c09012SAndroid Build Coastguard Worker
78*d5c09012SAndroid Build Coastguard Worker  // Describing buckets with arbitrary user-provided width.
79*d5c09012SAndroid Build Coastguard Worker  message ExplicitBuckets {
80*d5c09012SAndroid Build Coastguard Worker    // 'bound' is a list of strictly increasing boundaries between
81*d5c09012SAndroid Build Coastguard Worker    // buckets. Note that a list of length N-1 defines N buckets because
82*d5c09012SAndroid Build Coastguard Worker    // of fenceposting. See comments on `bucket_options` for details.
83*d5c09012SAndroid Build Coastguard Worker    //
84*d5c09012SAndroid Build Coastguard Worker    // The i'th finite bucket covers the interval
85*d5c09012SAndroid Build Coastguard Worker    //   [bound[i-1], bound[i])
86*d5c09012SAndroid Build Coastguard Worker    // where i ranges from 1 to bound_size() - 1. Note that there are no
87*d5c09012SAndroid Build Coastguard Worker    // finite buckets at all if 'bound' only contains a single element; in
88*d5c09012SAndroid Build Coastguard Worker    // that special case the single bound defines the boundary between the
89*d5c09012SAndroid Build Coastguard Worker    // underflow and overflow buckets.
90*d5c09012SAndroid Build Coastguard Worker    //
91*d5c09012SAndroid Build Coastguard Worker    // bucket number                   lower bound    upper bound
92*d5c09012SAndroid Build Coastguard Worker    //  i == 0 (underflow)              -inf           bound[i]
93*d5c09012SAndroid Build Coastguard Worker    //  0 < i < bound_size()            bound[i-1]     bound[i]
94*d5c09012SAndroid Build Coastguard Worker    //  i == bound_size() (overflow)    bound[i-1]     +inf
95*d5c09012SAndroid Build Coastguard Worker    repeated double bounds = 1;
96*d5c09012SAndroid Build Coastguard Worker  }
97*d5c09012SAndroid Build Coastguard Worker
98*d5c09012SAndroid Build Coastguard Worker  // The total number of samples in the distribution. Must be >= 0.
99*d5c09012SAndroid Build Coastguard Worker  int64 count = 1;
100*d5c09012SAndroid Build Coastguard Worker
101*d5c09012SAndroid Build Coastguard Worker  // The arithmetic mean of the samples in the distribution. If `count` is
102*d5c09012SAndroid Build Coastguard Worker  // zero then this field must be zero.
103*d5c09012SAndroid Build Coastguard Worker  double mean = 2;
104*d5c09012SAndroid Build Coastguard Worker
105*d5c09012SAndroid Build Coastguard Worker  // The minimum of the population of values. Ignored if `count` is zero.
106*d5c09012SAndroid Build Coastguard Worker  double minimum = 3;
107*d5c09012SAndroid Build Coastguard Worker
108*d5c09012SAndroid Build Coastguard Worker  // The maximum of the population of values. Ignored if `count` is zero.
109*d5c09012SAndroid Build Coastguard Worker  double maximum = 4;
110*d5c09012SAndroid Build Coastguard Worker
111*d5c09012SAndroid Build Coastguard Worker  // The sum of squared deviations from the mean:
112*d5c09012SAndroid Build Coastguard Worker  //   Sum[i=1..count]((x_i - mean)^2)
113*d5c09012SAndroid Build Coastguard Worker  // where each x_i is a sample values. If `count` is zero then this field
114*d5c09012SAndroid Build Coastguard Worker  // must be zero, otherwise validation of the request fails.
115*d5c09012SAndroid Build Coastguard Worker  double sum_of_squared_deviation = 5;
116*d5c09012SAndroid Build Coastguard Worker
117*d5c09012SAndroid Build Coastguard Worker  // The number of samples in each histogram bucket. `bucket_counts` are
118*d5c09012SAndroid Build Coastguard Worker  // optional. If present, they must sum to the `count` value.
119*d5c09012SAndroid Build Coastguard Worker  //
120*d5c09012SAndroid Build Coastguard Worker  // The buckets are defined below in `bucket_option`. There are N buckets.
121*d5c09012SAndroid Build Coastguard Worker  // `bucket_counts[0]` is the number of samples in the underflow bucket.
122*d5c09012SAndroid Build Coastguard Worker  // `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples
123*d5c09012SAndroid Build Coastguard Worker  // in each of the finite buckets. And `bucket_counts[N] is the number
124*d5c09012SAndroid Build Coastguard Worker  // of samples in the overflow bucket. See the comments of `bucket_option`
125*d5c09012SAndroid Build Coastguard Worker  // below for more details.
126*d5c09012SAndroid Build Coastguard Worker  //
127*d5c09012SAndroid Build Coastguard Worker  // Any suffix of trailing zeros may be omitted.
128*d5c09012SAndroid Build Coastguard Worker  repeated int64 bucket_counts = 6;
129*d5c09012SAndroid Build Coastguard Worker
130*d5c09012SAndroid Build Coastguard Worker  // Defines the buckets in the histogram. `bucket_option` and `bucket_counts`
131*d5c09012SAndroid Build Coastguard Worker  // must be both set, or both unset.
132*d5c09012SAndroid Build Coastguard Worker  //
133*d5c09012SAndroid Build Coastguard Worker  // Buckets are numbered in the range of [0, N], with a total of N+1 buckets.
134*d5c09012SAndroid Build Coastguard Worker  // There must be at least two buckets (a single-bucket histogram gives
135*d5c09012SAndroid Build Coastguard Worker  // no information that isn't already provided by `count`).
136*d5c09012SAndroid Build Coastguard Worker  //
137*d5c09012SAndroid Build Coastguard Worker  // The first bucket is the underflow bucket which has a lower bound
138*d5c09012SAndroid Build Coastguard Worker  // of -inf. The last bucket is the overflow bucket which has an
139*d5c09012SAndroid Build Coastguard Worker  // upper bound of +inf. All other buckets (if any) are called "finite"
140*d5c09012SAndroid Build Coastguard Worker  // buckets because they have finite lower and upper bounds. As described
141*d5c09012SAndroid Build Coastguard Worker  // below, there are three ways to define the finite buckets.
142*d5c09012SAndroid Build Coastguard Worker  //
143*d5c09012SAndroid Build Coastguard Worker  //   (1) Buckets with constant width.
144*d5c09012SAndroid Build Coastguard Worker  //   (2) Buckets with exponentially growing widths.
145*d5c09012SAndroid Build Coastguard Worker  //   (3) Buckets with arbitrary user-provided widths.
146*d5c09012SAndroid Build Coastguard Worker  //
147*d5c09012SAndroid Build Coastguard Worker  // In all cases, the buckets cover the entire real number line (-inf,
148*d5c09012SAndroid Build Coastguard Worker  // +inf). Bucket upper bounds are exclusive and lower bounds are
149*d5c09012SAndroid Build Coastguard Worker  // inclusive. The upper bound of the underflow bucket is equal to the
150*d5c09012SAndroid Build Coastguard Worker  // lower bound of the smallest finite bucket; the lower bound of the
151*d5c09012SAndroid Build Coastguard Worker  // overflow bucket is equal to the upper bound of the largest finite
152*d5c09012SAndroid Build Coastguard Worker  // bucket.
153*d5c09012SAndroid Build Coastguard Worker  oneof bucket_option {
154*d5c09012SAndroid Build Coastguard Worker    // Buckets with constant width.
155*d5c09012SAndroid Build Coastguard Worker    LinearBuckets linear_buckets = 7;
156*d5c09012SAndroid Build Coastguard Worker
157*d5c09012SAndroid Build Coastguard Worker    // Buckets with exponentially growing width.
158*d5c09012SAndroid Build Coastguard Worker    ExponentialBuckets exponential_buckets = 8;
159*d5c09012SAndroid Build Coastguard Worker
160*d5c09012SAndroid Build Coastguard Worker    // Buckets with arbitrary user-provided width.
161*d5c09012SAndroid Build Coastguard Worker    ExplicitBuckets explicit_buckets = 9;
162*d5c09012SAndroid Build Coastguard Worker  }
163*d5c09012SAndroid Build Coastguard Worker
164*d5c09012SAndroid Build Coastguard Worker  // Example points. Must be in increasing order of `value` field.
165*d5c09012SAndroid Build Coastguard Worker  repeated google.api.Distribution.Exemplar exemplars = 10;
166*d5c09012SAndroid Build Coastguard Worker}
167