distribution.proto 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. syntax = "proto3";
  15. package google.api.servicecontrol.v1;
  16. option cc_enable_arenas = true;
  17. option java_multiple_files = true;
  18. option java_outer_classname = "DistributionProto";
  19. option java_package = "com.google.api.servicecontrol.v1";
  20. // Distribution represents a frequency distribution of double-valued sample
  21. // points. It contains the size of the population of sample points plus
  22. // additional optional information:
  23. //
  24. // - the arithmetic mean of the samples
  25. // - the minimum and maximum of the samples
  26. // - the sum-squared-deviation of the samples, used to compute variance
  27. // - a histogram of the values of the sample points
  28. message Distribution {
  29. // Describing buckets with constant width.
  30. message LinearBuckets {
  31. // The number of finite buckets. With the underflow and overflow buckets,
  32. // the total number of buckets is `num_finite_buckets` + 2.
  33. // See comments on `bucket_options` for details.
  34. int32 num_finite_buckets = 1;
  35. // The i'th linear bucket covers the interval
  36. // [offset + (i-1) * width, offset + i * width)
  37. // where i ranges from 1 to num_finite_buckets, inclusive.
  38. // Must be strictly positive.
  39. double width = 2;
  40. // The i'th linear bucket covers the interval
  41. // [offset + (i-1) * width, offset + i * width)
  42. // where i ranges from 1 to num_finite_buckets, inclusive.
  43. double offset = 3;
  44. }
  45. // Describing buckets with exponentially growing width.
  46. message ExponentialBuckets {
  47. // The number of finite buckets. With the underflow and overflow buckets,
  48. // the total number of buckets is `num_finite_buckets` + 2.
  49. // See comments on `bucket_options` for details.
  50. int32 num_finite_buckets = 1;
  51. // The i'th exponential bucket covers the interval
  52. // [scale * growth_factor^(i-1), scale * growth_factor^i)
  53. // where i ranges from 1 to num_finite_buckets inclusive.
  54. // Must be larger than 1.0.
  55. double growth_factor = 2;
  56. // The i'th exponential bucket covers the interval
  57. // [scale * growth_factor^(i-1), scale * growth_factor^i)
  58. // where i ranges from 1 to num_finite_buckets inclusive.
  59. // Must be > 0.
  60. double scale = 3;
  61. }
  62. // Describing buckets with arbitrary user-provided width.
  63. message ExplicitBuckets {
  64. // 'bound' is a list of strictly increasing boundaries between
  65. // buckets. Note that a list of length N-1 defines N buckets because
  66. // of fenceposting. See comments on `bucket_options` for details.
  67. //
  68. // The i'th finite bucket covers the interval
  69. // [bound[i-1], bound[i])
  70. // where i ranges from 1 to bound_size() - 1. Note that there are no
  71. // finite buckets at all if 'bound' only contains a single element; in
  72. // that special case the single bound defines the boundary between the
  73. // underflow and overflow buckets.
  74. //
  75. // bucket number lower bound upper bound
  76. // i == 0 (underflow) -inf bound[i]
  77. // 0 < i < bound_size() bound[i-1] bound[i]
  78. // i == bound_size() (overflow) bound[i-1] +inf
  79. repeated double bounds = 1;
  80. }
  81. // The total number of samples in the distribution. Must be >= 0.
  82. int64 count = 1;
  83. // The arithmetic mean of the samples in the distribution. If `count` is
  84. // zero then this field must be zero.
  85. double mean = 2;
  86. // The minimum of the population of values. Ignored if `count` is zero.
  87. double minimum = 3;
  88. // The maximum of the population of values. Ignored if `count` is zero.
  89. double maximum = 4;
  90. // The sum of squared deviations from the mean:
  91. // Sum[i=1..count]((x_i - mean)^2)
  92. // where each x_i is a sample values. If `count` is zero then this field
  93. // must be zero, otherwise validation of the request fails.
  94. double sum_of_squared_deviation = 5;
  95. // The number of samples in each histogram bucket. `bucket_counts` are
  96. // optional. If present, they must sum to the `count` value.
  97. //
  98. // The buckets are defined below in `bucket_option`. There are N buckets.
  99. // `bucket_counts[0]` is the number of samples in the underflow bucket.
  100. // `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples
  101. // in each of the finite buckets. And `bucket_counts[N] is the number
  102. // of samples in the overflow bucket. See the comments of `bucket_option`
  103. // below for more details.
  104. //
  105. // Any suffix of trailing zeros may be omitted.
  106. repeated int64 bucket_counts = 6;
  107. // Defines the buckets in the histogram. `bucket_option` and `bucket_counts`
  108. // must be both set, or both unset.
  109. //
  110. // Buckets are numbered the the range of [0, N], with a total of N+1 buckets.
  111. // There must be at least two buckets (a single-bucket histogram gives
  112. // no information that isn't already provided by `count`).
  113. //
  114. // The first bucket is the underflow bucket which has a lower bound
  115. // of -inf. The last bucket is the overflow bucket which has an
  116. // upper bound of +inf. All other buckets (if any) are called "finite"
  117. // buckets because they have finite lower and upper bounds. As described
  118. // below, there are three ways to define the finite buckets.
  119. //
  120. // (1) Buckets with constant width.
  121. // (2) Buckets with exponentially growing widths.
  122. // (3) Buckets with arbitrary user-provided widths.
  123. //
  124. // In all cases, the buckets cover the entire real number line (-inf,
  125. // +inf). Bucket upper bounds are exclusive and lower bounds are
  126. // inclusive. The upper bound of the underflow bucket is equal to the
  127. // lower bound of the smallest finite bucket; the lower bound of the
  128. // overflow bucket is equal to the upper bound of the largest finite
  129. // bucket.
  130. oneof bucket_option {
  131. // Buckets with constant width.
  132. LinearBuckets linear_buckets = 7;
  133. // Buckets with exponentially growing width.
  134. ExponentialBuckets exponential_buckets = 8;
  135. // Buckets with arbitrary user-provided width.
  136. ExplicitBuckets explicit_buckets = 9;
  137. }
  138. }