Skip to content

Commit fb9ea84

Browse files
author
awstools
committed
feat(client-lambda): Adds support for metrics for event source mappings for AWS Lambda
1 parent 074cf4e commit fb9ea84

13 files changed

+219
-30
lines changed

Diff for: clients/client-lambda/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ response. </p>
2424
line tools to access the API. For installation instructions, see <a href="http://aws.amazon.com/tools/">Tools for
2525
Amazon Web Services</a>. </p>
2626
<p>For a list of Region-specific endpoints that Lambda supports,
27-
see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html/">Lambda
27+
see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html">Lambda
2828
endpoints and quotas </a> in the <i>Amazon Web Services General Reference.</i>. </p>
2929
<p>When making the API calls, you will need to
3030
authenticate your request by providing a signature. Lambda supports signature version 4. For more information,

Diff for: clients/client-lambda/src/Lambda.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ export interface Lambda {
14461446
* line tools to access the API. For installation instructions, see <a href="http://aws.amazon.com/tools/">Tools for
14471447
* Amazon Web Services</a>. </p>
14481448
* <p>For a list of Region-specific endpoints that Lambda supports,
1449-
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html/">Lambda
1449+
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html">Lambda
14501450
* endpoints and quotas </a> in the <i>Amazon Web Services General Reference.</i>. </p>
14511451
* <p>When making the API calls, you will need to
14521452
* authenticate your request by providing a signature. Lambda supports signature version 4. For more information,

Diff for: clients/client-lambda/src/LambdaClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ export interface LambdaClientResolvedConfig extends LambdaClientResolvedConfigTy
612612
* line tools to access the API. For installation instructions, see <a href="http://aws.amazon.com/tools/">Tools for
613613
* Amazon Web Services</a>. </p>
614614
* <p>For a list of Region-specific endpoints that Lambda supports,
615-
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html/">Lambda
615+
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html">Lambda
616616
* endpoints and quotas </a> in the <i>Amazon Web Services General Reference.</i>. </p>
617617
* <p>When making the API calls, you will need to
618618
* authenticate your request by providing a signature. Lambda supports signature version 4. For more information,

Diff for: clients/client-lambda/src/commands/CreateEventSourceMappingCommand.ts

+19-5
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,14 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
7474
* </p>
7575
* </li>
7676
* </ul>
77-
* <p>The following error handling options are available only for stream sources (DynamoDB and Kinesis):</p>
77+
* <p>The following error handling options are available only for DynamoDB and Kinesis event sources:</p>
7878
* <ul>
7979
* <li>
8080
* <p>
8181
* <code>BisectBatchOnFunctionError</code> – If the function returns an error, split the batch in two and retry.</p>
8282
* </li>
8383
* <li>
8484
* <p>
85-
* <code>DestinationConfig</code> – Send discarded records to an Amazon SQS queue or Amazon SNS topic.</p>
86-
* </li>
87-
* <li>
88-
* <p>
8985
* <code>MaximumRecordAgeInSeconds</code> – Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires</p>
9086
* </li>
9187
* <li>
@@ -97,6 +93,14 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
9793
* <code>ParallelizationFactor</code> – Process multiple batches from each shard concurrently.</p>
9894
* </li>
9995
* </ul>
96+
* <p>For stream sources (DynamoDB, Kinesis, Amazon MSK, and self-managed Apache Kafka), the following option is also available:</p>
97+
* <ul>
98+
* <li>
99+
* <p>
100+
* <code>DestinationConfig</code> – Send discarded records to an Amazon SQS queue, Amazon SNS topic, or
101+
* Amazon S3 bucket.</p>
102+
* </li>
103+
* </ul>
100104
* <p>For information about which configuration parameters apply to each event source, see the following topics.</p>
101105
* <ul>
102106
* <li>
@@ -216,6 +220,11 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
216220
* FullDocument: "UpdateLookup" || "Default",
217221
* },
218222
* KMSKeyArn: "STRING_VALUE",
223+
* MetricsConfig: { // EventSourceMappingMetricsConfig
224+
* Metrics: [ // EventSourceMappingMetricList
225+
* "EventCount",
226+
* ],
227+
* },
219228
* };
220229
* const command = new CreateEventSourceMappingCommand(input);
221230
* const response = await client.send(command);
@@ -293,6 +302,11 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
293302
* // Message: "STRING_VALUE",
294303
* // },
295304
* // EventSourceMappingArn: "STRING_VALUE",
305+
* // MetricsConfig: { // EventSourceMappingMetricsConfig
306+
* // Metrics: [ // EventSourceMappingMetricList
307+
* // "EventCount",
308+
* // ],
309+
* // },
296310
* // };
297311
*
298312
* ```

Diff for: clients/client-lambda/src/commands/DeleteEventSourceMappingCommand.ts

+5
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ export interface DeleteEventSourceMappingCommandOutput extends EventSourceMappin
117117
* // Message: "STRING_VALUE",
118118
* // },
119119
* // EventSourceMappingArn: "STRING_VALUE",
120+
* // MetricsConfig: { // EventSourceMappingMetricsConfig
121+
* // Metrics: [ // EventSourceMappingMetricList
122+
* // "EventCount",
123+
* // ],
124+
* // },
120125
* // };
121126
*
122127
* ```

Diff for: clients/client-lambda/src/commands/GetEventSourceMappingCommand.ts

+5
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ export interface GetEventSourceMappingCommandOutput extends EventSourceMappingCo
115115
* // Message: "STRING_VALUE",
116116
* // },
117117
* // EventSourceMappingArn: "STRING_VALUE",
118+
* // MetricsConfig: { // EventSourceMappingMetricsConfig
119+
* // Metrics: [ // EventSourceMappingMetricList
120+
* // "EventCount",
121+
* // ],
122+
* // },
118123
* // };
119124
*
120125
* ```

Diff for: clients/client-lambda/src/commands/ListEventSourceMappingsCommand.ts

+5
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ export interface ListEventSourceMappingsCommandOutput extends ListEventSourceMap
121121
* // Message: "STRING_VALUE",
122122
* // },
123123
* // EventSourceMappingArn: "STRING_VALUE",
124+
* // MetricsConfig: { // EventSourceMappingMetricsConfig
125+
* // Metrics: [ // EventSourceMappingMetricList
126+
* // "EventCount",
127+
* // ],
128+
* // },
124129
* // },
125130
* // ],
126131
* // };

Diff for: clients/client-lambda/src/commands/PutFunctionEventInvokeConfigCommand.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ export interface PutFunctionEventInvokeConfigCommandOutput extends FunctionEvent
3939
* events in a queue for up to six hours. When an event fails all processing attempts or stays in the asynchronous
4040
* invocation queue for too long, Lambda discards it. To retain discarded events, configure a dead-letter queue with
4141
* <a>UpdateFunctionConfiguration</a>.</p>
42-
* <p>To send an invocation record to a queue, topic, function, or event bus, specify a <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">destination</a>. You can configure separate destinations for successful invocations (on-success) and events
42+
* <p>To send an invocation record to a queue, topic, S3 bucket, function, or event bus, specify a <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">destination</a>. You can configure separate destinations for successful invocations (on-success) and events
4343
* that fail all processing attempts (on-failure). You can configure destinations in addition to or instead of a
4444
* dead-letter queue.</p>
45+
* <note>
46+
* <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
47+
* </note>
4548
* @example
4649
* Use a bare-bones client and the command you need to make an API call.
4750
* ```javascript

Diff for: clients/client-lambda/src/commands/UpdateEventSourceMappingCommand.ts

+19-5
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,14 @@ export interface UpdateEventSourceMappingCommandOutput extends EventSourceMappin
7575
* </p>
7676
* </li>
7777
* </ul>
78-
* <p>The following error handling options are available only for stream sources (DynamoDB and Kinesis):</p>
78+
* <p>The following error handling options are available only for DynamoDB and Kinesis event sources:</p>
7979
* <ul>
8080
* <li>
8181
* <p>
8282
* <code>BisectBatchOnFunctionError</code> – If the function returns an error, split the batch in two and retry.</p>
8383
* </li>
8484
* <li>
8585
* <p>
86-
* <code>DestinationConfig</code> – Send discarded records to an Amazon SQS queue or Amazon SNS topic.</p>
87-
* </li>
88-
* <li>
89-
* <p>
9086
* <code>MaximumRecordAgeInSeconds</code> – Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires</p>
9187
* </li>
9288
* <li>
@@ -98,6 +94,14 @@ export interface UpdateEventSourceMappingCommandOutput extends EventSourceMappin
9894
* <code>ParallelizationFactor</code> – Process multiple batches from each shard concurrently.</p>
9995
* </li>
10096
* </ul>
97+
* <p>For stream sources (DynamoDB, Kinesis, Amazon MSK, and self-managed Apache Kafka), the following option is also available:</p>
98+
* <ul>
99+
* <li>
100+
* <p>
101+
* <code>DestinationConfig</code> – Send discarded records to an Amazon SQS queue, Amazon SNS topic, or
102+
* Amazon S3 bucket.</p>
103+
* </li>
104+
* </ul>
101105
* <p>For information about which configuration parameters apply to each event source, see the following topics.</p>
102106
* <ul>
103107
* <li>
@@ -193,6 +197,11 @@ export interface UpdateEventSourceMappingCommandOutput extends EventSourceMappin
193197
* FullDocument: "UpdateLookup" || "Default",
194198
* },
195199
* KMSKeyArn: "STRING_VALUE",
200+
* MetricsConfig: { // EventSourceMappingMetricsConfig
201+
* Metrics: [ // EventSourceMappingMetricList
202+
* "EventCount",
203+
* ],
204+
* },
196205
* };
197206
* const command = new UpdateEventSourceMappingCommand(input);
198207
* const response = await client.send(command);
@@ -270,6 +279,11 @@ export interface UpdateEventSourceMappingCommandOutput extends EventSourceMappin
270279
* // Message: "STRING_VALUE",
271280
* // },
272281
* // EventSourceMappingArn: "STRING_VALUE",
282+
* // MetricsConfig: { // EventSourceMappingMetricsConfig
283+
* // Metrics: [ // EventSourceMappingMetricList
284+
* // "EventCount",
285+
* // ],
286+
* // },
273287
* // };
274288
*
275289
* ```

Diff for: clients/client-lambda/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* line tools to access the API. For installation instructions, see <a href="http://aws.amazon.com/tools/">Tools for
1919
* Amazon Web Services</a>. </p>
2020
* <p>For a list of Region-specific endpoints that Lambda supports,
21-
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html/">Lambda
21+
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html">Lambda
2222
* endpoints and quotas </a> in the <i>Amazon Web Services General Reference.</i>. </p>
2323
* <p>When making the API calls, you will need to
2424
* authenticate your request by providing a signature. Lambda supports signature version 4. For more information,

Diff for: clients/client-lambda/src/models/models_0.ts

+77-6
Original file line numberDiff line numberDiff line change
@@ -755,13 +755,11 @@ export interface CreateCodeSigningConfigResponse {
755755
export interface OnFailure {
756756
/**
757757
* <p>The Amazon Resource Name (ARN) of the destination resource.</p>
758-
* <p>To retain records of <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">asynchronous invocations</a>,
759-
* you can configure an Amazon SNS topic, Amazon SQS queue, Lambda function,
758+
* <p>To retain records of unsuccessful <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">asynchronous invocations</a>,
759+
* you can configure an Amazon SNS topic, Amazon SQS queue, Amazon S3 bucket, Lambda function,
760760
* or Amazon EventBridge event bus as the destination.</p>
761-
* <p>To retain records of failed invocations from <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html#event-source-mapping-destinations">Kinesis and
762-
* DynamoDB event sources</a>, you can configure an Amazon SNS topic or
763-
* Amazon SQS queue as the destination.</p>
764-
* <p>To retain records of failed invocations from <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kafka.html#services-smaa-onfailure-destination">self-managed Kafka</a> or
761+
* <p>To retain records of failed invocations from <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html">Kinesis</a>,
762+
* <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html">DynamoDB</a>, <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kafka.html#services-smaa-onfailure-destination">self-managed Kafka</a> or
765763
* <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-onfailure-destination">Amazon MSK</a>,
766764
* you can configure an Amazon SNS topic, Amazon SQS queue, or Amazon S3 bucket as the destination.</p>
767765
* @public
@@ -771,6 +769,9 @@ export interface OnFailure {
771769

772770
/**
773771
* <p>A destination for events that were processed successfully.</p>
772+
* <p>To retain records of successful <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">asynchronous invocations</a>,
773+
* you can configure an Amazon SNS topic, Amazon SQS queue, Lambda function,
774+
* or Amazon EventBridge event bus as the destination.</p>
774775
* @public
775776
*/
776777
export interface OnSuccess {
@@ -892,6 +893,37 @@ export const FunctionResponseType = {
892893
*/
893894
export type FunctionResponseType = (typeof FunctionResponseType)[keyof typeof FunctionResponseType];
894895

896+
/**
897+
* @public
898+
* @enum
899+
*/
900+
export const EventSourceMappingMetric = {
901+
EventCount: "EventCount",
902+
} as const;
903+
904+
/**
905+
* @public
906+
*/
907+
export type EventSourceMappingMetric = (typeof EventSourceMappingMetric)[keyof typeof EventSourceMappingMetric];
908+
909+
/**
910+
* <p>The metrics configuration for your event source. Use this configuration object to define which metrics you want your
911+
* event source mapping to produce.</p>
912+
* @public
913+
*/
914+
export interface EventSourceMappingMetricsConfig {
915+
/**
916+
* <p>
917+
* The metrics you want your event source mapping to produce. Include <code>EventCount</code> to receive event source mapping
918+
* metrics related to the number of events processed by your event source mapping. For more information about these metrics,
919+
* see <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics">
920+
* Event source mapping metrics</a>.
921+
* </p>
922+
* @public
923+
*/
924+
Metrics?: EventSourceMappingMetric[] | undefined;
925+
}
926+
895927
/**
896928
* <p>(Amazon SQS only) The scaling configuration for the event source. To remove the configuration, pass an empty value.</p>
897929
* @public
@@ -1286,6 +1318,12 @@ export interface CreateEventSourceMappingRequest {
12861318
* @public
12871319
*/
12881320
KMSKeyArn?: string | undefined;
1321+
1322+
/**
1323+
* <p>The metrics configuration for your event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics">Event source mapping metrics</a>.</p>
1324+
* @public
1325+
*/
1326+
MetricsConfig?: EventSourceMappingMetricsConfig | undefined;
12891327
}
12901328

12911329
/**
@@ -1514,6 +1552,12 @@ export interface EventSourceMappingConfiguration {
15141552
* @public
15151553
*/
15161554
EventSourceMappingArn?: string | undefined;
1555+
1556+
/**
1557+
* <p>The metrics configuration for your event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics">Event source mapping metrics</a>.</p>
1558+
* @public
1559+
*/
1560+
MetricsConfig?: EventSourceMappingMetricsConfig | undefined;
15171561
}
15181562

15191563
/**
@@ -3647,13 +3691,20 @@ export interface FunctionEventInvokeConfig {
36473691
* </li>
36483692
* <li>
36493693
* <p>
3694+
* <b>Bucket</b> - The ARN of an Amazon S3 bucket.</p>
3695+
* </li>
3696+
* <li>
3697+
* <p>
36503698
* <b>Topic</b> - The ARN of a standard SNS topic.</p>
36513699
* </li>
36523700
* <li>
36533701
* <p>
36543702
* <b>Event Bus</b> - The ARN of an Amazon EventBridge event bus.</p>
36553703
* </li>
36563704
* </ul>
3705+
* <note>
3706+
* <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
3707+
* </note>
36573708
* @public
36583709
*/
36593710
DestinationConfig?: DestinationConfig | undefined;
@@ -6518,13 +6569,20 @@ export interface PutFunctionEventInvokeConfigRequest {
65186569
* </li>
65196570
* <li>
65206571
* <p>
6572+
* <b>Bucket</b> - The ARN of an Amazon S3 bucket.</p>
6573+
* </li>
6574+
* <li>
6575+
* <p>
65216576
* <b>Topic</b> - The ARN of a standard SNS topic.</p>
65226577
* </li>
65236578
* <li>
65246579
* <p>
65256580
* <b>Event Bus</b> - The ARN of an Amazon EventBridge event bus.</p>
65266581
* </li>
65276582
* </ul>
6583+
* <note>
6584+
* <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
6585+
* </note>
65286586
* @public
65296587
*/
65306588
DestinationConfig?: DestinationConfig | undefined;
@@ -7157,6 +7215,12 @@ export interface UpdateEventSourceMappingRequest {
71577215
* @public
71587216
*/
71597217
KMSKeyArn?: string | undefined;
7218+
7219+
/**
7220+
* <p>The metrics configuration for your event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics">Event source mapping metrics</a>.</p>
7221+
* @public
7222+
*/
7223+
MetricsConfig?: EventSourceMappingMetricsConfig | undefined;
71607224
}
71617225

71627226
/**
@@ -7495,13 +7559,20 @@ export interface UpdateFunctionEventInvokeConfigRequest {
74957559
* </li>
74967560
* <li>
74977561
* <p>
7562+
* <b>Bucket</b> - The ARN of an Amazon S3 bucket.</p>
7563+
* </li>
7564+
* <li>
7565+
* <p>
74987566
* <b>Topic</b> - The ARN of a standard SNS topic.</p>
74997567
* </li>
75007568
* <li>
75017569
* <p>
75027570
* <b>Event Bus</b> - The ARN of an Amazon EventBridge event bus.</p>
75037571
* </li>
75047572
* </ul>
7573+
* <note>
7574+
* <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
7575+
* </note>
75057576
* @public
75067577
*/
75077578
DestinationConfig?: DestinationConfig | undefined;

0 commit comments

Comments
 (0)