pico

created pr with 103.1 on 2026-01-05T14:52:02Z · by c8ef7d19
added 103.2 on 2026-01-08T01:19:34Z · by c8ef7d19
1: 66cf9b9 = 1: 66cf9b9 feat(pipe): add pipe_monitors table
2: 83b0c70 = 2: 83b0c70 chore(pipe): add new db methods
3: 43aa4a1 = 3: 43aa4a1 chore(pipe): add db impl
4: a75186b = 4: a75186b chore(pipe): add tests for monitoring
5: 9c7fcda = 5: 9c7fcda feat(pipe): add monitor cli
6: 2b86dec = 6: 2b86dec feat(pipe): status and rss commands
7: 8df2aa2 = 7: 8df2aa2 feat(pipe): monitor pub and pipe cmd
8: 11a5bce = 8: 11a5bce chore(pipe): monitor help text
9: 670350c = 9: 670350c refactor(pipe): monitor pipes on throttle interval
10: ade2b83 = 10: ade2b83 fix: window and ping fixes
11: 68f5cd1 = 11: 68f5cd1 chore(pipe): add tests
-: ------- > 12: 74fb40f chore(pipe): add logging stmts
-: ------- > 13: c422818 refactor(pipe): create pipe monitors history table
-: ------- > 14: e0c3a88 fix(pipe): only update monitor if within window
-: ------- > 15: 9a8fbde chore(pipe): implement monitor history db interface
-: ------- > 16: f168507 feat(pipe): record historical monitors
-: ------- > 17: 16df77f feat(pipe): monitor calculate uptime
-: ------- > 18: 10ffdf1 feat(pipe): uptime cli command
-: ------- > 19: 8231ac5 chore(pipe): monitor history stubs
-: ------- > 20: 65a63a9 fix(pipe): uptime cmd
added 103.3 on 2026-02-01T17:16:24Z · by c8ef7d19
3: 43aa4a1 ! 1: 603ca6e chore(pubsub): add more tests
1: 66cf9b9 < -: ------- feat(pipe): add pipe_monitors table
2: 83b0c70 < -: ------- chore(pipe): add new db methods
4: a75186b ! 2: 17e00b2 feat(pubsub): round robin
13: c422818 ! 3: e3136bd fix(pubsub): check for eof before processing and skip empty byte reads
-: ------- > 4: 9a6d19e fix: rr
5: 9c7fcda < -: ------- feat(pipe): add monitor cli
16: f168507 ! 5: 5b3f3a1 fix: sending 0 byte read
6: 2b86dec < -: ------- feat(pipe): status and rss commands
11: 68f5cd1 ! 6: 4fff471 refactor: fixes
7: 8df2aa2 < -: ------- feat(pipe): monitor pub and pipe cmd
14: e0c3a88 ! 7: d0dfc85 chore: SetDispatch on Broker
8: 11a5bce < -: ------- chore(pipe): monitor help text
9: 670350c < -: ------- refactor(pipe): monitor pipes on throttle interval
10: ade2b83 < -: ------- fix: window and ping fixes
12: 74fb40f < -: ------- chore(pipe): add logging stmts
15: 9a8fbde < -: ------- chore(pipe): implement monitor history db interface
17: 16df77f < -: ------- feat(pipe): monitor calculate uptime
18: 10ffdf1 < -: ------- feat(pipe): uptime cli command
19: 8231ac5 < -: ------- chore(pipe): monitor history stubs
20: 65a63a9 < -: ------- fix(pipe): uptime cmd
cmds
checkout latest patchset:
ssh pr.pico.sh print 103 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 103.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 103

Patchset 103.2 on 2026-01-08T01:19:34Z · commit 74fb40f

+20 -2 pkg/apps/pipe/cli.go #
......@@ -72,24 +72,28 @@ func Middleware(handler *CliHandler) pssh.SSHServerMiddleware {
7272 case "ls":
7373 err := handler.ls(cliCmd)
7474 if err != nil {
75+ logger.Error("ls cmd", "err", err)
7576 sesh.Fatal(err)
7677 }
7778 return next(sesh)
7879 case "monitor":
7980 err := handler.monitor(cliCmd, user)
8081 if err != nil {
82+ logger.Error("monitor cmd", "err", err)
8183 sesh.Fatal(err)
8284 }
8385 return next(sesh)
8486 case "status":
8587 err := handler.status(cliCmd, user)
8688 if err != nil {
89+ logger.Error("status cmd", "err", err)
8790 sesh.Fatal(err)
8891 }
8992 return next(sesh)
9093 case "rss":
9194 err := handler.rss(cliCmd, user)
9295 if err != nil {
96+ logger.Error("rss cmd", "err", err)
9397 sesh.Fatal(err)
9498 }
9599 return next(sesh)
......@@ -144,16 +148,19 @@ func Middleware(handler *CliHandler) pssh.SSHServerMiddleware {
144148 case "pub":
145149 err := handler.pub(cliCmd, topic, clientID)
146150 if err != nil {
151+ logger.Error("pub cmd", "err", err)
147152 sesh.Fatal(err)
148153 }
149154 case "sub":
150155 err := handler.sub(cliCmd, topic, clientID)
151156 if err != nil {
157+ logger.Error("sub cmd", "err", err)
152158 sesh.Fatal(err)
153159 }
154160 case "pipe":
155161 err := handler.pipe(cliCmd, topic, clientID)
156162 if err != nil {
163+ logger.Error("pipe cmd", "err", err)
157164 sesh.Fatal(err)
158165 }
159166 }
......@@ -341,6 +348,7 @@ func (handler *CliHandler) monitor(cmd *CliCmd, user *db.User) error {
341348 resolvedTopic := result.Name
342349
343350 if *del {
351+ handler.Logger.Info("removing pipe monitor", "topic", resolvedTopic)
344352 err := handler.DBPool.RemovePipeMonitor(user.ID, resolvedTopic)
345353 if err != nil {
346354 return fmt.Errorf("failed to delete monitor: %w", err)
......@@ -368,6 +376,12 @@ func (handler *CliHandler) monitor(cmd *CliCmd, user *db.User) error {
368376 }
369377
370378 winEnd := time.Now().UTC().Add(dur)
379+ handler.Logger.Info(
380+ "upserting pipe monitor",
381+ "topic", resolvedTopic,
382+ "dur", dur,
383+ "window", winEnd.UTC().Format(time.RFC3339),
384+ )
371385 err = handler.DBPool.UpsertPipeMonitor(user.ID, resolvedTopic, dur, &winEnd)
372386 if err != nil {
373387 return fmt.Errorf("failed to create monitor: %w", err)
......@@ -405,12 +419,12 @@ func (handler *CliHandler) status(cmd *CliCmd, user *db.User) error {
405419
406420 lastPing := "never"
407421 if m.LastPing != nil {
408- lastPing = m.LastPing.UTC().Format("2006-01-02 15:04:05Z")
422+ lastPing = m.LastPing.UTC().Format(time.RFC3339)
409423 }
410424
411425 windowEnd := ""
412426 if m.WindowEnd != nil {
413- windowEnd = m.WindowEnd.UTC().Format("2006-01-02 15:04:05Z")
427+ windowEnd = m.WindowEnd.UTC().Format(time.RFC3339)
414428 }
415429
416430 _, _ = fmt.Fprintf(
......@@ -704,8 +718,10 @@ func (handler *CliHandler) updateMonitor(cmd *CliCmd, topic string) {
704718 return
705719 }
706720
721+ handler.Logger.Info("update monitor", "topic", topic)
707722 monitor, err := handler.DBPool.FindPipeMonitorByTopic(cmd.user.ID, topic)
708723 if err != nil || monitor == nil {
724+ handler.Logger.Info("no monitor found", "topic", topic)
709725 return
710726 }
711727
......@@ -713,12 +729,14 @@ func (handler *CliHandler) updateMonitor(cmd *CliCmd, topic string) {
713729 if err := handler.DBPool.UpdatePipeMonitorLastPing(cmd.user.ID, topic, &now); err != nil {
714730 handler.Logger.Error("failed to update monitor last_ping", "err", err, "topic", topic)
715731 }
732+ handler.Logger.Info("update monitor ping", "topic", topic)
716733
717734 // Always reset the window to now + duration on ping
718735 newWindowEnd := now.Add(monitor.WindowDur)
719736 if err := handler.DBPool.UpsertPipeMonitor(cmd.user.ID, topic, monitor.WindowDur, &newWindowEnd); err != nil {
720737 handler.Logger.Error("failed to reset monitor window", "err", err, "topic", topic)
721738 }
739+ handler.Logger.Info("updated monitor window", "topic", topic, "window", newWindowEnd.UTC().Format(time.RFC3339))
722740 }
723741
724742 const monitorThrottleInterval = 15 * time.Second
Back to top