Skip to content

Merge branch 'master' into TT-14891/dynamic-xff-client-ip

a3d051d
Select commit
Loading
Failed to load commit list.
Merged

TT-14891 - adds client ip from XFF by depth #7063

Merge branch 'master' into TT-14891/dynamic-xff-client-ip
a3d051d
Select commit
Loading
Failed to load commit list.
probelabs / Visor: performance succeeded Nov 12, 2025 in 3m 25s

✅ Check Passed (Warnings Found)

performance check passed. Found 1 warning, but fail_if condition was not met.

Details

📊 Summary

  • Total Issues: 1
  • Warning Issues: 1

🐛 Issues by Category

⚡ Performance (1)

  • ⚠️ request/real_ip.go:29 - The RealIP function unconditionally uses strings.Split on the X-Forwarded-For header. This introduces a performance regression for the default and most common configuration (XFFDepth: 0) compared to the previous implementation, which was more efficient. The unnecessary memory allocations on every request for the default path can increase garbage collection pressure in a high-traffic gateway.

Powered by Visor from Probelabs

💡 TIP: You can chat with Visor using /visor ask <your question>

Annotations

Check warning on line 49 in request/real_ip.go

See this annotation in the file changed.

@probelabs probelabs / Visor: performance

performance Issue

The `RealIP` function unconditionally uses `strings.Split` on the `X-Forwarded-For` header. This introduces a performance regression for the default and most common configuration (`XFFDepth: 0`) compared to the previous implementation, which was more efficient. The unnecessary memory allocations on every request for the default path can increase garbage collection pressure in a high-traffic gateway.
Raw output
Optimize the function by creating a fast path for the default case (`depth == 0`) that avoids `strings.Split`. The original logic of finding the first comma and slicing the string should be restored for this common path. The `strings.Split` operation should only be performed when a non-zero `depth` is configured.