Skip to content

Enhancement: Support Custom Composite Alarm Expression in AlarmFactory.AddCompositeAlarmProps #618

@jeffersonbezerra

Description

@jeffersonbezerra

Description

Currently, AlarmFactory.AddCompositeAlarmProps interface only supports a single compositeOperator (AND/OR) to be applied across all
alarms in the composite alarm. This limitation prevents the creation of more complex alarm conditions that require mixed operators or NOT
conditions.

Current Behavior

The current implementation only allows expressions like:

  • (Alarm1 AND Alarm2 AND Alarm3)
  • (Alarm1 OR Alarm2 OR Alarm3)

Desired Behavior

Support for custom composite alarm expressions would allow more sophisticated monitoring scenarios, such as:

  • (Alarm1 AND NOT (Alarm2 OR Alarm3 OR Alarm4))
  • ((Alarm1 AND Alarm2) OR (Alarm3 AND NOT Alarm4))

Use Case

Many monitoring scenarios require more complex logic than simple AND/OR operations. For example:

  • Trigger an alarm when a service is down (Alarm1) but NOT during scheduled maintenance windows (Alarm2)
  • Alert when system load is high (Alarm1) AND memory usage is critical (Alarm2) AND NOT during known batch processing periods (Alarm3)

Proposed Solution

Add a new optional property to AddCompositeAlarmProps:

interface AddCompositeAlarmProps {
  // existing properties
  compositeOperator?: CompositeAlarmOperator;
  // new property
  customExpression?: string;
}

When customExpression is provided, it would take precedence over compositeOperator, allowing users to define custom composite
alarm rules using the CloudWatch composite alarm expression syntax.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions