Open
Conversation
Reviewer's GuideUpgrade the Go toolchain and various dependencies, and adjust application code and build tooling to align with new library versions and static-analysis expectations. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
SC Environment Impact AssessmentOverall Impact: ⚪ NONE No SC Environment-specific impacts detected in this PR. What was checkedThis PR was automatically scanned for:
|
1 task
f363700 to
fb562bb
Compare
MichaelMraka
reviewed
Mar 5, 2026
fb562bb to
93396f8
Compare
93396f8 to
cff0fbb
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2089 +/- ##
==========================================
- Coverage 59.45% 59.40% -0.06%
==========================================
Files 134 134
Lines 8699 8707 +8
==========================================
Hits 5172 5172
- Misses 2981 2989 +8
Partials 546 546
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:
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
pprofHandler/getPprofrefactor now relies on string service names and a hard‑coded switch; consider either passing the address directly (as before) or introducing typed constants / a map to avoid runtime errors from typos and to make it easier to add new services. - In
RequestResponseLogger, the17used to preallocatefieldsis a magic number; it would be clearer and less fragile to derive this from the actual fixed fields or define it as a named constant that is updated alongside any changes to the logged fields.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `pprofHandler` / `getPprof` refactor now relies on string service names and a hard‑coded switch; consider either passing the address directly (as before) or introducing typed constants / a map to avoid runtime errors from typos and to make it easier to add new services.
- In `RequestResponseLogger`, the `17` used to preallocate `fields` is a magic number; it would be clearer and less fragile to derive this from the actual fixed fields or define it as a named constant that is updated alongside any changes to the logged fields.
## Individual Comments
### Comment 1
<location path="manager/middlewares/logger.go" line_range="18-20" />
<code_context>
tStart := time.Now()
c.Next()
- var fields []interface{}
+ // 17 is the number of fields that are always logged
+ // 2 is the number of fields for each parameter
+ var fields = make([]any, 0, 17+2*len(c.Params))
duration := time.Since(tStart).Nanoseconds() / 1e6
</code_context>
<issue_to_address>
**suggestion:** Hardcoding the field count in the preallocation is brittle and can easily get out of sync.
Preallocation is useful here, but coupling it to a hardcoded literal + comment makes it easy to miss when fields change. Consider deriving the base capacity from a constant or from the actual fixed fields (e.g., via a helper that builds the base slice), so changes to logged keys don’t require manually updating this number and comment.
Suggested implementation:
```golang
const (
baseLogFieldCount = 17 // number of fields that are always logged
paramFieldCount = 2 // number of fields for each parameter
)
return func(c *gin.Context) {
```
```golang
var fields = make([]any, 0, baseLogFieldCount+paramFieldCount*len(c.Params))
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This was referenced Mar 5, 2026
MichaelMraka
approved these changes
Mar 5, 2026
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.
This PR upgrades all golang dependencies.
Summary by Sourcery
Upgrade Go toolchain and project dependencies and apply minor refactors for compatibility and performance.
Enhancements:
Build: