mirror of
https://github.com/caddyserver/caddy.git
synced 2026-06-30 05:42:50 +00:00
telemetry: Make http_user_agent a normalized field
This way we store a short 8-byte hash of the UA instead of the full string; exactly the same way we store TLS ClientHello info.
This commit is contained in:
parent
df7cdc3fae
commit
9160789b42
4 changed files with 17 additions and 3 deletions
|
|
@ -354,7 +354,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
if len(ua) > 512 {
|
||||
ua = ua[:512]
|
||||
}
|
||||
go telemetry.AppendUnique("http_user_agent", ua)
|
||||
uaHash := telemetry.FastHash([]byte(ua)) // this is a normalized field
|
||||
go telemetry.SetNested("http_user_agent", uaHash, ua)
|
||||
go telemetry.AppendUnique("http_user_agent_count", uaHash)
|
||||
go telemetry.Increment("http_request_count")
|
||||
|
||||
// copy the original, unchanged URL into the context
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue