c

uk.gov.hmrc.alertconfig.builder

AlertConfigBuilder

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

Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AlertConfigBuilder
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. 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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. val averageCPUThreshold: Option[AverageCPUThreshold]
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  7. val containerKillThreshold: Option[ContainerKillThreshold]
  8. def disableContainerKillThreshold(): AlertConfigBuilder

    This will disable the ContainerKillThreshold alert which is configured with a threshold of 1 by default

  9. def disableExceptionThreshold(): AlertConfigBuilder

    This will disable the ExceptionThreshold alert which is configured with a threshold of 2 by default

  10. def disableHttp5xxPercentThreshold(): AlertConfigBuilder

    This will disable the Http5xxPercentThreshold alert which is configured with a threshold of 100% by default

  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. val errorsLoggedThreshold: Option[ErrorsLoggedThreshold]
  13. val exceptionThreshold: Option[ExceptionThreshold]
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  15. val http5xxPercentThreshold: Option[Http5xxPercentThreshold]
  16. val http5xxThreshold: Option[Http5xxThreshold]
  17. val http90PercentileResponseTimeThresholds: Seq[Http90PercentileResponseTimeThreshold]
  18. val httpAbsolutePercentSplitDownstreamHodThresholds: Seq[HttpAbsolutePercentSplitDownstreamHodThreshold]
  19. val httpAbsolutePercentSplitDownstreamServiceThresholds: Seq[HttpAbsolutePercentSplitDownstreamServiceThreshold]
  20. val httpAbsolutePercentSplitThresholds: Seq[HttpAbsolutePercentSplitThreshold]
  21. val httpStatusPercentThresholds: Seq[HttpStatusPercentThreshold]
  22. val httpStatusThresholds: Seq[HttpStatusThreshold]
  23. val httpTrafficThresholds: Seq[HttpTrafficThreshold]
  24. val integrations: Seq[String]
  25. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  26. val logMessageThresholds: Seq[LogMessageThreshold]
  27. val logger: Logger
  28. val metricsThresholds: Seq[MetricsThreshold]
  29. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  31. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  32. val platformService: Boolean
  33. def productElementNames: Iterator[String]
    Definition Classes
    Product
  34. val serviceName: String
  35. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  36. val totalHttpRequestThreshold: Option[TotalHttpRequestThreshold]
  37. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  38. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  39. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  40. 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

    Example:
    1.  
      .withAverageCPUThreshold(50) # alert if average CPU usage across all microservice instances is above 50% for the last 15 minutes
      

  41. 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 
    

  42. 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

    Example:
    1.  
      .withErrorsLoggedThreshold(5) # alert when 5 logs at ERROR level are logged in a 15-minute window 
      

  43. 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

    Example:
    1.  
      .withExceptionThreshold(count: Int, severity: AlertSeverity = AlertSeverity.Critical) 
      

  44. 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

    Example:
    1.  
      .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 
      

  45. 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

    Example:
    1.  
      .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 
      

  46. 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

    Example:
    1.  
      .withHttp90PercentileResponseTimeThreshold(Http90PercentileResponseTimeThreshold(warning = Some(1000), critical = Some(2000),
       timePeriod = 7)) 
      

  47. def withHttpAbsolutePercentSplitDownstreamHodThreshold(threshold: HttpAbsolutePercentSplitDownstreamHodThreshold): AlertConfigBuilder

    threshold

    Object with fields percentThreshold, crossover, absoluteThreshold, hysteresis, excludeSpikes, errorFilter, target, severity

    Example:
    1.  
      .withHttpAbsolutePercentSplitDownstreamHodThreshold(HttpAbsolutePercentSplitDownstreamHodThreshold(10.0, 0, -1, 1.1, 2,
       "status:>498", "nps-hod-service",AlertSeverity.Critical)) 
      

  48. def withHttpAbsolutePercentSplitDownstreamServiceThreshold(threshold: HttpAbsolutePercentSplitDownstreamServiceThreshold): AlertConfigBuilder

    threshold

    Object with fields percentThreshold, crossover, absoluteThreshold, hysteresis, excludeSpikes, errorFilter, target, severity

    Example:
    1.  
      .withHttpAbsolutePercentSplitDownstreamServiceThreshold(HttpAbsolutePercentSplitDownstreamServiceThreshold(10.0, 0, -1, 1.1, 2,
       "status:>498", "nps-hod-service",AlertSeverity.Critical)) 
      

  49. def withHttpAbsolutePercentSplitThreshold(threshold: HttpAbsolutePercentSplitThreshold): AlertConfigBuilder

    threshold

    Object with fields percentThreshold, crossover, absoluteThreshold, hysteresis, excludeSpikes, errorFilter, severity

    Example:
    1.  
      .withHttpAbsolutePercentSplitThreshold(HttpAbsolutePercentSplitThreshold(100.0, Int.MaxValue, 40, 1.0, 2, "status:499")) 
      

  50. 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 
    

  51. 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

    Example:
    1.  
      .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 
      

  52. 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

    Example:
    1.  
      .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
      

  53. 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.

  54. 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. 
    

  55. 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

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

  2. 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!

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped