Skip to content

AWS Lambda

The displayed Metrics of AWS Lambda include cold start time, execution time, concurrent executions, and memory usage, which reflect the response speed, scalability, and resource utilization of Lambda functions.

Configuration

Install Func

It is recommended to activate the Guance integration - Extensions - DataFlux Func (Automata): all prerequisites are automatically installed, please proceed with the script installation.

If you deploy Func manually, refer to Manual Func Deployment

Install Script

Note: Please prepare the required Amazon Cloud AK in advance (for simplicity, you can directly grant CloudWatch read-only permission CloudWatchReadOnlyAccess)

Automata Script Activation

  1. Log in to the Guance console
  2. Click the 【Integration】 menu, select 【Cloud Account Management】
  3. Click 【Add Cloud Account】, select 【AWS】, and fill in the required information on the interface. If you have already configured the cloud account information, skip this step.
  4. Click 【Test】, and if the test is successful, click 【Save】. If the test fails, check the relevant configuration information and retest.
  5. Click 【Cloud Account Management】, and you can see the added cloud account in the list. Click the corresponding cloud account to enter the details page.
  6. Click the 【Integration】 button on the cloud account details page, find AWS Lambda under the Not Installed list, and click the 【Install】 button to pop up the installation interface for installation.

Manual Script Activation

  1. Log in to the Func console, click 【Script Market】, enter the official script market, and search for: guance_aws_lambda

  2. Click 【Install】, then enter the corresponding parameters: AWS AK ID, AK Secret, and account name.

  3. Click 【Deploy Startup Script】, the system will automatically create a Startup script set and configure the corresponding startup script.

  4. After activation, you can see the corresponding automatic trigger configuration in 「Management / Automatic Trigger Configuration」. Click 【Execute】 to execute it immediately without waiting for the scheduled time. After a while, you can view the execution task records and corresponding logs.

Verification

  1. Confirm in 「Management / Automatic Trigger Configuration」 whether the corresponding task has the automatic trigger configuration, and you can also check the corresponding task records and logs for any anomalies.
  2. In Guance, check in 「Infrastructure / Custom」 whether the asset information exists.
  3. In Guance, check in 「Metrics」 whether there is corresponding monitoring data.

Metrics

After configuring Amazon CloudWatch, the default Measurement is as follows. More Metrics can be collected through configuration:

Amazon CloudWatch Lambda Metrics Details

Invocation Metrics

Metric Description
Invocations The number of times the function code is invoked, including successful invocations and invocations that result in a function error. If the invocation request is throttled or results in an invocation error, the invocation is not recorded. The value of Invocations is equal to the number of billed requests.
Errors The number of invocations that result in a function error. Function errors include exceptions thrown by your code and exceptions thrown by the Lambda runtime. The runtime returns errors caused by issues such as timeouts and configuration errors. To calculate the error rate, divide the value of Errors by the value of Invocations. Note that the timestamp on the Errors metric reflects the time the function was invoked, not the time the error occurred.
DeadLetterErrors For asynchronous invocations, the number of times Lambda attempts to send an event to a dead-letter queue (DLQ) but fails. Resource misconfigurations or size limits may cause dead-letter errors.
DestinationDeliveryFailures For asynchronous invocations and supported event source mappings, the number of times Lambda attempts to send an event to a destination but fails. For event source mappings, Lambda supports destinations for stream sources (DynamoDB and Kinesis). Permission errors, resource misconfigurations, or size limits may cause delivery errors. This error may occur if you configure a destination of an unsupported type, such as an Amazon SQS FIFO queue or an Amazon SNS FIFO topic.
Throttles The number of throttled invocation requests. When all function instances are processing requests and there is no available concurrency to scale up, Lambda rejects additional requests with a TooManyRequestsException error. Throttled requests and other invocation errors are not counted as Invocations or Errors.
ProvisionedConcurrencyInvocations The number of times the function code is invoked using provisioned concurrency.
ProvisionedConcurrencySpilloverInvocations The number of times the function code is invoked using standard concurrency when all provisioned concurrency is in use.
RecursiveInvocationsDropped The number of times Lambda stops invoking your function because it detects that your function is part of an infinite recursive loop. Lambda recursive loop detection monitors the number of times your function is invoked as part of a request chain by tracking metadata added by supported AWS SDKs. If your function is invoked more than 16 times as part of a request chain, Lambda interrupts the next invocation.

Performance Metrics

Performance Metrics provide detailed information about the performance of individual function invocations. For example, the Duration metric indicates the amount of time (in milliseconds) that the function spends processing an event. To understand how quickly your function processes events, use the Average or Max statistics to view these Metrics.

Metric Description
Duration The amount of time that the function code spends processing an event. The billed duration of an invocation is the Duration value rounded up to the nearest millisecond.
PostRuntimeExtensionsDuration The cumulative amount of time that the runtime spends running code for extensions after the function code completes.
IteratorAge For event source mappings that read from a stream, the age of the last record in the event. This metric measures the amount of time between when the stream receives the record and when the event source mapping sends the event to the function.
OffsetLag For self-managed Apache Kafka and Amazon Managed Streaming for Apache Kafka (Amazon MSK) event sources, the difference between the offset of the last record written to the topic and the last record processed by the function's consumer group. Although a Kafka topic can contain multiple partitions, this metric measures the offset lag at the topic level.

Concurrency Metrics

Lambda reports concurrency Metrics as a total count of instances processing events across functions, versions, aliases, or AWS regions. To see how close you are to the concurrency limit, use the Max statistics to view these Metrics.

Metric Description
ConcurrentExecutions The number of function instances processing events. If this number reaches the region's concurrency execution quota or the reserved concurrency limit you configured on the function, Lambda will throttle additional invocation requests.
ProvisionedConcurrentExecutions The number of function instances processing events using provisioned concurrency. For each invocation of an alias or version with provisioned concurrency, Lambda emits the current count.
ProvisionedConcurrencyUtilization For a version or alias, the value of ProvisionedConcurrentExecutions divided by the total amount of provisioned concurrency allocated. For example, .5 indicates that 50% of the allocated provisioned concurrency is in use.
UnreservedConcurrentExecutions For a region, the number of events processed by functions that do not have reserved concurrency.

Asynchronous Invocation Metrics

Asynchronous invocation Metrics provide detailed information about asynchronous invocations from event sources and direct invocations. You can set thresholds and alarms to notify you of certain changes. For example, when the number of events queued for processing unexpectedly increases (AsyncEventsReceived). Or, when an event waits a long time to complete processing (AsyncEventAge).

Metric Description
AsyncEventsReceived The number of events that Lambda successfully queues for processing. This metric gives you insight into the number of events your Lambda function receives. Monitor this metric and set threshold alarms to check for issues. For example, detect the number of bad events sent to Lambda and quickly diagnose issues caused by incorrect trigger or function configurations. A mismatch between AsyncEventsReceived and Invocations may indicate a discrepancy in processing, events being dropped, or a potential queue backlog.
AsyncEventAge The amount of time between when Lambda successfully queues an event and when the function is invoked. When an event is retried due to an invocation failure or throttling, the value of this metric increases. Monitor this metric and set alarms for different statistics thresholds when a queue backlog occurs. To resolve an increase in this metric, review the Errors metric to identify function errors and the Throttles metric to determine concurrency issues.
AsyncEventsDropped The number of events that are dropped without successfully executing the function. If you configure a dead-letter queue (DLQ) or OnFailure destination, events are sent there before being dropped. Events are dropped for various reasons. For example, an event may exceed the maximum event age or exhaust the maximum number of retries, or the reserved concurrency may be set to 0. To resolve dropped events, review the Errors metric to identify function errors and the Throttles metric to determine concurrency issues.

Object

The collected AWS Lambda object data structure can be seen in 「Infrastructure - Custom」.

{
  "measurement": "aws_lambda",
  "tags": {
    "account_name"      :"AWS_Lambda",
    "class"             :"aws_lambda",
    "cloud_provider"    :"aws",
    "FunctionName"      :"dataflux-alb",
    "name"              :"dataflux-alb",
    "PackageType"       :"Zip",
    "RegionId"          :"cn-northwest-1",
    "RevisionId"        :"5e52ff51-615a-4ecb-96b7-40083a7b4b62",
    "Role"              :"arn:aws-cn:iam::294654068288:role/service-role/s3--xxxx-role-3w34zo42",
    "Runtime"           :"python3.7",
    "Version"           :"$LATEST"
  },
  "fields": {
    "CreatedTime"         : "2022-03-09T06:13:31Z",
    "ListenerDescriptions": "{JSON Data}",
    "AvailabilityZones"   : "{Availability Zone JSON Data}",
    "message"             : "{Instance JSON Data}"
  }
}

Note: The fields in tags and fields may change with subsequent updates.

Tip 1: The value of tags.account_name is the instance ID, used as a unique identifier.

Feedback

Is this page helpful? ×