Class MathExpression.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<MathExpression>
- Enclosing class:
MathExpression
MathExpression
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Color for this metric when added to a Graph in a Dashboard.static MathExpression.Builder
create()
expression
(String expression) The expression defining the metric.Label for this expression when added to a Graph in a Dashboard.The period over which the expression's statistics are applied.searchAccount
(String searchAccount) Account to evaluate search expressions within.searchRegion
(String searchRegion) Region to evaluate search expressions within.usingMetrics
(Map<String, ? extends IMetric> usingMetrics) The metrics used in the expression, in a map.
-
Method Details
-
create
- Returns:
- a new instance of
MathExpression.Builder
.
-
color
Color for this metric when added to a Graph in a Dashboard.Default: - Automatic color
- Parameters:
color
- Color for this metric when added to a Graph in a Dashboard. This parameter is required.- Returns:
this
-
label
Label for this expression when added to a Graph in a Dashboard.If this expression evaluates to more than one time series (for example, through the use of
METRICS()
orSEARCH()
expressions), each time series will appear in the graph using a combination of the expression label and the individual metric label. Specify the empty string (''
) to suppress the expression label and only keep the metric label.You can use dynamic labels to show summary information about the displayed time series in the legend. For example, if you use:
[max: ${MAX}] MyMetric
As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph's legend. If the math expression produces more than one time series, the maximum will be shown for each individual time series produce by this math expression.
Default: - Expression value is used as label
- Parameters:
label
- Label for this expression when added to a Graph in a Dashboard. This parameter is required.- Returns:
this
-
period
The period over which the expression's statistics are applied.This period overrides all periods in the metrics used in this math expression.
Default: Duration.minutes(5)
- Parameters:
period
- The period over which the expression's statistics are applied. This parameter is required.- Returns:
this
-
searchAccount
Account to evaluate search expressions within.Specifying a searchAccount has no effect to the account used for metrics within the expression (passed via usingMetrics).
Default: - Deployment account.
- Parameters:
searchAccount
- Account to evaluate search expressions within. This parameter is required.- Returns:
this
-
searchRegion
Region to evaluate search expressions within.Specifying a searchRegion has no effect to the region used for metrics within the expression (passed via usingMetrics).
Default: - Deployment region.
- Parameters:
searchRegion
- Region to evaluate search expressions within. This parameter is required.- Returns:
this
-
expression
The expression defining the metric.When an expression contains a SEARCH function, it cannot be used within an Alarm.
- Parameters:
expression
- The expression defining the metric. This parameter is required.- Returns:
this
-
usingMetrics
@Stability(Stable) public MathExpression.Builder usingMetrics(Map<String, ? extends IMetric> usingMetrics) 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
period
of each metric inusingMetrics
is ignored and instead overridden by theperiod
specified for theMathExpression
construct. Even if noperiod
is 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.
- Parameters:
usingMetrics
- The metrics used in the expression, in a map. This parameter is required.- Returns:
this
-
build
- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<MathExpression>
- Returns:
- a newly built instance of
MathExpression
.
-