Interface MathExpressionProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable,MathExpressionOptions
- All Known Implementing Classes:
MathExpressionProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-17T14:40:47.352Z")
@Stability(Stable)
public interface MathExpressionProps
extends software.amazon.jsii.JsiiSerializable, MathExpressionOptions
Properties for a MathExpression.
Example:
MatchmakingRuleSet matchmakingRuleSet;
// Alarm that triggers when the per-second average of not placed matches exceed 10%
MathExpression ruleEvaluationRatio = MathExpression.Builder.create()
.expression("1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)")
.usingMetrics(Map.of(
"ruleEvaluationsPassed", matchmakingRuleSet.metricRuleEvaluationsPassed(MetricOptions.builder().statistic(Statistic.SUM).build()),
"ruleEvaluationsFailed", matchmakingRuleSet.metric("ruleEvaluationsFailed")))
.build();
Alarm.Builder.create(this, "Alarm")
.metric(ruleEvaluationRatio)
.threshold(0.1)
.evaluationPeriods(3)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forMathExpressionPropsstatic final classAn implementation forMathExpressionProps -
Method Summary
Modifier and TypeMethodDescriptionstatic MathExpressionProps.Builderbuilder()The expression defining the metric.The metrics used in the expression, in a map.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJsonMethods inherited from interface software.amazon.awscdk.services.cloudwatch.MathExpressionOptions
getColor, getLabel, getPeriod, getSearchAccount, getSearchRegion
-
Method Details
-
getExpression
The expression defining the metric.When an expression contains a SEARCH function, it cannot be used within an Alarm.
-
getUsingMetrics
The metrics used in the expression, in a map.The key is the identifier that represents the given metric in the expression, and the value is the actual Metric object.
The
periodof each metric inusingMetricsis ignored and instead overridden by theperiodspecified for theMathExpressionconstruct. Even if noperiodis specified for theMathExpression, it will be overridden by the default value (Duration.minutes(5)).Example:
IApplicationLoadBalancerMetrics metrics; MathExpression.Builder.create() .expression("m1+m2") .label("AlbErrors") .usingMetrics(Map.of( "m1", metrics.custom("HTTPCode_ELB_500_Count", MetricOptions.builder() .period(Duration.minutes(1)) // <- This period will be ignored .statistic("Sum") .label("HTTPCode_ELB_500_Count") .build()), "m2", metrics.custom("HTTPCode_ELB_502_Count", MetricOptions.builder() .period(Duration.minutes(1)) // <- This period will be ignored .statistic("Sum") .label("HTTPCode_ELB_502_Count") .build()))) .period(Duration.minutes(3)) .build();Default: - Empty map.
-
builder
- Returns:
- a
MathExpressionProps.BuilderofMathExpressionProps
-