tuns

created pr with 34.1 on 2024-11-13T02:18:51Z · by c8ef7d19
added 34.2 on 2024-11-14T03:06:46Z · by c8ef7d19
1: 4bd8050 = 1: 4bd8050 feat: metric drain
-: ------- > 2: ea49338 chore: add userId to metric drain visit
added 34.3 on 2024-11-14T03:22:31Z · by c8ef7d19
1: 4bd8050 = 1: 4bd8050 feat: metric drain
2: ea49338 = 2: ea49338 chore: add userId to metric drain visit
-: ------- > 3: 343f29e chore: update pubsub
changed status to accepted on 2024-11-23T03:33:38Z · by c8ef7d19
cmds
checkout latest patchset:
ssh pr.pico.sh print 34 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 34.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 34
set PR to open (enables RSS notifications):
ssh pr.pico.sh pr open 34
set PR to draft (stops RSS notifications):
ssh pr.pico.sh pr draft 34

Patchset 34.2 on 2024-11-14T03:06:46Z · commit ea49338

chore: add userId to metric drain visit
Eric Bower 2024-11-14T03:05:56Z
chore: add user scope to http request log line
Semantic diff summary
0 added, 1 modified, 0 signature changed, 0 removed across 1 analyzed file
+24 -19 httpmuxer/httpmuxer.go #
......@@ -116,25 +116,30 @@ func Start(state *utils.State) {
116116 param.ErrorMessage,
117117 )
118118
119- visit := MetricDrainVisit{
120- UserID: "",
121- Host: param.Request.Host,
122- IpAddress: param.ClientIP,
123- Status: param.StatusCode,
124- Path: originalURI,
125- UserAgent: param.Request.UserAgent(),
126- Referer: param.Request.Referer(),
127- }
128- data, err := json.Marshal(visit)
129- if err != nil {
130- slog.Error("could not json marshall visit record", "err", err)
131- }
132- _, err = state.MetricDrain.Write(data)
133- if err != nil {
134- slog.Error("could not send to visit to metric-drain", "err", err)
135- }
136-
137- slog.Info(logLine)
119+ state.SSHConnections.Range(func(I string, conn *utils.SSHConnection) bool {
120+ user := conn.User()
121+ userId := conn.UserId()
122+ slog.Info(logLine, "user", user, "userId", userId)
123+
124+ visit := MetricDrainVisit{
125+ UserID: userId,
126+ Host: param.Request.Host,
127+ IpAddress: param.ClientIP,
128+ Status: param.StatusCode,
129+ Path: originalURI,
130+ UserAgent: param.Request.UserAgent(),
131+ Referer: param.Request.Referer(),
132+ }
133+ data, err := json.Marshal(visit)
134+ if err != nil {
135+ slog.Error("could not json marshall visit record", "err", err)
136+ }
137+ _, err = state.MetricDrain.Write(data)
138+ if err != nil {
139+ slog.Error("could not send to visit to metric-drain", "err", err)
140+ }
141+ return true
142+ })
138143
139144 if viper.GetBool("log-to-client") && param.Keys["httpHolder"] != nil {
140145 currentListener := param.Keys["httpHolder"].(*utils.HTTPHolder)
Back to top