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:
@@ -9,7 +9,7 @@ import (
|
||||
func TestFromRequestPrefersXRealIP(t *testing.T) {
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
req.RemoteAddr = "10.0.0.10:5555"
|
||||
req.Header.Set("X-Forwarded-Host", "proxy.example.com")
|
||||
req.Header.Set("X-Forwarded-For", "198.51.100.1")
|
||||
req.Header.Set("X-Real-IP", "203.0.113.10")
|
||||
|
||||
if got := FromRequest(req); got != "203.0.113.10" {
|
||||
@@ -17,16 +17,6 @@ func TestFromRequestPrefersXRealIP(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFromRequestUsesXForwardedHostWhenRealIPMissing(t *testing.T) {
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
req.RemoteAddr = "10.0.0.10:5555"
|
||||
req.Header.Set("X-Forwarded-Host", "203.0.113.22")
|
||||
|
||||
if got := FromRequest(req); got != "203.0.113.22" {
|
||||
t.Fatalf("FromRequest() = %q, want %q", got, "203.0.113.22")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFromRequestUsesXForwardedForFirstValue(t *testing.T) {
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
req.RemoteAddr = "10.0.0.10:5555"
|
||||
|
||||
Reference in New Issue
Block a user