aws / aws/aws-lambda-runtime-interface-emulator
The "Init Duration" reported by the RIE is wrong
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 118
- Avg merge
- 42m
- Merged PRs (30d)
- 2
Description
The "Init Duration" reported by the RIE is much too small. It is taken [before the actual language runtime is even started](https://github.com/aws/aws-lambda-runtime-interface-emulator/blob/2057adac54dbd781b51431f775363ec021648c77/cmd/aws-lambda-rie/handlers.go#L98):
```go
initStart, initEnd := InitHandler(sandbox, functionVersion, timeout, bs)
```
Instead, the end of the Init phase should be recorded when the [`sendInitRuntimeDoneLogEvent()`](https://github.com/aws/aws-lambda-runtime-interface-emulator/blob/2057adac54dbd781b51431f775363ec021648c77/lambda/rapid/handlers.go#L358) is posted:
```go
defer func() {
sendInitRuntimeDoneLogEvent(execCtx, sbInfoFromInit.SandboxType, runtimeDoneStatus)
}()
```
Contributor guide
Assessment
This issue has not been assessed yet.