refactor: use constants for component logger names#308
refactor: use constants for component logger names#308jason-lynch wants to merge 1 commit intomainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
✅ Files skipped from review due to trivial changes (9)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughReplaces string-based logger component names with a typed Changes
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
server/internal/etcd/logging.go (1)
25-31: Consider:newGrpcLoggerstill uses"component"field key.Unlike
newZapLogger, this function usesStr("component", "grpc_logger"). Since gRPC logs are set toFatalLevel, this is unlikely to cause issues in practice, but for consistency you might consider renaming to"grpc_component"or similar.♻️ Optional: Align field key with newZapLogger pattern
func newGrpcLogger(base zerolog.Logger) *zapgrpc.Logger { core := zerozap.New(base. Level(zerolog.FatalLevel). With(). - Str("component", "grpc_logger"). + Str("grpc_component", "grpc_logger"). Logger()) return zapgrpc.NewLogger(zap.New(core)) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@server/internal/etcd/logging.go` around lines 25 - 31, Update the field key in newGrpcLogger so it matches the pattern used by newZapLogger: replace Str("component", "grpc_logger") with a namespaced key like Str("grpc_component", "grpc_logger") (or whatever key newZapLogger uses) to keep log field naming consistent; locate this change inside the newGrpcLogger function where zerozap.New is constructed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@server/internal/etcd/logging.go`:
- Around line 25-31: Update the field key in newGrpcLogger so it matches the
pattern used by newZapLogger: replace Str("component", "grpc_logger") with a
namespaced key like Str("grpc_component", "grpc_logger") (or whatever key
newZapLogger uses) to keep log field naming consistent; locate this change
inside the newGrpcLogger function where zerozap.New is constructed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ea4d9ea7-72ce-4531-bbf1-e8052c60d917
📒 Files selected for processing (13)
docs/installation/configuration.mdserver/internal/api/server.goserver/internal/election/candidate.goserver/internal/etcd/embedded.goserver/internal/etcd/logging.goserver/internal/etcd/remote.goserver/internal/logging/factory.goserver/internal/migrate/migrations/add_task_scope.goserver/internal/migrate/runner.goserver/internal/ports/service.goserver/internal/scheduler/service.goserver/internal/workflows/provide.goserver/internal/workflows/worker.go
Switches to using constants for and centralizes all of the component names. This will make it easier to keep the component list in our docs up-to-date.
0eba7c4 to
08cb7d1
Compare
Summary
Switches to using constants for and centralizes all of the component names. This will make it easier to keep the component list in our docs up-to-date.
Testing
The only functional change in this PR is that I added support for configuring the workflows backend log level:
{ "profiling_enabled": true, "client_addresses": ["127.0.0.1"], "logging": { "component_levels": { "workflows_backend": "debug" } } }Otherwise, everything should behave the same as it always has.