Logs
Patchsets
Range Diff ↕
1: 55cba32 = 1: 55cba32 chore(analytics): send content-type to `metric-drain`
-: ------- > 2: 334a6dc chore: check for resp
Range Diff ↕
1: 55cba32 < -: ------- chore(analytics): send content-type to `metric-drain`
2: 334a6dc < -: ------- chore: check for resp
-: ------- > 1:
Range Diff ↕
1: ! 1: ea8a742 chore(analytics): send content-type to `metric-drain`
Patchset ps-82
chore(analytics): send content-type to `metric-drain`
Eric Bower
httpmuxer/httpmuxer.go
+9
-8
utils/state.go
+9
-8
chore: check for resp
Eric Bower
httpmuxer/httpmuxer.go
+12
-9
chore(analytics): send content-type to `metric-drain`
httpmuxer/httpmuxer.go
link
+9
-8
+9
-8
1diff --git a/httpmuxer/httpmuxer.go b/httpmuxer/httpmuxer.go
2index ef3ece3..37e20cf 100644
3--- a/httpmuxer/httpmuxer.go
4+++ b/httpmuxer/httpmuxer.go
5@@ -129,14 +129,15 @@ func Start(state *utils.State) {
6 slog.Info(logLine, "user", user, "userId", userId)
7
8 visit := &utils.MetricDrainVisit{
9- Namespace: "tuns",
10- UserID: userId,
11- Host: param.Request.Host,
12- IpAddress: param.ClientIP,
13- Status: param.StatusCode,
14- Path: originalURI,
15- UserAgent: param.Request.UserAgent(),
16- Referer: param.Request.Referer(),
17+ Namespace: "tuns",
18+ UserID: userId,
19+ Host: param.Request.Host,
20+ IpAddress: param.ClientIP,
21+ Status: param.StatusCode,
22+ Path: originalURI,
23+ UserAgent: param.Request.UserAgent(),
24+ Referer: param.Request.Referer(),
25+ ContentType: param.Request.Response.Header.Get("Content-Type"),
26 }
27
28 select {
utils/state.go
link
+9
-8
+9
-8
1diff --git a/utils/state.go b/utils/state.go
2index 44ca24f..ec99ef6 100644
3--- a/utils/state.go
4+++ b/utils/state.go
5@@ -218,14 +218,15 @@ type Ports struct {
6
7 // MetricDrainVisit represents a visit for the metric drain.
8 type MetricDrainVisit struct {
9- Namespace string `json:"namespace"`
10- UserID string `json:"user_id"`
11- Host string `json:"host"`
12- Path string `json:"path"`
13- IpAddress string `json:"ip_address"`
14- UserAgent string `json:"user_agent"`
15- Referer string `json:"referer"`
16- Status int `json:"status"`
17+ Namespace string `json:"namespace"`
18+ UserID string `json:"user_id"`
19+ Host string `json:"host"`
20+ Path string `json:"path"`
21+ IpAddress string `json:"ip_address"`
22+ UserAgent string `json:"user_agent"`
23+ Referer string `json:"referer"`
24+ Status int `json:"status"`
25+ ContentType string `json:"content_type"`
26 }
27
28 // State handles overall state. It retains mutexed maps for various
chore: check for resp
httpmuxer/httpmuxer.go
link
+12
-9
+12
-9
1diff --git a/httpmuxer/httpmuxer.go b/httpmuxer/httpmuxer.go
2index 37e20cf..28d3d66 100644
3--- a/httpmuxer/httpmuxer.go
4+++ b/httpmuxer/httpmuxer.go
5@@ -129,15 +129,18 @@ func Start(state *utils.State) {
6 slog.Info(logLine, "user", user, "userId", userId)
7
8 visit := &utils.MetricDrainVisit{
9- Namespace: "tuns",
10- UserID: userId,
11- Host: param.Request.Host,
12- IpAddress: param.ClientIP,
13- Status: param.StatusCode,
14- Path: originalURI,
15- UserAgent: param.Request.UserAgent(),
16- Referer: param.Request.Referer(),
17- ContentType: param.Request.Response.Header.Get("Content-Type"),
18+ Namespace: "tuns",
19+ UserID: userId,
20+ Host: param.Request.Host,
21+ IpAddress: param.ClientIP,
22+ Status: param.StatusCode,
23+ Path: originalURI,
24+ UserAgent: param.Request.UserAgent(),
25+ Referer: param.Request.Referer(),
26+ }
27+
28+ if param.Request.Response != nil {
29+ visit.ContentType = param.Request.Response.Header.Get("Content-Type")
30 }
31
32 select {