-
Notifications
You must be signed in to change notification settings - Fork 59
Add WIP template which vendors the watchdog instead of using a separate process #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The watchdog is imported as an SDK to avoid an extra hop and to reduce total memory usage of one Go process vs two. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
ReviewCode Review: PR #90 - Add WIP template which vendors the watchdog instead of using a separate processSummaryThis PR introduces a new Golang template ( Overall AssessmentApproval Recommended with Minor Revisions The core idea of in-process watchdog integration is sound and addresses a valid performance concern (reduced RAM usage from ~15Mi to ~7-10Mi). The implementation is technically correct and follows existing patterns in the codebase. However, there are concerns around testing coverage, logging migration guidance, and potential edge cases in configuration handling. The lack of unit tests for the new template is a notable gap given the complexity of the watchdog integration. Severity: Medium - Proceed with fixes for testing and documentation. Detailed Review CommentsCorrectness
Impact and Migration
Testing
Efficiency and Performance
Security
Consistency
Potential Regressions
Code Quality
Dependencies
AI Agent output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new WIP template golang-middleware-inproc that vendors the of-watchdog as an SDK instead of running it as a separate process, reducing memory usage from ~15Mi to ~7-10Mi. Additionally, it updates version dependencies across existing templates.
- Introduces the new
golang-middleware-inproctemplate with integrated watchdog - Updates Go runtime from 1.24.0 to 1.25 and Alpine Linux from 3.22.0 to 3.22.2 in existing templates
- Bumps of-watchdog from 0.10.11 to 0.10.12
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| template/golang-middleware/template.yml | Updated welcome message to reflect Go 1.25 and added go.mod version note |
| template/golang-middleware/Dockerfile | Upgraded of-watchdog to 0.10.12, Go to 1.25, and Alpine to 3.22.2 |
| template/golang-middleware-inproc/template.yml | New template configuration for in-process watchdog variant |
| template/golang-middleware-inproc/main.go | Main entry point that configures and starts the vendored watchdog |
| template/golang-middleware-inproc/go.work | Go workspace configuration for multi-module setup |
| template/golang-middleware-inproc/go.sum | Dependency checksums including watchdog SDK |
| template/golang-middleware-inproc/go.mod | Module dependencies with watchdog as a direct dependency |
| template/golang-middleware-inproc/function/handler.go | Example handler implementation with structured logging |
| template/golang-middleware-inproc/function/go.mod | Function module definition |
| template/golang-middleware-inproc/Dockerfile | Multi-stage build with Go 1.25 and Alpine 3.22.1 |
| template/golang-middleware-inproc/.gitignore | Excludes compiled handler binary |
| template/golang-http/Dockerfile | Updated to use of-watchdog 0.10.12, Go 1.25, and Alpine 3.22.2 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| input = body | ||
| } | ||
|
|
||
| log.Info("Sleeping for 1 milliseconds") |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammatical error: '1 milliseconds' should be '1 millisecond' (singular).
| log.Info("Sleeping for 1 milliseconds") | |
| log.Info("Sleeping for 1 millisecond") |
Description
Add WIP template which vendors the watchdog instead of using a separate process
The watchdog is imported as an SDK to avoid an extra hop and to reduce total memory usage of one Go process vs two.
How Has This Been Tested?
Tested in-cluster on OpenFaaS for Enterprises, the RAM usage was reporting about 7-10Mi after a number of invocations, vs. up to 15Mi with the version that contains two separate processes.
How are existing users impacted? What migration steps/scripts do we need?
Any prefixing to log.Printf must be done with an overridden logger in the handler since there is only one process, log redirection isn't possible for stderr/stdout transparently.
Checklist:
I have:
git commit -s