refactor(api): replace gorilla/mux with net/http across agent servers#50380
Draft
refactor(api): replace gorilla/mux with net/http across agent servers#50380
Conversation
Contributor
Go Package Import DifferencesBaseline: ed51e26
|
Contributor
|
🎯 Code Coverage (details) 🔗 Commit SHA: dfd5a19 | Docs | Datadog PR Page | Give us feedback! |
f12bfd0 to
3d9761e
Compare
Replaces github.com/gorilla/mux (and gorilla/handlers) with the standard library net/http across most of the agent's HTTP servers. Second step in the series to remove gorilla entirely — follow-up to #50275. Not included: cmd/system-probe (module router requires an API redesign) and comp/core/gui (auth middleware scoping needs a design decision). Those are the last two remaining uses. Changes: - All servers migrated: agent CMD/IPC, cluster-agent, security-agent, process-agent, CLC runner, health probe, settings, status, fleet daemon, flare extensions - gorilla/handlers.RecoveryHandler replaced with pkg/api/middleware - Fleet daemon Content-Type gate converted to a middleware - Observability: WrapWithRouteTemplate and MountWithPrefix added to the observability package to preserve route-template metric tags across sub-mux mounting - pkg/api/coverage.SetupCoverageHandler updated to accept *http.ServeMux
3d9761e to
dfd5a19
Compare
Contributor
Files inventory check summaryFile checks results against ancestor ed51e26c: Results for datadog-agent_7.80.0~devel.git.512.dfd5a19.pipeline.111745096-1_amd64.deb:No change detected |
Contributor
Static quality checks✅ Please find below the results from static quality gates Successful checksInfo
5 successful checks with minimal change (< 2 KiB)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Replaces
github.com/gorilla/mux(andgorilla/handlers) with the standard librarynet/httpacross most of the agent's HTTP servers. Second step in the series to remove gorilla entirely — follow-up to #50275.Not included:
cmd/system-probe(module router needs an API redesign) andcomp/core/gui(auth middleware scoping needs a design decision). Those are the last two remaining uses.Motivation
gorilla/muxhas been archived since 2023. Go 1.22+net/httpcovers everything we use.Describe how you validated your changes
Builds pass for agent, cluster-agent, security-agent, and process-agent. Unit tests pass. Pre-push linter and test hooks pass.