distribution.proto 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. // Copyright 2019 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. //
  15. syntax = "proto3";
  16. package google.api;
  17. import "google/protobuf/any.proto";
  18. import "google/protobuf/timestamp.proto";
  19. option go_package = "google.golang.org/genproto/googleapis/api/distribution;distribution";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "DistributionProto";
  22. option java_package = "com.google.api";
  23. option objc_class_prefix = "GAPI";
  24. // `Distribution` contains summary statistics for a population of values. It
  25. // optionally contains a histogram representing the distribution of those values
  26. // across a set of buckets.
  27. //
  28. // The summary statistics are the count, mean, sum of the squared deviation from
  29. // the mean, the minimum, and the maximum of the set of population of values.
  30. // The histogram is based on a sequence of buckets and gives a count of values
  31. // that fall into each bucket. The boundaries of the buckets are given either
  32. // explicitly or by formulas for buckets of fixed or exponentially increasing
  33. // widths.
  34. //
  35. // Although it is not forbidden, it is generally a bad idea to include
  36. // non-finite values (infinities or NaNs) in the population of values, as this
  37. // will render the `mean` and `sum_of_squared_deviation` fields meaningless.
  38. message Distribution {
  39. // The range of the population values.
  40. message Range {
  41. // The minimum of the population values.
  42. double min = 1;
  43. // The maximum of the population values.
  44. double max = 2;
  45. }
  46. // `BucketOptions` describes the bucket boundaries used to create a histogram
  47. // for the distribution. The buckets can be in a linear sequence, an
  48. // exponential sequence, or each bucket can be specified explicitly.
  49. // `BucketOptions` does not include the number of values in each bucket.
  50. //
  51. // A bucket has an inclusive lower bound and exclusive upper bound for the
  52. // values that are counted for that bucket. The upper bound of a bucket must
  53. // be strictly greater than the lower bound. The sequence of N buckets for a
  54. // distribution consists of an underflow bucket (number 0), zero or more
  55. // finite buckets (number 1 through N - 2) and an overflow bucket (number N -
  56. // 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the
  57. // same as the upper bound of bucket i - 1. The buckets span the whole range
  58. // of finite values: lower bound of the underflow bucket is -infinity and the
  59. // upper bound of the overflow bucket is +infinity. The finite buckets are
  60. // so-called because both bounds are finite.
  61. message BucketOptions {
  62. // Specifies a linear sequence of buckets that all have the same width
  63. // (except overflow and underflow). Each bucket represents a constant
  64. // absolute uncertainty on the specific value in the bucket.
  65. //
  66. // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
  67. // following boundaries:
  68. //
  69. // Upper bound (0 <= i < N-1): offset + (width * i).
  70. // Lower bound (1 <= i < N): offset + (width * (i - 1)).
  71. message Linear {
  72. // Must be greater than 0.
  73. int32 num_finite_buckets = 1;
  74. // Must be greater than 0.
  75. double width = 2;
  76. // Lower bound of the first bucket.
  77. double offset = 3;
  78. }
  79. // Specifies an exponential sequence of buckets that have a width that is
  80. // proportional to the value of the lower bound. Each bucket represents a
  81. // constant relative uncertainty on a specific value in the bucket.
  82. //
  83. // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the
  84. // following boundaries:
  85. //
  86. // Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
  87. // Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
  88. message Exponential {
  89. // Must be greater than 0.
  90. int32 num_finite_buckets = 1;
  91. // Must be greater than 1.
  92. double growth_factor = 2;
  93. // Must be greater than 0.
  94. double scale = 3;
  95. }
  96. // Specifies a set of buckets with arbitrary widths.
  97. //
  98. // There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following
  99. // boundaries:
  100. //
  101. // Upper bound (0 <= i < N-1): bounds[i]
  102. // Lower bound (1 <= i < N); bounds[i - 1]
  103. //
  104. // The `bounds` field must contain at least one element. If `bounds` has
  105. // only one element, then there are no finite buckets, and that single
  106. // element is the common boundary of the overflow and underflow buckets.
  107. message Explicit {
  108. // The values must be monotonically increasing.
  109. repeated double bounds = 1;
  110. }
  111. // Exactly one of these three fields must be set.
  112. oneof options {
  113. // The linear bucket.
  114. Linear linear_buckets = 1;
  115. // The exponential buckets.
  116. Exponential exponential_buckets = 2;
  117. // The explicit buckets.
  118. Explicit explicit_buckets = 3;
  119. }
  120. }
  121. // Exemplars are example points that may be used to annotate aggregated
  122. // distribution values. They are metadata that gives information about a
  123. // particular value added to a Distribution bucket, such as a trace ID that
  124. // was active when a value was added. They may contain further information,
  125. // such as a example values and timestamps, origin, etc.
  126. message Exemplar {
  127. // Value of the exemplar point. This value determines to which bucket the
  128. // exemplar belongs.
  129. double value = 1;
  130. // The observation (sampling) time of the above value.
  131. google.protobuf.Timestamp timestamp = 2;
  132. // Contextual information about the example value. Examples are:
  133. //
  134. // Trace: type.googleapis.com/google.monitoring.v3.SpanContext
  135. //
  136. // Literal string: type.googleapis.com/google.protobuf.StringValue
  137. //
  138. // Labels dropped during aggregation:
  139. // type.googleapis.com/google.monitoring.v3.DroppedLabels
  140. //
  141. // There may be only a single attachment of any given message type in a
  142. // single exemplar, and this is enforced by the system.
  143. repeated google.protobuf.Any attachments = 3;
  144. }
  145. // The number of values in the population. Must be non-negative. This value
  146. // must equal the sum of the values in `bucket_counts` if a histogram is
  147. // provided.
  148. int64 count = 1;
  149. // The arithmetic mean of the values in the population. If `count` is zero
  150. // then this field must be zero.
  151. double mean = 2;
  152. // The sum of squared deviations from the mean of the values in the
  153. // population. For values x_i this is:
  154. //
  155. // Sum[i=1..n]((x_i - mean)^2)
  156. //
  157. // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition
  158. // describes Welford's method for accumulating this sum in one pass.
  159. //
  160. // If `count` is zero then this field must be zero.
  161. double sum_of_squared_deviation = 3;
  162. // If specified, contains the range of the population values. The field
  163. // must not be present if the `count` is zero.
  164. Range range = 4;
  165. // Defines the histogram bucket boundaries. If the distribution does not
  166. // contain a histogram, then omit this field.
  167. BucketOptions bucket_options = 6;
  168. // The number of values in each bucket of the histogram, as described in
  169. // `bucket_options`. If the distribution does not have a histogram, then omit
  170. // this field. If there is a histogram, then the sum of the values in
  171. // `bucket_counts` must equal the value in the `count` field of the
  172. // distribution.
  173. //
  174. // If present, `bucket_counts` should contain N values, where N is the number
  175. // of buckets specified in `bucket_options`. If you supply fewer than N
  176. // values, the remaining values are assumed to be 0.
  177. //
  178. // The order of the values in `bucket_counts` follows the bucket numbering
  179. // schemes described for the three bucket types. The first value must be the
  180. // count for the underflow bucket (number 0). The next N-2 values are the
  181. // counts for the finite buckets (number 1 through N-2). The N'th value in
  182. // `bucket_counts` is the count for the overflow bucket (number N-1).
  183. repeated int64 bucket_counts = 7;
  184. // Must be in increasing order of `value` field.
  185. repeated Exemplar exemplars = 10;
  186. }