enum Unit
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudWatch.Unit |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#Unit |
Java | software.amazon.awscdk.services.cloudwatch.Unit |
Python | aws_cdk.aws_cloudwatch.Unit |
TypeScript (source) | aws-cdk-lib » aws_cloudwatch » Unit |
Unit for metric.
Example
declare const logGroup: logs.LogGroup;
const mf = new logs.MetricFilter(this, 'MetricFilter', {
logGroup,
metricNamespace: 'MyApp',
metricName: 'Latency',
filterPattern: logs.FilterPattern.exists('$.latency'),
metricValue: '$.latency',
dimensions: {
ErrorCode: '$.errorCode',
},
unit: cloudwatch.Unit.MILLISECONDS,
});
//expose a metric from the metric filter
const metric = mf.metric();
//you can use the metric to create a new alarm
new cloudwatch.Alarm(this, 'alarm from metric filter', {
metric,
threshold: 100,
evaluationPeriods: 2,
});
Members
Name | Description |
---|---|
SECONDS | Seconds. |
MICROSECONDS | Microseconds. |
MILLISECONDS | Milliseconds. |
BYTES | Bytes. |
KILOBYTES | Kilobytes. |
MEGABYTES | Megabytes. |
GIGABYTES | Gigabytes. |
TERABYTES | Terabytes. |
BITS | Bits. |
KILOBITS | Kilobits. |
MEGABITS | Megabits. |
GIGABITS | Gigabits. |
TERABITS | Terabits. |
PERCENT | Percent. |
COUNT | Count. |
BYTES_PER_SECOND | Bytes/second (B/s). |
KILOBYTES_PER_SECOND | Kilobytes/second (kB/s). |
MEGABYTES_PER_SECOND | Megabytes/second (MB/s). |
GIGABYTES_PER_SECOND | Gigabytes/second (GB/s). |
TERABYTES_PER_SECOND | Terabytes/second (TB/s). |
BITS_PER_SECOND | Bits/second (b/s). |
KILOBITS_PER_SECOND | Kilobits/second (kb/s). |
MEGABITS_PER_SECOND | Megabits/second (Mb/s). |
GIGABITS_PER_SECOND | Gigabits/second (Gb/s). |
TERABITS_PER_SECOND | Terabits/second (Tb/s). |
COUNT_PER_SECOND | Count/second. |
NONE | None. |
SECONDS
Seconds.
MICROSECONDS
Microseconds.
MILLISECONDS
Milliseconds.
BYTES
Bytes.
KILOBYTES
Kilobytes.
MEGABYTES
Megabytes.
GIGABYTES
Gigabytes.
TERABYTES
Terabytes.
BITS
Bits.
KILOBITS
Kilobits.
MEGABITS
Megabits.
GIGABITS
Gigabits.
TERABITS
Terabits.
PERCENT
Percent.
COUNT
Count.
BYTES_PER_SECOND
Bytes/second (B/s).
KILOBYTES_PER_SECOND
Kilobytes/second (kB/s).
MEGABYTES_PER_SECOND
Megabytes/second (MB/s).
GIGABYTES_PER_SECOND
Gigabytes/second (GB/s).
TERABYTES_PER_SECOND
Terabytes/second (TB/s).
BITS_PER_SECOND
Bits/second (b/s).
KILOBITS_PER_SECOND
Kilobits/second (kb/s).
MEGABITS_PER_SECOND
Megabits/second (Mb/s).
GIGABITS_PER_SECOND
Gigabits/second (Gb/s).
TERABITS_PER_SECOND
Terabits/second (Tb/s).
COUNT_PER_SECOND
Count/second.
NONE
None.