-
Notifications
You must be signed in to change notification settings - Fork 670
Gin instrumentation: support reading Client IP from custom headers, and make sure proxy is trusted #6095
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
Conversation
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 75.7% 75.8%
=====================================
Files 207 207
Lines 19403 19469 +66
=====================================
+ Hits 14695 14758 +63
- Misses 4273 4275 +2
- Partials 435 436 +1
🚀 New features to boost your workflow:
|
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
instrumentation/github.com/gin-gonic/gin/otelgin/gintrace_test.go
Outdated
Show resolved
Hide resolved
...rumentation/github.com/emicklei/go-restful/otelrestful/internal/semconvutil/httpconv_test.go
Show resolved
Hide resolved
instrumentation/github.com/gin-gonic/gin/otelgin/gintrace_test.go
Outdated
Show resolved
Hide resolved
@dmathieu is this PR ready to be merged? |
PRs need two approvals. |
@dmathieu is there a way I get a review/approval from another person? |
Ping @open-telemetry/go-approvers for review. Note that this instrumentation has no owner, and is therefore in the process of being deprecated/removed unless someone steps up to own it (which also explains the lack of reviews). |
Looks like this instrumentation may have an owner now. If I fix the merge conflicts, can this PR be merged now? |
Hey @ItalyPaleAle, can you please resolve the conflicts |
… 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
666002a
to
5739da4
Compare
@akats7 sorry for the delay, as the amount of merge conflicts that had accumulated meant I had to recreate the PR from scratch. Should be good for your review now! |
Could I get a review on this please? Also, is there a way to ensure PRs like this don't keep accumulating conflicts in the changelog? |
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