-
Notifications
You must be signed in to change notification settings - Fork 736
fix: Initialize logger earlier to capture startup logs #3570
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
base: main
Are you sure you want to change the base?
Conversation
|
👋 Hi flpanbin! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
Signed-off-by: bin <[email protected]>
ed4327a to
c333d84
Compare
WalkthroughThe main function in deploy/cloud/operator/cmd/main.go moves controller-runtime logger initialization to occur immediately after flag parsing and removes the later, duplicate SetLogger call after SetupSignalHandler. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Proc as Process Start
participant Flags as Flag Parsing
participant Log as Logger
participant Ctx as Signal Handler
participant RT as Runtime Setup
note over Proc,RT: Startup sequence (updated)
Proc->>Flags: Parse CLI flags
Flags->>Log: Configure logger (SetLogger)
note right of Log: Earlier initialization
Proc->>Ctx: SetupSignalHandler
Ctx->>RT: Initialize controllers/runtime
RT-->>Log: Use configured logger
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
WalkthroughLogger initialization in deploy/cloud/operator/cmd/main.go is moved to immediately after flag.Parse using Zap with UseFlagOptions. The later, duplicate logger setup is removed. This changes only the timing of logger setup so it occurs before namespace and role validation. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Main
participant Flags as Flag Parser
participant Logger as Zap Logger
participant Validate as Namespace/Role Validation
participant Runtime as Operator Runtime
Main->>Flags: flag.Parse()
Flags-->>Main: parsed options
Main->>Logger: init logger (UseFlagOptions)
Note right of Logger: Logger configured earlier than before
Main->>Validate: validate restrictedNamespace / plannerClusterRoleName
Validate-->>Main: ok or error
alt ok
Main->>Runtime: start operator runtime
else error
Main-->>Main: exit with error
end
%% Previously: a second, duplicate logger init occurred here (removed)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Poem
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @julienmancuso , Could you please help review this PR? |
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
/no-stale |
Overview:
Moves
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))initialization earlier to ensure logs are properly captured from the beginning.Details:
This fixes missing log entries that occurred before the logger was initialized. like this:
dynamo/deploy/cloud/operator/cmd/main.go
Line 190 in 60975b5
dynamo/deploy/cloud/operator/cmd/main.go
Line 200 in 60975b5
dynamo/deploy/cloud/operator/cmd/main.go
Line 204 in 60975b5
dynamo/deploy/cloud/operator/cmd/main.go
Line 209 in 60975b5
Where should the reviewer start?
deploy/cloud/operator/cmd/main.go
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
No user-facing functionality has changed. Users may notice more consistent log output during early startup phases, improving observability without altering behavior.