@liflig/cdk
    Preparing search index...

    Class LambdaAlarms

    Alarms for Lambda functions.

    Unlike RDS and ECS alarm constructs in this package, LambdaAlarms is set up manually by consumers.

    Defaults:

    • single invocation (singleError) -> sent to warningAction by default
    • multiple invocation (multipleErrors) -> sent to alarmAction by default
    • error log alarm (ERROR/FATAL JSON logs) -> sent to warningAction by default
    • uncaught Java exception alarm -> sent to warningAction by default (disabled by default)

    Hierarchy

    • Construct
      • LambdaAlarms
    Index

    Constructors

    Properties

    node: Node

    The tree node.

    Methods

    • Alerts when ERROR is logged from lambda.

      Parameters

      • props: {
            action?: IAlarmAction;
            alarmDescription?: string;
            enableOkAlarm?: boolean;
            logGroup: ILogGroup;
        }
        • Optionalaction?: IAlarmAction

          An action to use for CloudWatch alarm state changes instead of the default warning action

        • OptionalalarmDescription?: string
        • OptionalenableOkAlarm?: boolean
          true
          
        • logGroup: ILogGroup

      Returns void

    • Creates both the single-invocation warning and the multiple invocations alarm with reasonable defaults.

      Each created alarm can be overridden via the per-alarm props.

      Parameters

      • Optionalprops: {
            multipleErrors?: {
                action?: IAlarmAction;
                appendToAlarmDescription?: string;
                enabled?: boolean;
                enableOkAlarm?: boolean;
                evaluationPeriods?: number;
                periodSeconds?: number;
                threshold?: number;
            };
            singleError?: {
                action?: IAlarmAction;
                appendToAlarmDescription?: string;
                enabled?: boolean;
                enableOkAlarm?: boolean;
            };
        }

      Returns void

    • Sets up a CloudWatch Alarm that triggers when there is a short series of invocation failures.

      Parameters

      • Optionalprops: {
            action?: IAlarmAction;
            appendToAlarmDescription?: string;
            enabled?: boolean;
            enableOkAlarm?: boolean;
            evaluationPeriods?: number;
            periodSeconds?: number;
            threshold?: number;
        }
        • Optionalaction?: IAlarmAction
        • OptionalappendToAlarmDescription?: string
        • Optionalenabled?: boolean
        • OptionalenableOkAlarm?: boolean
          true
          
        • OptionalevaluationPeriods?: number
          3
          
        • OptionalperiodSeconds?: number
          60
          
        • Optionalthreshold?: number
          1
          

      Returns void

    • Sets up a CloudWatch Alarm that triggers on a single invocation failure.

      Parameters

      • Optionalprops: {
            action?: IAlarmAction;
            appendToAlarmDescription?: string;
            enabled?: boolean;
            enableOkAlarm?: boolean;
        }

      Returns void

    • Adds an alarm for uncaught Java exceptions in the Lambda function's logs.

      Parameters

      • props: {
            action?: IAlarmAction;
            alarmDescription?: string;
            enabled?: boolean;
            enableOkAlarm?: boolean;
            logGroup: ILogGroup;
        }
        • Optionalaction?: IAlarmAction
        • OptionalalarmDescription?: string
        • Optionalenabled?: boolean
          false
          
        • OptionalenableOkAlarm?: boolean
        • logGroup: ILogGroup

      Returns void

    • Returns a string representation of this construct.

      Returns string

    • Applies one or more mixins to this construct.

      Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

      Parameters

      • ...mixins: IMixin[]

        The mixins to apply

      Returns IConstruct

      This construct for chaining

    • Checks if x is a construct.

      Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

      Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

      Parameters

      • x: any

        Any object

      Returns x is Construct

      true if x is an object created from a class which extends Construct.