feat: add configurable HTTP User-Agent for service identity#1045
feat: add configurable HTTP User-Agent for service identity#1045SoWieMarkus wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe change adds deployment-specific HTTP User-Agent configuration, renders defaults through Helm, applies values during manager startup, and propagates them through SSO, placement, and default HTTP transports. ChangesUser-Agent transport support
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Helm
participant Manager
participant SSO
participant PlacementClient
participant Upstream
Helm->>Manager: Render component and version
Manager->>SSO: SetUserAgent(component, version)
Manager->>PlacementClient: Configure wrapped transport
PlacementClient->>Upstream: Send User-Agent on placement request
Manager->>Upstream: Send User-Agent through default transport
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/scheduling/nova/history_cleanup.go (1)
75-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the accidental debug log.
"User Agent here here here"is noisy and will be emitted once per pagination page at INFO level. Remove it before merging, or replace it with a meaningful production diagnostic if logging the value is required.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/scheduling/nova/history_cleanup.go` at line 75, Remove the accidental slog.Info call containing “User Agent here here here” from the pagination flow in the history cleanup implementation; do not replace it unless a meaningful production diagnostic is required.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/scheduling/nova/history_cleanup.go`:
- Line 75: Remove the accidental slog.Info call containing “User Agent here here
here” from the pagination flow in the history cleanup implementation; do not
replace it unless a meaningful production diagnostic is required.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6183dcfb-0aa0-4563-9ea9-f1b2a071654d
📒 Files selected for processing (8)
internal/knowledge/datasources/plugins/openstack/limes/limes_api.gointernal/knowledge/datasources/plugins/openstack/nova/nova_api.gointernal/scheduling/cinder/history_cleanup.gointernal/scheduling/manila/history_cleanup.gointernal/scheduling/nova/history_cleanup.gointernal/shim/placement/auth_keystone.gointernal/shim/placement/shim.gopkg/keystone/client.go
8ad7d70 to
8121b75
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/shim/placement/shim.go`:
- Around line 549-556: Remove the global HTTP and SSO user-agent mutations from
the shim setup flow around SetupWithManager: delete the httpext.WrapTransport
call targeting http.DefaultTransport and the sso.SetUserAgent call. Keep the
shim-specific transport wrapping via sso.WrapUserAgent unchanged, relying on the
process-wide configuration established by the manager entrypoint.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4ebeae2d-e3b4-4b8c-807e-886be6a22b8e
📒 Files selected for processing (6)
cmd/manager/main.gohelm/library/cortex/templates/manager/manager.yamlhelm/library/cortex/values.yamlinternal/shim/placement/shim.gopkg/sso/sso.gopkg/sso/sso_test.go
Test Coverage ReportTest Coverage 📊: 70.2% |
Cortex previously made outgoing HTTP requests without identifying itself, so receiving services couldn't tell who was calling them. This PR adds a unified, configurable User-Agent (e.g.
cortex-nova/sha-70af93a8) to all outgoing requests, set per deployment via values.yaml.The tricky part is that cortex has two kinds of HTTP clients. Most requests go through the shared http.DefaultTransport (via http.DefaultClient or plain &http.Client{}), which we cover in one shot at startup with
httpext.WrapTransport(&http.DefaultTransport).SetOverrideUserAgent(...)(fromsapcc/go-bits). The SSO clients however, build their own transport and therefore don't share the default one — so they need a separate mechanism. For those, pkg/sso sets the header on its own transport via sso.SetUserAgent(...), with sso.WrapUserAgent(rt) for hand-built transports.The User-Agent is configured as two fields (component + version) rather than a single string, so they map cleanly onto the component/version format of the go-bits lib without any join-then-split. The Helm library chart defaults them to the release name and chart appVersion (the deployed image tag), and bundles can override as needed.