Migrating maintained apps, failing policies, and webhooks to slog. - #40149
Conversation
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Pull request overview
This PR continues the migration from go-kit/log to slog (continuation of #38889), focusing on webhooks, failing policies, and maintained apps modules. The changes consistently migrate logger parameters from kitlog.Logger to *slog.Logger, update logging calls from level.Debug/Info/Error(logger).Log(...) to logger.DebugContext/InfoContext/ErrorContext(ctx, ...), and update tests to use slog.New(slog.DiscardHandler) instead of kitlog.NewNopLogger().
Changes:
- Migrated webhook functions (vulnerabilities, host status, failing policies) from go-kit/log to slog
- Migrated policy automation functions to use *slog.Logger with context-aware logging methods
- Updated maintained apps ingesters (homebrew, winget) and main command to use slog
- Updated cron.go to properly adapt *logging.Logger to *slog.Logger using SlogLogger() method
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| server/webhooks/vulnerabilities.go | Migrated TriggerVulnerabilitiesWebhook to use *slog.Logger with DebugContext |
| server/webhooks/vulnerabilities_test.go | Updated test to use slog.New(slog.DiscardHandler) |
| server/webhooks/host_status.go | Migrated TriggerHostStatusWebhook and helper functions to *slog.Logger with DebugContext |
| server/webhooks/host_status_test.go | Updated tests to use slog.New(slog.DiscardHandler) |
| server/webhooks/failing_policies.go | Migrated SendFailingPoliciesBatchedPOSTs to *slog.Logger with DebugContext |
| server/webhooks/failing_policies_test.go | Updated tests to use slog.New(slog.DiscardHandler) |
| server/policies/failing_policies.go | Migrated TriggerFailingPoliciesAutomation and makeDefaultTeamConfigCache to *slog.Logger with DebugContext/ErrorContext |
| server/policies/failing_policies_test.go | Updated tests to use slog.New(slog.DiscardHandler) |
| server/service/integration_enterprise_test.go | Updated integration test to use slog.New(slog.DiscardHandler) |
| ee/maintained-apps/maintained_apps.go | Updated Ingester function type signature to accept *slog.Logger |
| ee/maintained-apps/ingesters/winget/ingester.go | Migrated IngestApps to use *slog.Logger with InfoContext/DebugContext |
| ee/maintained-apps/ingesters/homebrew/ingester.go | Migrated IngestApps to use *slog.Logger with InfoContext |
| ee/maintained-apps/ingesters/homebrew/ingester_test.go | Updated test to use slog.New(slog.DiscardHandler) |
| cmd/maintained-apps/main.go | Migrated main function to create slog.Logger with JSON handler and use InfoContext/ErrorContext |
| cmd/fleet/cron.go | Updated to call logger.SlogLogger() when passing to migrated webhook and policy functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
WalkthroughThis PR continues the migration from go-kit/log to Go's standard library slog across multiple packages. It replaces logger parameters from Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #40149 +/- ##
==========================================
+ Coverage 66.31% 66.33% +0.01%
==========================================
Files 2449 2452 +3
Lines 196528 196631 +103
Branches 8677 8537 -140
==========================================
+ Hits 130334 130435 +101
- Misses 54381 54387 +6
+ Partials 11813 11809 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Related issue: Resolves #40054
Checklist for submitter
changes/,orbit/changes/oree/fleetd-chrome/changes.Testing
Summary by CodeRabbit