Conversation
Adds a "Logs" action to the workload context menu for Deployments, DaemonSets, StatefulSets, ReplicaSets, and Jobs that opens a single dock tab merging the logs of every child pod, chronologically interleaved and tagged with a per-pod color so lines from different pods are distinguishable at a glance. Single-pod tabs are unaffected. Coloring covers the full log line (tag and message), not just the pod-name tag, so it stays legible whether or not "Show timestamps" is on. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Hi @krishantt! Thank you very much for this PR, and sorry for the long silence on it! Combined logs for workloads are one of the most requested features here (#687 and #1460), so we are really glad you took it on. A note on the red checks: the workflows never actually ran, GitHub did not start them for fork PRs that weekend. I ran the same checks locally on top of the current main (install, DI registration, type check, the logs and kube-object store unit tests, biome) and everything is green. I am closing and reopening the PR right after this comment only to retrigger the real CI, nothing else. I went through the code and I have a few points before the review from the core team:
The public Do you have time to look at these? If you prefer, we can also push the fixes on your branch ourselves, keeping your authorship of course. Thanks again! |
|
Hi @krishantt, a quick follow-up with some numbers, since I spent the afternoon with your branch on a 3-node kind cluster (current main plus your commit, unpackaged build, driven with Playwright). The good part first: the combined tab works as described on Deployments, DaemonSets, StatefulSets and Jobs, the container switch applies to all pods, and a single-pod workload behaves exactly as before. Nice work! What I measured on the points from my previous comment:
Two things I want to be clear are not yours: "Download > All logs" does nothing in production builds of the current main, single-pod tabs included, because the dropdown wraps the call in Thanks again! |
Fixes #687.
Adds a "Logs" action to the workload context menu for Deployments,
DaemonSets, StatefulSets, ReplicaSets, and Jobs that opens a single
dock tab merging the logs of every child pod. Lines from all pods are
interleaved chronologically (by the leading RFC3339 timestamp the
Kubernetes API attaches to each line) and tagged with a per-pod color
so it's easy to tell which pod a given line came from at a glance, per
@MatiasRoje's suggestion on #687 ("Probably in different colors
depending on the pod"). Single-pod log tabs are unchanged.
This covers the same need as the now-unmaintained
freelens-multi-pod-logs
extension referenced in #687, brought into core per the option
@robertobandini and @MatiasRoje favored in that thread. It doesn't
touch the separate, larger logs-rendering rework (virtual list -> xterm,
selection-during-scroll) raised in #1170 and referenced from #687 --
that's scoped as its own follow-up.
merge-pod-logs.ts: k-way merge across each pod's log lines, with adeterministic per-pod ANSI color assigned by hashing the pod name.
The whole tagged line (pod-name tag and message) is colored, not
just the tag, so lines stay legible whether or not "Show timestamps"
is on.
store.ts: fetches each pod's logs in parallel (Promise.allSettled)and only blanks the tab if every pod's fetch fails, so one pod being
briefly unreachable doesn't wipe out logs still streaming from the
rest of a combined tab.
resource-selector.tsx: combined tabs show a "N pods" badge (with atooltip listing pod names) instead of the single-pod switcher.
logs-view-model.ts/download-all-logs-for-pods.injectable.ts:downloading a combined tab's logs is named after the owning
workload rather than any single pod.
Manually verified against a 3-replica Deployment on a local cluster,
including with "Show timestamps" toggled on.
| Model:
claude-sonnet-5