feat(observability): add MCP tool name logging in access log
Some checks failed
CI / build-and-test (push) Failing after -32m45s
Some checks failed
CI / build-and-test (push) Failing after -32m45s
* Include tool name from request in access log entries * Update user agent header in HTTP requests * Add tests for MCP tool name logging
This commit is contained in:
@@ -11,10 +11,9 @@ import (
|
||||
//
|
||||
// Header precedence:
|
||||
// 1) X-Real-IP
|
||||
// 2) X-Forwarded-Host
|
||||
// 3) X-Forwarded-For (first value)
|
||||
// 4) Forwarded (for=...)
|
||||
// 5) RemoteAddr (host part)
|
||||
// 2) X-Forwarded-For (first value)
|
||||
// 3) Forwarded (for=...)
|
||||
// 4) RemoteAddr (host part)
|
||||
func FromRequest(r *http.Request) string {
|
||||
if r == nil {
|
||||
return ""
|
||||
@@ -23,9 +22,6 @@ func FromRequest(r *http.Request) string {
|
||||
if v := firstAddressToken(r.Header.Get("X-Real-IP")); v != "" {
|
||||
return stripPort(v)
|
||||
}
|
||||
if v := firstAddressToken(r.Header.Get("X-Forwarded-Host")); v != "" {
|
||||
return stripPort(v)
|
||||
}
|
||||
if v := firstAddressToken(r.Header.Get("X-Forwarded-For")); v != "" {
|
||||
return stripPort(v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user