fix(runtime): log service startup errors instead of printing them beside the log#3140
fix(runtime): log service startup errors instead of printing them beside the log#3140dschmidt wants to merge 2 commits into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
🟢 Coverage 0.00% diff coverage · -0.03% coverage variation
Metric Results Coverage variation ✅ -0.03% coverage variation (-1.00%) Diff coverage ✅ 0.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (85e63ca) 82473 19129 23.19% Head commit (fec92d2) 82490 (+17) 19112 (-17) 23.17% (-0.03%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#3140) 21 0 0.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull request overview
This PR fixes how service startup failures surface in logs by preventing Cobra from printing raw error/usage text into the log stream and by ensuring supervised service termination events log the actual error message (instead of "error":{}).
Changes:
- Configure Cobra commands via
clihelper.DefaultAppto silence Cobra’s own error printing and to silence usage output once command execution begins. - Update the runtime suture event hook to log
EventServiceTerminate.Errvia the logger’sErr()path when it’s anerror, producing a proper"error":"..."field.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/clihelper/app.go | Silences Cobra error printing and suppresses usage output after hooks start running to avoid plain-text noise in logs. |
| opencloud/pkg/runtime/service/service.go | Logs supervised service termination errors using Err() (when applicable) so JSON logs contain the real error string instead of an empty object. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Service startup errors were printed as plain text into the log stream (
SilenceErrors/SilenceUsageunset on the cobra app), and the one record about the failure carried"error":{}(suture'sev.Erris aninterface{}, so it got marshaled instead of passed toErr()).The example below is the schema mismatch error from #3098, but this is not specific to it: every startup error of every service has this shape.
before:
after: