aws / aws/aws-lambda-runtime-interface-emulator

The "Init Duration" reported by the RIE is wrong

Open
#106 2 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.