Class MathExpression
A math expression built with metric(s) emitted by a service.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.CloudWatch
Assembly: Amazon.CDK.AWS.CloudWatch.dll
Syntax (csharp)
public class MathExpression : DeputyBase, IMetric
Syntax (vb)
Public Class MathExpression
Inherits DeputyBase
Implements IMetric
Remarks
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.
ExampleMetadata: infused
Examples
Function fn;
var allProblems = new MathExpression(new MathExpressionProps {
Expression = "errors + throttles",
UsingMetrics = new Dictionary<string, IMetric> {
{ "errors", fn.MetricErrors() },
{ "faults", fn.MetricThrottles() }
}
});
Synopsis
Constructors
MathExpression(IMathExpressionProps) | |
MathExpression(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
MathExpression(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Color | The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The |
Expression | The expression defining the metric. |
Label | Label for this metric when added to a Graph. |
Period | Aggregation period of this metric. |
SearchAccount | Account to evaluate search expressions within. |
SearchRegion | Region to evaluate search expressions within. |
UsingMetrics | The metrics used in the expression as KeyValuePair <id, metric>. |
Warnings | Warnings generated by this math expression. |
Methods
CreateAlarm(Construct, String, ICreateAlarmOptions) | Make a new Alarm for this metric. |
ToAlarmConfig() | (deprecated) Turn this metric object into an alarm configuration. |
ToGraphConfig() | (deprecated) Turn this metric object into a graph configuration. |
ToMetricConfig() | Inspect the details of the metric object. |
ToString() | Returns a string representation of an object. |
With(IMathExpressionOptions) | Return a copy of Metric with properties changed. |
Constructors
MathExpression(IMathExpressionProps)
MathExpression(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected MathExpression(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
MathExpression(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected MathExpression(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Color
The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The Color
class has a set of standard colors that can be used here.
public virtual string Color { get; }
Property Value
System.String
Expression
The expression defining the metric.
public virtual string Expression { get; }
Property Value
System.String
Label
Label for this metric when added to a Graph.
public virtual string Label { get; }
Property Value
System.String
Period
SearchAccount
Account to evaluate search expressions within.
public virtual string SearchAccount { get; }
Property Value
System.String
SearchRegion
Region to evaluate search expressions within.
public virtual string SearchRegion { get; }
Property Value
System.String
UsingMetrics
The metrics used in the expression as KeyValuePair <id, metric>.
public virtual IDictionary<string, IMetric> UsingMetrics { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, IMetric>
Warnings
Warnings generated by this math expression.
public virtual string[] Warnings { get; }
Property Value
System.String[]
Methods
CreateAlarm(Construct, String, ICreateAlarmOptions)
Make a new Alarm for this metric.
public virtual Alarm CreateAlarm(Construct scope, string id, ICreateAlarmOptions props)
Parameters
- scope Construct
- id System.String
- props ICreateAlarmOptions
Returns
Remarks
Combines both properties that may adjust the metric (aggregation) as well as alarm properties.
ToAlarmConfig()
(deprecated) Turn this metric object into an alarm configuration.
public virtual IMetricAlarmConfig ToAlarmConfig()
Returns
Remarks
Stability: Deprecated
ToGraphConfig()
(deprecated) Turn this metric object into a graph configuration.
public virtual IMetricGraphConfig ToGraphConfig()
Returns
Remarks
Stability: Deprecated
ToMetricConfig()
Inspect the details of the metric object.
public virtual IMetricConfig ToMetricConfig()
Returns
ToString()
Returns a string representation of an object.
public override string ToString()
Returns
System.String
With(IMathExpressionOptions)
Return a copy of Metric with properties changed.
public virtual MathExpression With(IMathExpressionOptions props)
Parameters
- props IMathExpressionOptions
The set of properties to change.
Returns
Remarks
All properties except namespace and metricName can be changed.