Range-diff rd-83
- title
- chore(analytics): send content-type to `metric-drain`
- description
-
Patch removed - old #1
55cba32- new #0
(none)
- title
- chore: check for resp
- description
-
Patch removed - old #2
334a6dc- new #0
(none)
1: 55cba32 < -: ------- chore(analytics): send content-type to `metric-drain`
old
old:
httpmuxer/httpmuxer.go
new:httpmuxer/httpmuxer.go
slog.Info(logLine, "user", user, "userId", userId) visit := &utils.MetricDrainVisit{ - Namespace: "tuns", - UserID: userId, - Host: param.Request.Host, - IpAddress: param.ClientIP, - Status: param.StatusCode, - Path: originalURI, - UserAgent: param.Request.UserAgent(), - Referer: param.Request.Referer(), + Namespace: "tuns", + UserID: userId, + Host: param.Request.Host, + IpAddress: param.ClientIP, + Status: param.StatusCode, + Path: originalURI, + UserAgent: param.Request.UserAgent(), + Referer: param.Request.Referer(), + ContentType: param.Request.Response.Header.Get("Content-Type"), } select {
new
old
old:
utils/state.go
new:utils/state.go
// MetricDrainVisit represents a visit for the metric drain. type MetricDrainVisit struct { - Namespace string `json:"namespace"` - UserID string `json:"user_id"` - Host string `json:"host"` - Path string `json:"path"` - IpAddress string `json:"ip_address"` - UserAgent string `json:"user_agent"` - Referer string `json:"referer"` - Status int `json:"status"` + Namespace string `json:"namespace"` + UserID string `json:"user_id"` + Host string `json:"host"` + Path string `json:"path"` + IpAddress string `json:"ip_address"` + UserAgent string `json:"user_agent"` + Referer string `json:"referer"` + Status int `json:"status"` + ContentType string `json:"content_type"` } // State handles overall state. It retains mutexed maps for various
new
-: ------- > 1:
2: 334a6dc < -: ------- chore: check for resp
old
old:
httpmuxer/httpmuxer.go
new:httpmuxer/httpmuxer.go
slog.Info(logLine, "user", user, "userId", userId) visit := &utils.MetricDrainVisit{ - Namespace: "tuns", - UserID: userId, - Host: param.Request.Host, - IpAddress: param.ClientIP, - Status: param.StatusCode, - Path: originalURI, - UserAgent: param.Request.UserAgent(), - Referer: param.Request.Referer(), - ContentType: param.Request.Response.Header.Get("Content-Type"), + Namespace: "tuns", + UserID: userId, + Host: param.Request.Host, + IpAddress: param.ClientIP, + Status: param.StatusCode, + Path: originalURI, + UserAgent: param.Request.UserAgent(), + Referer: param.Request.Referer(), + } + + if param.Request.Response != nil { + visit.ContentType = param.Request.Response.Header.Get("Content-Type") } select {