distribution.proto 6.8 KB

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