|
| 1 | +// Copyright 2016 Google Inc. |
| 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 | + |
| 15 | +syntax = "proto3"; |
| 16 | + |
| 17 | +package google.api; |
| 18 | + |
| 19 | +import "google/api/annotations.proto"; |
| 20 | +import "google/protobuf/any.proto"; |
| 21 | +import "google/protobuf/timestamp.proto"; |
| 22 | + |
| 23 | +option go_package = "google.golang.org/genproto/googleapis/api/distribution;distribution"; |
| 24 | +option java_multiple_files = true; |
| 25 | +option java_outer_classname = "DistributionProto"; |
| 26 | +option java_package = "com.google.api"; |
| 27 | + |
| 28 | + |
| 29 | +// Distribution contains summary statistics for a population of values and, |
| 30 | +// optionally, a histogram representing the distribution of those values across |
| 31 | +// a specified set of histogram buckets. |
| 32 | +// |
| 33 | +// The summary statistics are the count, mean, sum of the squared deviation from |
| 34 | +// the mean, the minimum, and the maximum of the set of population of values. |
| 35 | +// |
| 36 | +// The histogram is based on a sequence of buckets and gives a count of values |
| 37 | +// that fall into each bucket. The boundaries of the buckets are given either |
| 38 | +// explicitly or by specifying parameters for a method of computing them |
| 39 | +// (buckets of fixed width or buckets of exponentially increasing width). |
| 40 | +// |
| 41 | +// Although it is not forbidden, it is generally a bad idea to include |
| 42 | +// non-finite values (infinities or NaNs) in the population of values, as this |
| 43 | +// will render the `mean` and `sum_of_squared_deviation` fields meaningless. |
| 44 | +message Distribution { |
| 45 | + // The range of the population values. |
| 46 | + message Range { |
| 47 | + // The minimum of the population values. |
| 48 | + double min = 1; |
| 49 | + |
| 50 | + // The maximum of the population values. |
| 51 | + double max = 2; |
| 52 | + } |
| 53 | + |
| 54 | + // A Distribution may optionally contain a histogram of the values in the |
| 55 | + // population. The histogram is given in `bucket_counts` as counts of values |
| 56 | + // that fall into one of a sequence of non-overlapping buckets. The sequence |
| 57 | + // of buckets is described by `bucket_options`. |
| 58 | + // |
| 59 | + // A bucket specifies an inclusive lower bound and exclusive upper bound for |
| 60 | + // the values that are counted for that bucket. The upper bound of a bucket |
| 61 | + // is strictly greater than the lower bound. |
| 62 | + // |
| 63 | + // The sequence of N buckets for a Distribution consists of an underflow |
| 64 | + // bucket (number 0), zero or more finite buckets (number 1 through N - 2) and |
| 65 | + // an overflow bucket (number N - 1). The buckets are contiguous: the lower |
| 66 | + // bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1. |
| 67 | + // The buckets span the whole range of finite values: lower bound of the |
| 68 | + // underflow bucket is -infinity and the upper bound of the overflow bucket is |
| 69 | + // +infinity. The finite buckets are so-called because both bounds are |
| 70 | + // finite. |
| 71 | + // |
| 72 | + // `BucketOptions` describes bucket boundaries in one of three ways. Two |
| 73 | + // describe the boundaries by giving parameters for a formula to generate |
| 74 | + // boundaries and one gives the bucket boundaries explicitly. |
| 75 | + // |
| 76 | + // If `bucket_boundaries` is not given, then no `bucket_counts` may be given. |
| 77 | + message BucketOptions { |
| 78 | + // Specify a sequence of buckets that all have the same width (except |
| 79 | + // overflow and underflow). Each bucket represents a constant absolute |
| 80 | + // uncertainty on the specific value in the bucket. |
| 81 | + // |
| 82 | + // Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for |
| 83 | + // bucket `i`: |
| 84 | + // |
| 85 | + // Upper bound (0 <= i < N-1): offset + (width * i). |
| 86 | + // Lower bound (1 <= i < N): offset + (width * (i - 1)). |
| 87 | + message Linear { |
| 88 | + // Must be greater than 0. |
| 89 | + int32 num_finite_buckets = 1; |
| 90 | + |
| 91 | + // Must be greater than 0. |
| 92 | + double width = 2; |
| 93 | + |
| 94 | + // Lower bound of the first bucket. |
| 95 | + double offset = 3; |
| 96 | + } |
| 97 | + |
| 98 | + // Specify a sequence of buckets that have a width that is proportional to |
| 99 | + // the value of the lower bound. Each bucket represents a constant relative |
| 100 | + // uncertainty on a specific value in the bucket. |
| 101 | + // |
| 102 | + // Defines `num_finite_buckets + 2` (= N) buckets with these boundaries for |
| 103 | + // bucket i: |
| 104 | + // |
| 105 | + // Upper bound (0 <= i < N-1): scale * (growth_factor ^ i). |
| 106 | + // Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). |
| 107 | + message Exponential { |
| 108 | + // Must be greater than 0. |
| 109 | + int32 num_finite_buckets = 1; |
| 110 | + |
| 111 | + // Must be greater than 1. |
| 112 | + double growth_factor = 2; |
| 113 | + |
| 114 | + // Must be greater than 0. |
| 115 | + double scale = 3; |
| 116 | + } |
| 117 | + |
| 118 | + // A set of buckets with arbitrary widths. |
| 119 | + // |
| 120 | + // Defines `size(bounds) + 1` (= N) buckets with these boundaries for |
| 121 | + // bucket i: |
| 122 | + // |
| 123 | + // Upper bound (0 <= i < N-1): bounds[i] |
| 124 | + // Lower bound (1 <= i < N); bounds[i - 1] |
| 125 | + // |
| 126 | + // There must be at least one element in `bounds`. If `bounds` has only one |
| 127 | + // element, there are no finite buckets, and that single element is the |
| 128 | + // common boundary of the overflow and underflow buckets. |
| 129 | + message Explicit { |
| 130 | + // The values must be monotonically increasing. |
| 131 | + repeated double bounds = 1; |
| 132 | + } |
| 133 | + |
| 134 | + // Exactly one of these three fields must be set. |
| 135 | + oneof options { |
| 136 | + // The linear bucket. |
| 137 | + Linear linear_buckets = 1; |
| 138 | + |
| 139 | + // The exponential buckets. |
| 140 | + Exponential exponential_buckets = 2; |
| 141 | + |
| 142 | + // The explicit buckets. |
| 143 | + Explicit explicit_buckets = 3; |
| 144 | + } |
| 145 | + } |
| 146 | + |
| 147 | + // The number of values in the population. Must be non-negative. |
| 148 | + int64 count = 1; |
| 149 | + |
| 150 | + // The arithmetic mean of the values in the population. If `count` is zero |
| 151 | + // then this field must be zero. |
| 152 | + double mean = 2; |
| 153 | + |
| 154 | + // The sum of squared deviations from the mean of the values in the |
| 155 | + // population. For values x_i this is: |
| 156 | + // |
| 157 | + // Sum[i=1..n]((x_i - mean)^2) |
| 158 | + // |
| 159 | + // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition |
| 160 | + // describes Welford's method for accumulating this sum in one pass. |
| 161 | + // |
| 162 | + // If `count` is zero then this field must be zero. |
| 163 | + double sum_of_squared_deviation = 3; |
| 164 | + |
| 165 | + // If specified, contains the range of the population values. The field |
| 166 | + // must not be present if the `count` is zero. |
| 167 | + Range range = 4; |
| 168 | + |
| 169 | + // Defines the histogram bucket boundaries. |
| 170 | + BucketOptions bucket_options = 6; |
| 171 | + |
| 172 | + // If `bucket_options` is given, then the sum of the values in `bucket_counts` |
| 173 | + // must equal the value in `count`. If `bucket_options` is not given, no |
| 174 | + // `bucket_counts` fields may be given. |
| 175 | + // |
| 176 | + // Bucket counts are given in order under the numbering scheme described |
| 177 | + // above (the underflow bucket has number 0; the finite buckets, if any, |
| 178 | + // have numbers 1 through N-2; the overflow bucket has number N-1). |
| 179 | + // |
| 180 | + // The size of `bucket_counts` must be no greater than N as defined in |
| 181 | + // `bucket_options`. |
| 182 | + // |
| 183 | + // Any suffix of trailing zero bucket_count fields may be omitted. |
| 184 | + repeated int64 bucket_counts = 7; |
| 185 | +} |
0 commit comments