case class AlertConfigBuilder(serviceName: String, integrations: Seq[String] = Nil, errorsLoggedThreshold: Option[ErrorsLoggedThreshold] = None, exceptionThreshold: Option[ExceptionThreshold] = Some(ExceptionThreshold(2)), http5xxThreshold: Option[Http5xxThreshold] = None, http5xxPercentThreshold: Option[Http5xxPercentThreshold] = Some(Http5xxPercentThreshold(100.0)), http90PercentileResponseTimeThresholds: Seq[Http90PercentileResponseTimeThreshold] = Nil, httpAbsolutePercentSplitThresholds: Seq[HttpAbsolutePercentSplitThreshold] = Nil, httpAbsolutePercentSplitDownstreamServiceThresholds: Seq[HttpAbsolutePercentSplitDownstreamServiceThreshold] = Nil, httpAbsolutePercentSplitDownstreamHodThresholds: Seq[HttpAbsolutePercentSplitDownstreamHodThreshold] = Nil, containerKillThreshold: Option[ContainerKillThreshold] = Some(ContainerKillThreshold(1)), httpTrafficThresholds: Seq[HttpTrafficThreshold] = Nil, httpStatusThresholds: Seq[HttpStatusThreshold] = Nil, httpStatusPercentThresholds: Seq[HttpStatusPercentThreshold] = Nil, metricsThresholds: Seq[MetricsThreshold] = Nil, logMessageThresholds: Seq[LogMessageThreshold] = Nil, totalHttpRequestThreshold: Option[TotalHttpRequestThreshold] = None, averageCPUThreshold: Option[AverageCPUThreshold] = None, platformService: Boolean = false) extends Product with Serializable
- Alphabetic
- By Inheritance
- AlertConfigBuilder
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new AlertConfigBuilder(serviceName: String, integrations: Seq[String] = Nil, errorsLoggedThreshold: Option[ErrorsLoggedThreshold] = None, exceptionThreshold: Option[ExceptionThreshold] = Some(ExceptionThreshold(2)), http5xxThreshold: Option[Http5xxThreshold] = None, http5xxPercentThreshold: Option[Http5xxPercentThreshold] = Some(Http5xxPercentThreshold(100.0)), http90PercentileResponseTimeThresholds: Seq[Http90PercentileResponseTimeThreshold] = Nil, httpAbsolutePercentSplitThresholds: Seq[HttpAbsolutePercentSplitThreshold] = Nil, httpAbsolutePercentSplitDownstreamServiceThresholds: Seq[HttpAbsolutePercentSplitDownstreamServiceThreshold] = Nil, httpAbsolutePercentSplitDownstreamHodThresholds: Seq[HttpAbsolutePercentSplitDownstreamHodThreshold] = Nil, containerKillThreshold: Option[ContainerKillThreshold] = Some(ContainerKillThreshold(1)), httpTrafficThresholds: Seq[HttpTrafficThreshold] = Nil, httpStatusThresholds: Seq[HttpStatusThreshold] = Nil, httpStatusPercentThresholds: Seq[HttpStatusPercentThreshold] = Nil, metricsThresholds: Seq[MetricsThreshold] = Nil, logMessageThresholds: Seq[LogMessageThreshold] = Nil, totalHttpRequestThreshold: Option[TotalHttpRequestThreshold] = None, averageCPUThreshold: Option[AverageCPUThreshold] = None, platformService: Boolean = false)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val averageCPUThreshold: Option[AverageCPUThreshold]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- val containerKillThreshold: Option[ContainerKillThreshold]
- def disableContainerKillThreshold(): AlertConfigBuilder
This will disable the ContainerKillThreshold alert which is configured with a threshold of 1 by default
- def disableExceptionThreshold(): AlertConfigBuilder
This will disable the ExceptionThreshold alert which is configured with a threshold of 2 by default
- def disableHttp5xxPercentThreshold(): AlertConfigBuilder
This will disable the Http5xxPercentThreshold alert which is configured with a threshold of 100% by default
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val errorsLoggedThreshold: Option[ErrorsLoggedThreshold]
- val exceptionThreshold: Option[ExceptionThreshold]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- val http5xxPercentThreshold: Option[Http5xxPercentThreshold]
- val http5xxThreshold: Option[Http5xxThreshold]
- val http90PercentileResponseTimeThresholds: Seq[Http90PercentileResponseTimeThreshold]
- val httpAbsolutePercentSplitDownstreamHodThresholds: Seq[HttpAbsolutePercentSplitDownstreamHodThreshold]
- val httpAbsolutePercentSplitDownstreamServiceThresholds: Seq[HttpAbsolutePercentSplitDownstreamServiceThreshold]
- val httpAbsolutePercentSplitThresholds: Seq[HttpAbsolutePercentSplitThreshold]
- val httpStatusPercentThresholds: Seq[HttpStatusPercentThreshold]
- val httpStatusThresholds: Seq[HttpStatusThreshold]
- val httpTrafficThresholds: Seq[HttpTrafficThreshold]
- val integrations: Seq[String]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val logMessageThresholds: Seq[LogMessageThreshold]
- val logger: Logger
- val metricsThresholds: Seq[MetricsThreshold]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- val platformService: Boolean
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- val serviceName: String
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val totalHttpRequestThreshold: Option[TotalHttpRequestThreshold]
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withAverageCPUThreshold(averageCPUThreshold: Int): AlertConfigBuilder
This alert will notify when the average CPU used by all instances of your microservice exceeds a given threshold within a 5-minute window.
This alert will notify when the average CPU used by all instances of your microservice exceeds a given threshold within a 5-minute window.
- averageCPUThreshold
The average percentage CPU used by all instances of your microservice
.withAverageCPUThreshold(50) # alert if average CPU usage across all microservice instances is above 50% for the last 15 minutes
Example: - def withContainerKillThreshold(containerCrashThreshold: Int): AlertConfigBuilder
All microservices are deployed to MDTP inside docker containers.
All microservices are deployed to MDTP inside docker containers. If the docker container runs out of memory then the container will be killed with an out-of-memory exception. This alert will notify when a specified number of containers are killed within a 15-minute window.
- containerCrashThreshold
The number of container kills to alert on
- returns
.withContainerKillThreshold(5) # alert if 5 microservice instances are killed with an out-of-memory exception in a 15-minute window
- def withErrorsLoggedThreshold(errorsLoggedThreshold: Int): AlertConfigBuilder
This alert will notify when your microservice logs a specified number of logs at ERROR log level within a 15-minute window.
This alert will notify when your microservice logs a specified number of logs at ERROR log level within a 15-minute window.
- errorsLoggedThreshold
The number of logs at ERROR level that this alert will trigger on
.withErrorsLoggedThreshold(5) # alert when 5 logs at ERROR level are logged in a 15-minute window
Example: - def withExceptionThreshold(exceptionThreshold: Int, severity: AlertSeverity = AlertSeverity.Critical): AlertConfigBuilder
This alert will notify when your microservice throws a specified number of exceptions, at log level ERROR, within a 15-minute window.
This alert will notify when your microservice throws a specified number of exceptions, at log level ERROR, within a 15-minute window.
- exceptionThreshold
The number of exceptions thrown that this alert will trigger on
.withExceptionThreshold(count: Int, severity: AlertSeverity = AlertSeverity.Critical)
Example: - def withHttp5xxPercentThreshold(percentThreshold: Double, minimumHttp5xxCountThreshold: Int = 0, severity: AlertSeverity = AlertSeverity.Critical): AlertConfigBuilder
This alert will notify when the percentage of http responses returning a 5xx http status code exceeds a given threshold within a 15-minute window.
This alert will notify when the percentage of http responses returning a 5xx http status code exceeds a given threshold within a 15-minute window.
This alert is enabled by default at 100%, but can be disabled by using .disableHttp5xxPercentThreshold().
- percentThreshold
The %age of requests that must be 5xx to trigger the alarm
- minimumHttp5xxCountThreshold
The minimum count of 5xxs that must be present for the percentThreshold check to kick in. Optional. If you want to create a 5xxPercentThreshold alert but only if you have a given count of 5xxs, this is the method to use. You want to use this parameter if, for example, you don't want to alert on just a one-off 5xx in the middle of the night Defaults to 0, which would mean the parameter has no effect.
- severity
How severe the alert is
- returns
Configured threshold object
.withHttp5xxPercentThreshold(25.0) # alert when 25% of all requests return a 5xx status code in a 15-minute window .withHttp5xxPercentThreshold(25.0, AlertSeverity.Warning) # raise a warning alert when 25% of all requests return a 5xx status code in a 15-minute window .withHttp5xxPercentThreshold(25.0, 5, AlertSeverity.Warning) # raise a warning alert when 25% of all requests return a 5xx status code in a 15-minute window, where there are at least 5 total 5xx status codes observed in the time window
Example: - def withHttp5xxThreshold(http5xxThreshold: Int, severity: AlertSeverity = AlertSeverity.Critical): AlertConfigBuilder
This alert will notify when the number of http responses returning a 5xx http status code exceeds a given threshold within a 15-minute window.
This alert will notify when the number of http responses returning a 5xx http status code exceeds a given threshold within a 15-minute window.
- http5xxThreshold
The number of all http responses with a 5xx status code to alert on
- severity
Whether to raise the alert as critical or warning
.withHttp5xxThreshold(5) # alert when 5 requests return a 5xx status code in a 15-minute window .withHttp5xxThreshold(5, AlertSeverity.Warning) # raise a warning alert when 5 requests return a 5xx status code in a 15-minute window
Example: - def withHttp90PercentileResponseTimeThreshold(threshold: Http90PercentileResponseTimeThreshold): AlertConfigBuilder
This alert will notify you when the 90th Percentile request time goes above the defined thresholds for the time period specified by the user.
This alert will notify you when the 90th Percentile request time goes above the defined thresholds for the time period specified by the user.
- threshold
Object representing the response time in milliseconds above which alerts will be raised at given severities for a given time period
.withHttp90PercentileResponseTimeThreshold(Http90PercentileResponseTimeThreshold(warning = Some(1000), critical = Some(2000), timePeriod = 7))
Example: - def withHttpAbsolutePercentSplitDownstreamHodThreshold(threshold: HttpAbsolutePercentSplitDownstreamHodThreshold): AlertConfigBuilder
- threshold
Object with fields percentThreshold, crossover, absoluteThreshold, hysteresis, excludeSpikes, errorFilter, target, severity
.withHttpAbsolutePercentSplitDownstreamHodThreshold(HttpAbsolutePercentSplitDownstreamHodThreshold(10.0, 0, -1, 1.1, 2, "status:>498", "nps-hod-service",AlertSeverity.Critical))
Example: - def withHttpAbsolutePercentSplitDownstreamServiceThreshold(threshold: HttpAbsolutePercentSplitDownstreamServiceThreshold): AlertConfigBuilder
- threshold
Object with fields percentThreshold, crossover, absoluteThreshold, hysteresis, excludeSpikes, errorFilter, target, severity
.withHttpAbsolutePercentSplitDownstreamServiceThreshold(HttpAbsolutePercentSplitDownstreamServiceThreshold(10.0, 0, -1, 1.1, 2, "status:>498", "nps-hod-service",AlertSeverity.Critical))
Example: - def withHttpAbsolutePercentSplitThreshold(threshold: HttpAbsolutePercentSplitThreshold): AlertConfigBuilder
- threshold
Object with fields percentThreshold, crossover, absoluteThreshold, hysteresis, excludeSpikes, errorFilter, severity
.withHttpAbsolutePercentSplitThreshold(HttpAbsolutePercentSplitThreshold(100.0, Int.MaxValue, 40, 1.0, 2, "status:499"))
Example: - def withHttpStatusPercentThreshold(threshold: HttpStatusPercentThreshold): AlertConfigBuilder
This alert will notify when the percentage of http responses with a given http status code exceeds a given threshold within a 15-minute window.
This alert will notify when the percentage of http responses with a given http status code exceeds a given threshold within a 15-minute window.
- threshold
Object with fields httpStatus, percentage, severity and httpMethod
- returns
.withHttpStatusPercentThreshold(HttpStatusPercentThreshold(HTTP_STATUS_404, 25.0)) # alert when 25% of all requests return status code 404 in a 15-minute window .withHttpStatusPercentThreshold(HttpStatusPercentThreshold(HTTP_STATUS_500, 25.0)) # alert when 25% of all requests return status code 500 in a 15-minute window .withHttpStatusPercentThreshold(HttpStatusPercentThreshold(HTTP_STATUS_504, 25.0, AlertSeverity.Warning, httpMethod.Post)) # raise a warning alert when 25% of all Post requests return status code 500 in a 15-minute window
- def withHttpStatusThreshold(threshold: HttpStatusThreshold): AlertConfigBuilder
This alert will notify when your microservice returns a specified number of requests with a given http status code (between 400 and 599) within a 15-minute window.
This alert will notify when your microservice returns a specified number of requests with a given http status code (between 400 and 599) within a 15-minute window.
- threshold
Object with fields httpStatus, count, severity and httpMethod
.withHttpStatusThreshold(HttpStatusThreshold(HTTP_STATUS_500, 5)) # alert when 5 occurences of status code 500 in a 15-minute window .withHttpStatusThreshold(HttpStatusThreshold(HTTP_STATUS(501), 5)) # alert when 5 occurences of status code 501 in a 15-minute window .withHttpStatusThreshold(HttpStatusThreshold(HTTP_STATUS_502, 5, AlertSeverity.Warning)) # raise a warning alert when 5 occurences of status code 502 in a 15-minute window .withHttpStatusThreshold(HttpStatusThreshold(HTTP_STATUS_503, 5, AlertSeverity.Warning, httpMethod.Post)) # raise a warning alert when 5 occurences of Post requests with response status code 503 in a 15-minute window
Example: - def withHttpTrafficThreshold(threshold: HttpTrafficThreshold): AlertConfigBuilder
This alert will notify you when the total number of requests received by the microservice is below a certain threshold.
This alert will notify you when the total number of requests received by the microservice is below a certain threshold.
One or both of warning and critical must be given.
- threshold
Object with fields warning, critical and maxMinutesBelowThreshold
.withHttpTrafficThreshold(HttpTrafficThreshold(10, 5, 15)) # alert with a warning when less than 10 requests or critical when less than 5 requests are received in a 15-minute
Example: - def withIntegrations(integrations: String*): AlertConfigBuilder
Set of integrations for the configuration, e.g.
Set of integrations for the configuration, e.g. .withIntegrations("dass-cyclone")
- integrations
List of names of your pagerduty integrations. These integrations must already exist in PagerDuty; alert-config will not create then for you.
- def withLogMessageThreshold(message: String, threshold: Int, lessThanMode: Boolean = false, severity: AlertSeverity = AlertSeverity.Critical): AlertConfigBuilder
This alert will notify when the count of a given log message is logged exceeds a given threshold within a 15-minute window.
This alert will notify when the count of a given log message is logged exceeds a given threshold within a 15-minute window.
- message
The substring to search for in the log message
- threshold
The threshold above which an alert will be raised
- lessThanMode
Flips the logic so that an alert is raised if less than the threshold amount is detected
- severity
The severity to set for this check in PagerDuty
- returns
.withLogMessageThreshold("Custom logs", 5) // occurrences of a specific log message in a 15-minute window .withLogMessageThreshold("heartbeat", 4, lessThanMode=true) // triggers if a specific log message appears less than 4 times in a 15-minute window .withLogMessageThreshold("MY_LOG_MESSAGE", 10, severity = AlertSeverity.Warning) // Raise warning alert in PagerDuty after 10 logs containing `MY_LOG_MESSAGE` are detected .withLogMessageThreshold("MY_LOG_MESSAGE", 2) // Raise an alert when a service generates two or more logs containing the specified MY_LOG_MESSAGE within a 15-minute timeframe.
- def withTotalHttpRequestThreshold(threshold: Int): AlertConfigBuilder
This alert will notify when your microservice receives a given number of requests within a 15-minute window.
This alert will notify when your microservice receives a given number of requests within a 15-minute window.
- threshold
The number of all http requests to alert on
- returns
.withTotalHttpRequestThreshold(1000) # alert when 1000 requests are received in a 15-minute window
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)
- def isPlatformService(platformService: Boolean): AlertConfigBuilder
In order to generate an alert for a service, alert-config expects an entry in app-config-$ENV for that service.
In order to generate an alert for a service, alert-config expects an entry in app-config-$ENV for that service. However, since platform services don't have app-config entries by design, the creation of alerts for these services can be forced by adding .isPlatformService(true) to your configBuilder.
- platformService
True if you are defining alerts for something that is NOT a standard microservice
- Deprecated
Custom alerting coming soon!