codekingpro/portable-devtools
114k
1// Copyright 2026 Google LLC2//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 at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// 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 and13// limitations under the License.14 15syntax = "proto3";16 17package google.api;18 19import "google/protobuf/any.proto";20import "google/protobuf/timestamp.proto";21 22option go_package = "google.golang.org/genproto/googleapis/api/distribution;distribution";23option java_multiple_files = true;24option java_outer_classname = "DistributionProto";25option java_package = "com.google.api";26option objc_class_prefix = "GAPI";27 28// `Distribution` contains summary statistics for a population of values. It29// optionally contains a histogram representing the distribution of those values30// across a set of buckets.31//32// The summary statistics are the count, mean, sum of the squared deviation from33// the mean, the minimum, and the maximum of the set of population of values.34// The histogram is based on a sequence of buckets and gives a count of values35// that fall into each bucket. The boundaries of the buckets are given either36// explicitly or by formulas for buckets of fixed or exponentially increasing37// widths.38//39// Although it is not forbidden, it is generally a bad idea to include40// non-finite values (infinities or NaNs) in the population of values, as this41// will render the `mean` and `sum_of_squared_deviation` fields meaningless.42message Distribution {43 // The range of the population values.44 message Range {45 // The minimum of the population values.46 double min = 1;47 48 // The maximum of the population values.49 double max = 2;50 }51 52 // `BucketOptions` describes the bucket boundaries used to create a histogram53 // for the distribution. The buckets can be in a linear sequence, an54 // exponential sequence, or each bucket can be specified explicitly.55 // `BucketOptions` does not include the number of values in each bucket.56 //57 // A bucket has an inclusive lower bound and exclusive upper bound for the58 // values that are counted for that bucket. The upper bound of a bucket must59 // be strictly greater than the lower bound. The sequence of N buckets for a60 // distribution consists of an underflow bucket (number 0), zero or more61 // finite buckets (number 1 through N - 2) and an overflow bucket (number N -62 // 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the63 // same as the upper bound of bucket i - 1. The buckets span the whole range64 // of finite values: lower bound of the underflow bucket is -infinity and the65 // upper bound of the overflow bucket is +infinity. The finite buckets are66 // so-called because both bounds are finite.67 message BucketOptions {68 // Specifies a linear sequence of buckets that all have the same width69 // (except overflow and underflow). Each bucket represents a constant70 // absolute uncertainty on the specific value in the bucket.71 //72 // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the73 // following boundaries:74 //75 // Upper bound (0 <= i < N-1): offset + (width * i).76 //77 // Lower bound (1 <= i < N): offset + (width * (i - 1)).78 message Linear {79 // Must be greater than 0.80 int32 num_finite_buckets = 1;81 82 // Must be greater than 0.83 double width = 2;84 85 // Lower bound of the first bucket.86 double offset = 3;87 }88 89 // Specifies an exponential sequence of buckets that have a width that is90 // proportional to the value of the lower bound. Each bucket represents a91 // constant relative uncertainty on a specific value in the bucket.92 //93 // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the94 // following boundaries:95 //96 // Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).97 //98 // Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).99 message Exponential {100 // Must be greater than 0.101 int32 num_finite_buckets = 1;102 103 // Must be greater than 1.104 double growth_factor = 2;105 106 // Must be greater than 0.107 double scale = 3;108 }109 110 // Specifies a set of buckets with arbitrary widths.111 //112 // There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following113 // boundaries:114 //115 // Upper bound (0 <= i < N-1): bounds[i]116 // Lower bound (1 <= i < N); bounds[i - 1]117 //118 // The `bounds` field must contain at least one element. If `bounds` has119 // only one element, then there are no finite buckets, and that single120 // element is the common boundary of the overflow and underflow buckets.121 message Explicit {122 // The values must be monotonically increasing.123 repeated double bounds = 1;124 }125 126 // Exactly one of these three fields must be set.127 oneof options {128 // The linear bucket.129 Linear linear_buckets = 1;130 131 // The exponential buckets.132 Exponential exponential_buckets = 2;133 134 // The explicit buckets.135 Explicit explicit_buckets = 3;136 }137 }138 139 // Exemplars are example points that may be used to annotate aggregated140 // distribution values. They are metadata that gives information about a141 // particular value added to a Distribution bucket, such as a trace ID that142 // was active when a value was added. They may contain further information,143 // such as a example values and timestamps, origin, etc.144 message Exemplar {145 // Value of the exemplar point. This value determines to which bucket the146 // exemplar belongs.147 double value = 1;148 149 // The observation (sampling) time of the above value.150 google.protobuf.Timestamp timestamp = 2;151 152 // Contextual information about the example value. Examples are:153 //154 // Trace: type.googleapis.com/google.monitoring.v3.SpanContext155 //156 // Literal string: type.googleapis.com/google.protobuf.StringValue157 //158 // Labels dropped during aggregation:159 // type.googleapis.com/google.monitoring.v3.DroppedLabels160 //161 // There may be only a single attachment of any given message type in a162 // single exemplar, and this is enforced by the system.163 repeated google.protobuf.Any attachments = 3;164 }165 166 // The number of values in the population. Must be non-negative. This value167 // must equal the sum of the values in `bucket_counts` if a histogram is168 // provided.169 int64 count = 1;170 171 // The arithmetic mean of the values in the population. If `count` is zero172 // then this field must be zero.173 double mean = 2;174 175 // The sum of squared deviations from the mean of the values in the176 // population. For values x_i this is:177 //178 // Sum[i=1..n]((x_i - mean)^2)179 //180 // Knuth, "The Art of Computer Programming", Vol. 2, page 232, 3rd edition181 // describes Welford's method for accumulating this sum in one pass.182 //183 // If `count` is zero then this field must be zero.184 double sum_of_squared_deviation = 3;185 186 // If specified, contains the range of the population values. The field187 // must not be present if the `count` is zero.188 Range range = 4;189 190 // Defines the histogram bucket boundaries. If the distribution does not191 // contain a histogram, then omit this field.192 BucketOptions bucket_options = 6;193 194 // The number of values in each bucket of the histogram, as described in195 // `bucket_options`. If the distribution does not have a histogram, then omit196 // this field. If there is a histogram, then the sum of the values in197 // `bucket_counts` must equal the value in the `count` field of the198 // distribution.199 //200 // If present, `bucket_counts` should contain N values, where N is the number201 // of buckets specified in `bucket_options`. If you supply fewer than N202 // values, the remaining values are assumed to be 0.203 //204 // The order of the values in `bucket_counts` follows the bucket numbering205 // schemes described for the three bucket types. The first value must be the206 // count for the underflow bucket (number 0). The next N-2 values are the207 // counts for the finite buckets (number 1 through N-2). The N'th value in208 // `bucket_counts` is the count for the overflow bucket (number N-1).209 repeated int64 bucket_counts = 7;210 211 // Must be in increasing order of `value` field.212 repeated Exemplar exemplars = 10;213}214 