-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gin exporter: support reading Client IP from custom headers (and make sure proxy is trusted) #6095
base: main
Are you sure you want to change the base?
Conversation
… sure proxy is trusted) With Gin, it's possible to configure the server to read the Client IP from custom headers; examples include `X-Real-Ip` or `CF-Connecting-IP`. This PR makes it possible to set as span attribute the same IP that Gin reads. Additionally, it makes sure that headers such as "X-Forwarded-For" are used only if Gin is configured to trust the upstream server PS: Also fixed unit tests, where there were assertions inside handlers, which are executed in separate goroutines
Could you split that into another PR, to make things easier to review? |
Done |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6095 +/- ##
=======================================
+ Coverage 65.7% 65.8% +0.1%
=======================================
Files 204 204
Lines 13088 13121 +33
=======================================
+ Hits 8608 8643 +35
+ Misses 4216 4215 -1
+ Partials 264 263 -1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need a changelog entry.
...rumentation/github.com/emicklei/go-restful/otelrestful/internal/semconvutil/httpconv_test.go
Show resolved
Hide resolved
...rumentation/github.com/emicklei/go-restful/otelrestful/internal/semconvutil/httpconv_test.go
Outdated
Show resolved
Hide resolved
...rumentation/github.com/emicklei/go-restful/otelrestful/internal/semconvutil/httpconv_test.go
Show resolved
Hide resolved
Co-authored-by: Damien Mathieu <[email protected]>
With Gin, it's possible to configure the server to read the Client IP from custom headers; examples include
X-Real-Ip
orCF-Connecting-IP
. This PR makes it possible to set as span attribute the same IP that Gin reads.Additionally, it makes sure that headers such as "X-Forwarded-For" are used only if Gin is configured to trust the upstream server