MetricsConfig

class aws_cdk.aws_lambda.MetricsConfig(*, metrics)

Bases: object

Configuration for collecting metrics from the event source.

Parameters:

metrics (Sequence[MetricType]) – List of metric types to enable for this event source.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_lambda_event_sources as eventsources
import aws_cdk.aws_dynamodb as dynamodb

# fn: lambda.Function

table = dynamodb.Table(self, "Table",
    partition_key=dynamodb.Attribute(
        name="id",
        type=dynamodb.AttributeType.STRING
    ),
    stream=dynamodb.StreamViewType.NEW_IMAGE
)

fn.add_event_source(eventsources.DynamoEventSource(table,
    starting_position=lambda_.StartingPosition.LATEST,
    metrics_config=lambda.MetricsConfig(
        metrics=[lambda_.MetricType.EVENT_COUNT]
    )
))

Attributes

metrics

List of metric types to enable for this event source.