Sparta v0.20.0 Release Notes
-
๐ :star: Deprecation Notice
๐ The
sparta.LambdaFunc
signature is officially deprecated in favor ofhttp.HandlerFunc
and will be removed in an upcoming release. See below for more information- ๐ฅ :warning: BREAKING
- Changed
NewLambdaHTTPHandler
toNewServeMuxLambda
- Remove obsolete
InvokeID
from LambdaContext - Changed
codePipelineTrigger
CLI arg name tocodePipelinePackage
- Changed
:checkered_flag: CHANGES
- Eliminated NodeJS cold start
cp & chmod
penalty! :fire: - Prior to this release, the NodeJS proxying code would copy the embedded binary to /tmp and add the executable flag prior to actually launching the binary. This had a noticeable performance penalty for startup.
- This release embeds the application or library in a ./bin directory with the file permissions set so that there is no additional filesystem overhead on cold-start. h/t to StackOverflow for the tips.
- Migrated all IPC calls to protocolBuffers.
- Message definitions are in the proxy directory.
- The client-side log level (eg:
--level debug
) is carried into the AWS Lambda Code package. - Provisioning a service with
--level debug
will log everything atlogger.Debug
level and higher including all AWS API calls made both atprovision
and Lambda execution time. - Help resolve "Works on My Stack" syndrome.
- HTTP handler
panic
events are now recovered and the traceback logged for both NodeJS andcgo
deployments - Introduced
sparta.HandleAWSLambda
sparta.HandleAWSLambda
accepts standardhttp.RequestFunc
signatures as in:
func helloWorld(w http.ResponseWriter, r *http.Request) { ... } lambdaFn := sparta.HandleAWSLambda("Hello HTTP World", http.HandlerFunc(helloWorld), sparta.IAMRoleDefinition{})
- This allows you to chain middleware for a lambda function as if it were a standard HTTP handler. Say, for instance: X-Ray.
- The legacy sparta.LambdaFunction is still supported, but marked for deprecation. You will see a log warning as in:
WARN[0045] DEPRECATED: sparta.LambdaFunc() signature provided. Please migrate to http.HandlerFunc()
- LambdaContext and *logrus.Logger are now available in the requext.Context() via:
sparta.ContextKeyLogger
=>*logrus.Logger
sparta.ContextKeyLambdaContext
=>*sparta.LambdaContext
- Example:
loggerVal, loggerValOK := r.Context().Value(sparta.ContextKeyLogger).(*logrus.Logger)
- Added support for CodePipeline
- See the SpartaCodePipeline project for a complete example and the related post.
- Upgraded NodeJS to nodejs6.10 runtime
- Parity between NodeJS and Python/
cgo
startup output - Both NodeJS and
cgo
based Sparta applications now log equivalent system information. - Example:
{ "level": "info", "msg": "SystemInfo", "systemInfo": { "sysinfo": { "version": "0.9.1", "timestamp": "2017-09-16T17:07:34.491807588Z" }, "node": { "hostname": "ip-10-25-51-97", "machineid": "0046d1358d2346adbf8851e664b30d25", "hypervisor": "xenhvm", "timezone": "UTC" }, "os": { "name": "Amazon Linux AMI 2017.03", "vendor": "amzn", "version": "2017.03", "architecture": "amd64" }, "kernel": { "release": "4.9.43-17.38.amzn1.x86_64", "version": "#1 SMP Thu Aug 17 00:20:39 UTC 2017", "architecture": "x86_64" }, "product": {}, "board": {}, "chassis": {}, "bios": {}, "cpu": { "vendor": "GenuineIntel", "model": "Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz", "cache": 25600, "threads": 2 }, "memory": {} }, "time": "2017-09-16T17:07:34Z" }
- Eliminated NodeJS cold start
๐ :bug: FIXED
- There were more than a few
- ๐ฅ :warning: BREAKING