Skip to content

medisante/lambda-cloudwatch-experiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lambda to CloudWatch experiment

This experiment reproduces an issue of writing logs to AWS CloudWatch from AWS Lambda written in Go.

In small number of cases the last log written from the lambda will not be saved to CloudWatch. In all observed occurrence of the issue the request which exhibits the faulty behavior is the last one written in CloudWatch stream.

The simple lambda writes a log in JSON format which contains AWS request ID and message begin. Then it sleeps for 10 to 600 miliseconds. After which it again writes to log in JSON format which contains AWS request ID and message end.

Sometimes the second log (one with message end) will not be written to CloudWatch.

Gathered data

We offer the following data as proof:

How to reproduce the experiment

Please install Go and Terraform before proceeding.

Run make install to compile lambda.go binary and provision the infrastructure.

Run make run to run experiment. The experiment will invoke the lambda with invocation type Event 600 times in 600 concurrent executions waiting 5 to 6 seconds between doing request (each of indviidual 600 concurrent executions).

Wait an ~hour for any delayed CloudWatch logs to be written (known problem).

Run make analyze to analyze logs. The output will contain number of request logs analyzed, how many are missing and AWS Request IDs of missing ones.

Use CloudWatch console or AWS CLI to analyze the issue.

For clean up run make uninstall to tear-down provision infrastructure, note this will also delete the CloudWatch group with the data.

About

This experiment reproduces an issue of writing logs to AWS CloudWatch from AWS Lambda written in Go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published