distribution.proto 8.4 KB

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