MetricStatConfig Struct
Properties for a concrete metric.
NOTE: unit is no longer on this object since it is only used for Alarms, and doesn't mean what one would expect it to mean there anyway. It is most likely to be misused.
| Source | aws-cloudwatch/lib/metric-types.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
declare const value: any;
const metricStatConfig: cloudwatch.MetricStatConfig = {
metricName: 'metricName',
namespace: 'namespace',
period: cdk.Duration.minutes(30),
statistic: 'statistic',
// the properties below are optional
account: 'account',
accountOverride: 'accountOverride',
dimensions: [{
name: 'name',
value: value,
}],
region: 'region',
regionOverride: 'regionOverride',
unitFilter: cloudwatch.Unit.SECONDS,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_cloudwatch as cloudwatch
# value: Any
metric_stat_config = cloudwatch.MetricStatConfig(
metric_name="metricName",
namespace="namespace",
period=cdk.Duration.minutes(30),
statistic="statistic",
# the properties below are optional
account="account",
account_override="accountOverride",
dimensions=[cloudwatch.Dimension(
name="name",
value=value
)],
region="region",
region_override="regionOverride",
unit_filter=cloudwatch.Unit.SECONDS
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.cloudwatch.*;
Object value;
MetricStatConfig metricStatConfig = MetricStatConfig.builder()
.metricName("metricName")
.namespace("namespace")
.period(Duration.minutes(30))
.statistic("statistic")
// the properties below are optional
.account("account")
.accountOverride("accountOverride")
.dimensions(List.of(Dimension.builder()
.name("name")
.value(value)
.build()))
.region("region")
.regionOverride("regionOverride")
.unitFilter(Unit.SECONDS)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.CloudWatch;
var value;
var metricStatConfig = new MetricStatConfig {
MetricName = "metricName",
Namespace = "namespace",
Period = Duration.Minutes(30),
Statistic = "statistic",
// the properties below are optional
Account = "account",
AccountOverride = "accountOverride",
Dimensions = new [] { new Dimension {
Name = "name",
Value = value
} },
Region = "region",
RegionOverride = "regionOverride",
UnitFilter = Unit.SECONDS
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var value interface{}
metricStatConfig := &MetricStatConfig{
MetricName: jsii.String("metricName"),
Namespace: jsii.String("namespace"),
Period: cdk.Duration_Minutes(jsii.Number(30)),
Statistic: jsii.String("statistic"),
// the properties below are optional
Account: jsii.String("account"),
AccountOverride: jsii.String("accountOverride"),
Dimensions: []Dimension{
&Dimension{
Name: jsii.String("name"),
Value: value,
},
},
Region: jsii.String("region"),
RegionOverride: jsii.String("regionOverride"),
UnitFilter: awscdk.Aws_cloudwatch.Unit_SECONDS,
}
Properties
accountoptionalstringaccountoptionalstraccountoptionalStringAccountoptionalstringAccountoptional*string #Account which this metric comes from.
Default: Deployment account.
accountOverrideoptionalstringaccount_overrideoptionalstraccountOverrideoptionalStringAccountOverrideoptionalstringAccountOverrideoptional*string #Account set directly on the metric, not inherited from the attached stack.
Default: No override.
dimensionsoptionalDimension[]dimensionsoptionaltyping.List[Dimension]dimensionsoptionalList<Dimension>DimensionsoptionalDimension[]Dimensionsoptional*[]Dimension = [] #The dimensions to apply to the alarm.
Name of the metric.
Namespace of the metric.
How many seconds to aggregate over.
regionoptionalstringregionoptionalstrregionoptionalStringRegionoptionalstringRegionoptional*string #Region which this metric comes from.
Default: Deployment region.
regionOverrideoptionalstringregion_overrideoptionalstrregionOverrideoptionalStringRegionOverrideoptionalstringRegionOverrideoptional*string #Region set directly on the metric, not inherited from the attached stack.
Default: No override.
Aggregation function to use (can be either simple or a percentile).
unitFilteroptionalUnitunit_filteroptionalUnitunitFilteroptionalUnitUnitFilteroptionalUnitUnitFilteroptionalUnit #Unit used to filter the metric stream.
Default: Refer to all metric datums
notes
Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units.
This field has been renamed from plain unit to clearly communicate its purpose.