OutlierDetection.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <?php
  2. /*
  3. * Copyright 2014 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  6. * use this file except in compliance with the License. You may obtain a copy of
  7. * the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. * License for the specific language governing permissions and limitations under
  15. * the License.
  16. */
  17. namespace Google\Service\Compute;
  18. class OutlierDetection extends \Google\Model
  19. {
  20. protected $baseEjectionTimeType = Duration::class;
  21. protected $baseEjectionTimeDataType = '';
  22. /**
  23. * Number of consecutive errors before a backend endpoint is ejected from the
  24. * load balancing pool. When the backend endpoint is accessed over HTTP, a 5xx
  25. * return code qualifies as an error. Defaults to 5.
  26. *
  27. * @var int
  28. */
  29. public $consecutiveErrors;
  30. /**
  31. * The number of consecutive gateway failures (502, 503, 504 status or
  32. * connection errors that are mapped to one of those status codes) before a
  33. * consecutive gateway failure ejection occurs. Defaults to 3.
  34. *
  35. * @var int
  36. */
  37. public $consecutiveGatewayFailure;
  38. /**
  39. * The percentage chance that a backend endpoint will be ejected when an
  40. * outlier status is detected through consecutive 5xx. This setting can be
  41. * used to disable ejection or to ramp it up slowly. Defaults to 0.
  42. *
  43. * @var int
  44. */
  45. public $enforcingConsecutiveErrors;
  46. /**
  47. * The percentage chance that a backend endpoint will be ejected when an
  48. * outlier status is detected through consecutive gateway failures. This
  49. * setting can be used to disable ejection or to ramp it up slowly. Defaults
  50. * to 100.
  51. *
  52. * @var int
  53. */
  54. public $enforcingConsecutiveGatewayFailure;
  55. /**
  56. * The percentage chance that a backend endpoint will be ejected when an
  57. * outlier status is detected through success rate statistics. This setting
  58. * can be used to disable ejection or to ramp it up slowly. Defaults to 100.
  59. *
  60. * Not supported when the backend service uses Serverless NEG.
  61. *
  62. * @var int
  63. */
  64. public $enforcingSuccessRate;
  65. protected $intervalType = Duration::class;
  66. protected $intervalDataType = '';
  67. /**
  68. * Maximum percentage of backend endpoints in the load balancing pool for the
  69. * backend service that can be ejected if the ejection conditions are met.
  70. * Defaults to 50%.
  71. *
  72. * @var int
  73. */
  74. public $maxEjectionPercent;
  75. /**
  76. * The number of backend endpoints in the load balancing pool that must have
  77. * enough request volume to detect success rate outliers. If the number of
  78. * backend endpoints is fewer than this setting, outlier detection via success
  79. * rate statistics is not performed for any backend endpoint in the load
  80. * balancing pool. Defaults to 5.
  81. *
  82. * Not supported when the backend service uses Serverless NEG.
  83. *
  84. * @var int
  85. */
  86. public $successRateMinimumHosts;
  87. /**
  88. * The minimum number of total requests that must be collected in one interval
  89. * (as defined by the interval duration above) to include this backend
  90. * endpoint in success rate based outlier detection. If the volume is lower
  91. * than this setting, outlier detection via success rate statistics is not
  92. * performed for that backend endpoint. Defaults to 100.
  93. *
  94. * Not supported when the backend service uses Serverless NEG.
  95. *
  96. * @var int
  97. */
  98. public $successRateRequestVolume;
  99. /**
  100. * This factor is used to determine the ejection threshold for success rate
  101. * outlier ejection. The ejection threshold is the difference between the mean
  102. * success rate, and the product of this factor and the standard deviation of
  103. * the mean success rate: mean - (stdev * successRateStdevFactor). This factor
  104. * is divided by a thousand to get a double. That is, if the desired factor is
  105. * 1.9, the runtime value should be 1900. Defaults to 1900.
  106. *
  107. * Not supported when the backend service uses Serverless NEG.
  108. *
  109. * @var int
  110. */
  111. public $successRateStdevFactor;
  112. /**
  113. * The base time that a backend endpoint is ejected for. Defaults to 30000ms
  114. * or 30s.
  115. *
  116. * After a backend endpoint is returned back to the load balancing pool, it
  117. * can be ejected again in another ejection analysis. Thus, the total ejection
  118. * time is equal to the base ejection time multiplied by the number of times
  119. * the backend endpoint has been ejected. Defaults to 30000ms or 30s.
  120. *
  121. * @param Duration $baseEjectionTime
  122. */
  123. public function setBaseEjectionTime(Duration $baseEjectionTime)
  124. {
  125. $this->baseEjectionTime = $baseEjectionTime;
  126. }
  127. /**
  128. * @return Duration
  129. */
  130. public function getBaseEjectionTime()
  131. {
  132. return $this->baseEjectionTime;
  133. }
  134. /**
  135. * Number of consecutive errors before a backend endpoint is ejected from the
  136. * load balancing pool. When the backend endpoint is accessed over HTTP, a 5xx
  137. * return code qualifies as an error. Defaults to 5.
  138. *
  139. * @param int $consecutiveErrors
  140. */
  141. public function setConsecutiveErrors($consecutiveErrors)
  142. {
  143. $this->consecutiveErrors = $consecutiveErrors;
  144. }
  145. /**
  146. * @return int
  147. */
  148. public function getConsecutiveErrors()
  149. {
  150. return $this->consecutiveErrors;
  151. }
  152. /**
  153. * The number of consecutive gateway failures (502, 503, 504 status or
  154. * connection errors that are mapped to one of those status codes) before a
  155. * consecutive gateway failure ejection occurs. Defaults to 3.
  156. *
  157. * @param int $consecutiveGatewayFailure
  158. */
  159. public function setConsecutiveGatewayFailure($consecutiveGatewayFailure)
  160. {
  161. $this->consecutiveGatewayFailure = $consecutiveGatewayFailure;
  162. }
  163. /**
  164. * @return int
  165. */
  166. public function getConsecutiveGatewayFailure()
  167. {
  168. return $this->consecutiveGatewayFailure;
  169. }
  170. /**
  171. * The percentage chance that a backend endpoint will be ejected when an
  172. * outlier status is detected through consecutive 5xx. This setting can be
  173. * used to disable ejection or to ramp it up slowly. Defaults to 0.
  174. *
  175. * @param int $enforcingConsecutiveErrors
  176. */
  177. public function setEnforcingConsecutiveErrors($enforcingConsecutiveErrors)
  178. {
  179. $this->enforcingConsecutiveErrors = $enforcingConsecutiveErrors;
  180. }
  181. /**
  182. * @return int
  183. */
  184. public function getEnforcingConsecutiveErrors()
  185. {
  186. return $this->enforcingConsecutiveErrors;
  187. }
  188. /**
  189. * The percentage chance that a backend endpoint will be ejected when an
  190. * outlier status is detected through consecutive gateway failures. This
  191. * setting can be used to disable ejection or to ramp it up slowly. Defaults
  192. * to 100.
  193. *
  194. * @param int $enforcingConsecutiveGatewayFailure
  195. */
  196. public function setEnforcingConsecutiveGatewayFailure($enforcingConsecutiveGatewayFailure)
  197. {
  198. $this->enforcingConsecutiveGatewayFailure = $enforcingConsecutiveGatewayFailure;
  199. }
  200. /**
  201. * @return int
  202. */
  203. public function getEnforcingConsecutiveGatewayFailure()
  204. {
  205. return $this->enforcingConsecutiveGatewayFailure;
  206. }
  207. /**
  208. * The percentage chance that a backend endpoint will be ejected when an
  209. * outlier status is detected through success rate statistics. This setting
  210. * can be used to disable ejection or to ramp it up slowly. Defaults to 100.
  211. *
  212. * Not supported when the backend service uses Serverless NEG.
  213. *
  214. * @param int $enforcingSuccessRate
  215. */
  216. public function setEnforcingSuccessRate($enforcingSuccessRate)
  217. {
  218. $this->enforcingSuccessRate = $enforcingSuccessRate;
  219. }
  220. /**
  221. * @return int
  222. */
  223. public function getEnforcingSuccessRate()
  224. {
  225. return $this->enforcingSuccessRate;
  226. }
  227. /**
  228. * Time interval between ejection analysis sweeps. This can result in both new
  229. * ejections and backend endpoints being returned to service. The interval is
  230. * equal to the number of seconds as defined in
  231. * outlierDetection.interval.seconds plus the number of nanoseconds as defined
  232. * in outlierDetection.interval.nanos. Defaults to 1 second.
  233. *
  234. * @param Duration $interval
  235. */
  236. public function setInterval(Duration $interval)
  237. {
  238. $this->interval = $interval;
  239. }
  240. /**
  241. * @return Duration
  242. */
  243. public function getInterval()
  244. {
  245. return $this->interval;
  246. }
  247. /**
  248. * Maximum percentage of backend endpoints in the load balancing pool for the
  249. * backend service that can be ejected if the ejection conditions are met.
  250. * Defaults to 50%.
  251. *
  252. * @param int $maxEjectionPercent
  253. */
  254. public function setMaxEjectionPercent($maxEjectionPercent)
  255. {
  256. $this->maxEjectionPercent = $maxEjectionPercent;
  257. }
  258. /**
  259. * @return int
  260. */
  261. public function getMaxEjectionPercent()
  262. {
  263. return $this->maxEjectionPercent;
  264. }
  265. /**
  266. * The number of backend endpoints in the load balancing pool that must have
  267. * enough request volume to detect success rate outliers. If the number of
  268. * backend endpoints is fewer than this setting, outlier detection via success
  269. * rate statistics is not performed for any backend endpoint in the load
  270. * balancing pool. Defaults to 5.
  271. *
  272. * Not supported when the backend service uses Serverless NEG.
  273. *
  274. * @param int $successRateMinimumHosts
  275. */
  276. public function setSuccessRateMinimumHosts($successRateMinimumHosts)
  277. {
  278. $this->successRateMinimumHosts = $successRateMinimumHosts;
  279. }
  280. /**
  281. * @return int
  282. */
  283. public function getSuccessRateMinimumHosts()
  284. {
  285. return $this->successRateMinimumHosts;
  286. }
  287. /**
  288. * The minimum number of total requests that must be collected in one interval
  289. * (as defined by the interval duration above) to include this backend
  290. * endpoint in success rate based outlier detection. If the volume is lower
  291. * than this setting, outlier detection via success rate statistics is not
  292. * performed for that backend endpoint. Defaults to 100.
  293. *
  294. * Not supported when the backend service uses Serverless NEG.
  295. *
  296. * @param int $successRateRequestVolume
  297. */
  298. public function setSuccessRateRequestVolume($successRateRequestVolume)
  299. {
  300. $this->successRateRequestVolume = $successRateRequestVolume;
  301. }
  302. /**
  303. * @return int
  304. */
  305. public function getSuccessRateRequestVolume()
  306. {
  307. return $this->successRateRequestVolume;
  308. }
  309. /**
  310. * This factor is used to determine the ejection threshold for success rate
  311. * outlier ejection. The ejection threshold is the difference between the mean
  312. * success rate, and the product of this factor and the standard deviation of
  313. * the mean success rate: mean - (stdev * successRateStdevFactor). This factor
  314. * is divided by a thousand to get a double. That is, if the desired factor is
  315. * 1.9, the runtime value should be 1900. Defaults to 1900.
  316. *
  317. * Not supported when the backend service uses Serverless NEG.
  318. *
  319. * @param int $successRateStdevFactor
  320. */
  321. public function setSuccessRateStdevFactor($successRateStdevFactor)
  322. {
  323. $this->successRateStdevFactor = $successRateStdevFactor;
  324. }
  325. /**
  326. * @return int
  327. */
  328. public function getSuccessRateStdevFactor()
  329. {
  330. return $this->successRateStdevFactor;
  331. }
  332. }
  333. // Adding a class alias for backwards compatibility with the previous class name.
  334. class_alias(OutlierDetection::class, 'Google_Service_Compute_OutlierDetection');