Commit 884f6c6
authored
* Stream logs by default (#857)
Log viewers now start streaming on mount instead of requiring a click on
the Stream button — matching k9s, Lens, ArgoCD, and Rancher, which all
follow logs by default. Terminated pods (Succeeded/Failed) still load a
static snapshot rather than auto-streaming, since there's nothing to follow.
- New optional `autoStream` prop on LogsViewer / WorkloadLogsViewer
(default false, so library consumers are unaffected). Radar's wrappers
opt in: workload aggregate and dock pod logs default on; single-pod logs
gate on phase.
- Auto-start is keyed per-container and respects a manual Stop (won't
re-arm), and the redundant snapshot fetch is skipped while auto-streaming.
- Clear the buffer when a stream starts so the replayed tail (TailLines +
Follow) no longer duplicates the snapshot — a pre-existing bug on the
manual Stream button too.
- Add `s` to toggle streaming (k9s parity), ignored while typing in a
field, with a hint in the shortcut bar.
* Address review: multi-pod phase gating, stream-error settle, select key guard
- MultiPodLogsTab (Job/CronJob children) now gates autoStream on the
selected pod's phase, so completed pods show a static snapshot instead
of opening a follow stream. Waits for the pod to load before deciding.
- useLogStream exposes streamError; the viewers settle the "connecting"
state on a failed SSE connection (and surface the error when no logs
arrived) instead of spinning forever.
- The 's' stream shortcut now also ignores SELECT elements, so type-to-
select on the container/range dropdowns isn't hijacked.
* Don't report a clean stream end as a connection error
EventSource fires a generic 'error' on the normal close that follows the
server's 'end', so a live stream ending while watched could surface a false
"connection failed" and the connecting spinner could re-appear after a clean
end with no logs. Track end-vs-error with endedRef, and replace the ad-hoc
connecting predicate with a `connecting` signal from useLogStream that is
bounded to the actual connection attempt (set on start, cleared on the first
connected/log/end/error/stop) so it can't re-spin.
* Fix auto-stream lifecycle: container switch after stop, terminal transition
- When the user has Stopped, a container switch now reloads the snapshot
instead of leaving the previous container's lines under the new selection
(the snapshot fetch was skipped whenever willAutoStream was true).
- When autoStream turns off while a stream is open (pod went terminal), stop
following so live appends don't race the snapshot fetch.
- Don't log/surface the EventSource 'error' that fires on the normal close
after a clean 'end'.
* Ignore stale EventSource events; disable snapshot controls while streaming
- useLogStream guards every listener with an isCurrent() check, so a late
async event from a superseded source (after Stop, container switch, or
restart) can't corrupt the new stream's state or surface a false
"connection failed".
- Previous and the log-range select are disabled while streaming — they're
snapshot-only controls that otherwise appeared to do nothing under the
auto-stream default. Stop to adjust them.
* Gate single-pod auto-stream on known phase; survive Strict Mode
- PodLogsTab now waits for the pod phase to be known (!!phase) before
auto-streaming, matching MultiPodLogsTab — a completed pod is no longer
briefly followed while its resource is still loading.
- The auto-start effect resets its per-container arm latch on teardown, so
React Strict Mode's mount→unmount→mount (dev) re-opens the stream instead
of leaving the viewer static after the cleanup closes the EventSource.
1 parent ac30ef4 commit 884f6c6
8 files changed
Lines changed: 209 additions & 27 deletions
File tree
- packages/k8s-ui/src/components/logs
- web/src/components
- logs
- workload
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
278 | 280 | | |
279 | 281 | | |
280 | 282 | | |
281 | 283 | | |
282 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
283 | 293 | | |
284 | 294 | | |
285 | 295 | | |
286 | 296 | | |
287 | | - | |
| 297 | + | |
288 | 298 | | |
289 | 299 | | |
290 | 300 | | |
| |||
846 | 856 | | |
847 | 857 | | |
848 | 858 | | |
| 859 | + | |
849 | 860 | | |
850 | 861 | | |
851 | 862 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | | - | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
66 | | - | |
| 69 | + | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
| |||
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| |||
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
54 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
55 | 69 | | |
56 | 70 | | |
57 | 71 | | |
| |||
72 | 86 | | |
73 | 87 | | |
74 | 88 | | |
75 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
76 | 97 | | |
77 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
78 | 107 | | |
79 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
80 | 113 | | |
81 | 114 | | |
82 | 115 | | |
| |||
86 | 119 | | |
87 | 120 | | |
88 | 121 | | |
| 122 | + | |
89 | 123 | | |
90 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
91 | 142 | | |
92 | 143 | | |
93 | 144 | | |
| |||
122 | 173 | | |
123 | 174 | | |
124 | 175 | | |
125 | | - | |
126 | | - | |
| 176 | + | |
| 177 | + | |
127 | 178 | | |
128 | 179 | | |
129 | 180 | | |
130 | 181 | | |
| 182 | + | |
131 | 183 | | |
132 | 184 | | |
133 | 185 | | |
134 | 186 | | |
135 | 187 | | |
136 | 188 | | |
137 | | - | |
| 189 | + | |
138 | 190 | | |
139 | 191 | | |
140 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
141 | 197 | | |
142 | 198 | | |
143 | 199 | | |
144 | | - | |
145 | | - | |
| 200 | + | |
| 201 | + | |
146 | 202 | | |
147 | 203 | | |
148 | | - | |
| 204 | + | |
149 | 205 | | |
150 | 206 | | |
151 | 207 | | |
| |||
Lines changed: 60 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | | - | |
| 58 | + | |
53 | 59 | | |
54 | 60 | | |
55 | 61 | | |
| |||
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
64 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
65 | 76 | | |
66 | 77 | | |
67 | 78 | | |
| |||
105 | 116 | | |
106 | 117 | | |
107 | 118 | | |
108 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
109 | 127 | | |
110 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
111 | 137 | | |
112 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
113 | 143 | | |
114 | 144 | | |
115 | 145 | | |
| |||
156 | 186 | | |
157 | 187 | | |
158 | 188 | | |
159 | | - | |
| 189 | + | |
160 | 190 | | |
161 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
162 | 209 | | |
163 | 210 | | |
164 | 211 | | |
| |||
280 | 327 | | |
281 | 328 | | |
282 | 329 | | |
| 330 | + | |
283 | 331 | | |
284 | 332 | | |
285 | 333 | | |
286 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
287 | 339 | | |
288 | 340 | | |
289 | 341 | | |
290 | | - | |
| 342 | + | |
291 | 343 | | |
292 | 344 | | |
293 | | - | |
| 345 | + | |
294 | 346 | | |
295 | 347 | | |
296 | 348 | | |
297 | 349 | | |
298 | 350 | | |
299 | 351 | | |
300 | | - | |
| 352 | + | |
301 | 353 | | |
302 | 354 | | |
303 | 355 | | |
| |||
0 commit comments