Skip to content

Migrating maintained apps, failing policies, and webhooks to slog. - #40149

Merged
getvictor merged 2 commits into
mainfrom
victor/40054-slog-maintained-apps
Feb 23, 2026
Merged

Migrating maintained apps, failing policies, and webhooks to slog.#40149
getvictor merged 2 commits into
mainfrom
victor/40054-slog-maintained-apps

Conversation

@getvictor

@getvictor getvictor commented Feb 20, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves #40054

Checklist for submitter

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    • present in a previous PR

Testing

  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • Refactor
    • Updated logging infrastructure throughout the application to use Go's standard library logging system. This replaces the previous logging implementation with an improved, standardized approach. Logging output format may appear slightly different, but all diagnostic and operational logging capabilities remain fully intact and functional.

@getvictor

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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.

@coderabbitai

coderabbitai Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR continues the migration from go-kit/log to Go's standard library slog across multiple packages. It replaces logger parameters from kitlog.Logger to *slog.Logger, updates function signatures to accept the new logger type, converts logging statements from go-kit style (level-based logging) to slog style (context-aware methods like InfoContext and DebugContext), and adjusts imports accordingly. Changes are applied to webhook handling, policy automation, maintained apps ingesters, and cron jobs while preserving existing control flow and logging semantics.

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description lacks required details: no explanation of changes, incomplete testing section, and missing information about changes files status. Add a clear summary of the migration changes, specify whether changes files are needed or already present, and complete the testing section with details about what was QA'd and how the changes were validated.
Out of Scope Changes check ❓ Inconclusive Most changes align with slog migration, but modifications to server/service/integration_enterprise_test.go appear tangential to the stated scope of migrating logging in maintained apps, failing policies, and webhooks. Clarify whether test modifications to integration_enterprise_test.go are part of the slog migration scope or should be removed from this PR.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Migrating maintained apps, failing policies, and webhooks to slog' accurately describes the main code changes replacing go-kit logging with slog throughout these components.
Linked Issues check ✅ Passed The code changes comprehensively address the slog migration objective from issue #40054 by replacing go-kit logging (kitlog.Logger) with standard library slog (*slog.Logger) across maintained apps, failing policies, and webhooks components.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch victor/40054-slog-maintained-apps

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Feb 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.73469% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.33%. Comparing base (274abc6) to head (da7ee45).
⚠️ Report is 80 commits behind head on main.

Files with missing lines Patch % Lines
server/policies/failing_policies.go 33.33% 16 Missing ⚠️
cmd/maintained-apps/main.go 0.00% 6 Missing ⚠️
ee/maintained-apps/ingesters/winget/ingester.go 0.00% 4 Missing ⚠️
ee/maintained-apps/ingesters/homebrew/ingester.go 0.00% 3 Missing ⚠️
cmd/fleet/cron.go 60.00% 1 Missing and 1 partial ⚠️
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     
Flag Coverage Δ
backend 68.13% <36.73%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@getvictor
getvictor marked this pull request as ready for review February 20, 2026 13:13
@getvictor
getvictor requested a review from a team as a code owner February 20, 2026 13:13
Comment thread server/webhooks/failing_policies.go Outdated
Comment thread server/webhooks/vulnerabilities.go Outdated
@getvictor
getvictor merged commit 454f7d4 into main Feb 23, 2026
48 checks passed
@getvictor
getvictor deleted the victor/40054-slog-maintained-apps branch February 23, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

slog migration (2)

3 participants