Unit

class aws_cdk.aws_cloudwatch.Unit(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Unit for metric.

ExampleMetadata:

infused

Example:

# log_group: logs.LogGroup

mf = logs.MetricFilter(self, "MetricFilter",
    log_group=log_group,
    metric_namespace="MyApp",
    metric_name="Latency",
    filter_pattern=logs.FilterPattern.exists("$.latency"),
    metric_value="$.latency",
    dimensions={
        "ErrorCode": "$.errorCode"
    },
    unit=cloudwatch.Unit.MILLISECONDS
)

# expose a metric from the metric filter
metric = mf.metric()

# you can use the metric to create a new alarm
cloudwatch.Alarm(self, "alarm from metric filter",
    metric=metric,
    threshold=100,
    evaluation_periods=2
)

Attributes

BITS

Bits.

BITS_PER_SECOND

Bits/second (b/s).

BYTES

Bytes.

BYTES_PER_SECOND

Bytes/second (B/s).

COUNT

Count.

COUNT_PER_SECOND

Count/second.

GIGABITS

Gigabits.

GIGABITS_PER_SECOND

Gigabits/second (Gb/s).

GIGABYTES

Gigabytes.

GIGABYTES_PER_SECOND

Gigabytes/second (GB/s).

KILOBITS

Kilobits.

KILOBITS_PER_SECOND

Kilobits/second (kb/s).

KILOBYTES

Kilobytes.

KILOBYTES_PER_SECOND

Kilobytes/second (kB/s).

MEGABITS

Megabits.

MEGABITS_PER_SECOND

Megabits/second (Mb/s).

MEGABYTES

Megabytes.

MEGABYTES_PER_SECOND

Megabytes/second (MB/s).

MICROSECONDS

Microseconds.

MILLISECONDS

Milliseconds.

NONE

None.

PERCENT

Percent.

SECONDS

Seconds.

TERABITS

Terabits.

TERABITS_PER_SECOND

Terabits/second (Tb/s).

TERABYTES

Terabytes.

TERABYTES_PER_SECOND

Terabytes/second (TB/s).