# README
profile: AWS Lambda performance profiling
An AWS Lambda Function performance profiling tool based on profile package by Dave Cheney.
The idea is to provide an adapter on top of the existing package to make it easier to use in the context of AWS Lambda.
The profiling output file is uploaded to an S3 bucket.
🚀 Install
go get github.com/jbleduigou/aws-lambda-profile
Compatibility: go >= 1.21
💡 Usage
GoDoc: https://pkg.go.dev/github.com/jbleduigou/aws-lambda-profile
Basic example
To enable profiling in your application, you need to add one line in your main function:
import profile "github.com/jbleduigou/aws-lambda-profile"
func main(ctx context.Context) {
defer profile.Start(profile.S3Bucket("pprof-bucket"), profile.AWSRegion("eu-west-1")).Stop(ctx)
}
CPU profiling
By default, the CPU profiling is enabled.
You can still explicitly enable it by using the CPUProfile
option:
import profile "github.com/jbleduigou/aws-lambda-profile"
defer profile.Start(profile.CPUProfile, profile.S3Bucket("pprof-bucket"), profile.AWSRegion("eu-west-1")).Stop(ctx)
Memory profiling
To enable memory profiling, you can use the MemProfile
option:
import profile "github.com/jbleduigou/aws-lambda-profile"
defer profile.Start(profile.MemProfile, profile.S3Bucket("pprof-bucket"), profile.AWSRegion("eu-west-1")).Stop(ctx)
🤝 Contributing
Feel free to contribute to this project, either my opening issues or submitting pull requests.
Don't hesitate to contact me, by sending me a PM on LinkedIn.
👤 Contributors
The only contributor so far is me, Jean-Baptiste Le Duigou. Feel free to check my blog to about my other projects: http://www.jbleduigou.com
💫 Show your support
Give a ⭐️ if this project helped you!
📝 License
This project is BSD licensed.