-
Notifications
You must be signed in to change notification settings - Fork 579
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 67.0% 67.1%
=====================================
Files 194 194
Lines 12658 12691 +33
=====================================
+ Hits 8492 8523 +31
- Misses 3888 3889 +1
- Partials 278 279 +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]>
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). |
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