Skip to content
v2.273.0

MetricsConfig Struct ​

Configuration for collecting metrics from the event source.

Example ​

ts
import * as eventsources from 'aws-cdk-lib/aws-lambda-event-sources';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';

declare const fn: lambda.Function;
const table = new dynamodb.Table(this, 'Table', {
  partitionKey: {
    name: 'id',
    type: dynamodb.AttributeType.STRING,
  },
  stream: dynamodb.StreamViewType.NEW_IMAGE,
});

fn.addEventSource(new eventsources.DynamoEventSource(table, {
  startingPosition: lambda.StartingPosition.LATEST,
  metricsConfig: {
    metrics: [lambda.MetricType.EVENT_COUNT],
  }
}));

Properties ​

metricsMetricType[]metricstyping.List[MetricType]metricsList<MetricType>MetricsMetricType[]Metrics*[]MetricTyperequired#
List of metric types to enable for this event source.