mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
ef4c5eb65e
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
23 lines
803 B
Scala
23 lines
803 B
Scala
package com.twitter.product_mixer.core.functional_component.common.alert.predicate
|
|
|
|
import com.twitter.util.Duration
|
|
|
|
/**
|
|
* A [[Predicate]] that triggers if the metric this is used with rises above the
|
|
* [[latencyThreshold]] for [[datapointsPastThreshold]] per [[duration]]
|
|
*
|
|
* @note [[latencyThreshold]] must be > 0
|
|
*/
|
|
case class TriggerIfLatencyAbove(
|
|
latencyThreshold: Duration,
|
|
override val datapointsPastThreshold: Int = 10,
|
|
override val duration: Int = 15,
|
|
override val metricGranularity: MetricGranularity = Minutes)
|
|
extends Predicate {
|
|
override val threshold: Double = latencyThreshold.inMillis
|
|
override val operator: Operator = `>`
|
|
require(
|
|
latencyThreshold > Duration.Zero,
|
|
s"TriggerIfLatencyAbove thresholds must be greater than 0 but got $latencyThreshold")
|
|
}
|