Class MathExpression
- All Implemented Interfaces:
IMetric
,software.amazon.jsii.JsiiSerializable
The math expression is a combination of an expression (x+y) and metrics to apply expression on. It also contains metadata which is used only in graphs, such as color and label. It makes sense to embed this in here, so that compound constructs can attach that metadata to metrics they expose.
MathExpression can also be used for search expressions. In this case, it also optionally accepts a searchRegion and searchAccount property for cross-environment search expressions.
This class does not represent a resource, so hence is not a construct. Instead, MathExpression is an abstraction that makes it easy to specify metrics for use in both alarms and graphs.
Example:
Function fn; MathExpression allProblems = MathExpression.Builder.create() .expression("errors + throttles") .usingMetrics(Map.of( "errors", fn.metricErrors(), "throttles", fn.metricThrottles())) .build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.cloudwatch.IMetric
IMetric.Jsii$Default, IMetric.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionprotected
MathExpression
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
MathExpression
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptioncreateAlarm
(software.constructs.Construct scope, String id, CreateAlarmOptions props) Make a new Alarm for this metric.getColor()
The hex color code, prefixed with '#' (e.g.The expression defining the metric.getLabel()
Label for this metric when added to a Graph.Aggregation period of this metric.Account to evaluate search expressions within.Region to evaluate search expressions within.The metrics used in the expression as KeyValuePair <id, metric>.Deprecated.use warningsV2Warnings generated by this math expression.Inspect the details of the metric object.toString()
Returns a string representation of an object.with
(MathExpressionOptions props) Return a copy of Metric with properties changed.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
MathExpression
protected MathExpression(software.amazon.jsii.JsiiObjectRef objRef) -
MathExpression
protected MathExpression(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
MathExpression
- Parameters:
props
- This parameter is required.
-
-
Method Details
-
createAlarm
@Stability(Stable) @NotNull public Alarm createAlarm(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CreateAlarmOptions props) Make a new Alarm for this metric.Combines both properties that may adjust the metric (aggregation) as well as alarm properties.
- Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
toMetricConfig
Inspect the details of the metric object.- Specified by:
toMetricConfig
in interfaceIMetric
-
toString
Returns a string representation of an object. -
with
Return a copy of Metric with properties changed.All properties except namespace and metricName can be changed.
- Parameters:
props
- The set of properties to change. This parameter is required.
-
getExpression
The expression defining the metric. -
getPeriod
Aggregation period of this metric. -
getUsingMetrics
The metrics used in the expression as KeyValuePair <id, metric>. -
getColor
The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. -
getLabel
Label for this metric when added to a Graph. -
getSearchAccount
Account to evaluate search expressions within. -
getSearchRegion
Region to evaluate search expressions within. -
getWarnings
Deprecated.- use warningsV2
(deprecated) Warnings generated by this math expression.- Specified by:
getWarnings
in interfaceIMetric
-
getWarningsV2
Warnings generated by this math expression.- Specified by:
getWarningsV2
in interfaceIMetric
-