Skip to content

feat: implement endpoint to support fetching workspace pod log - #1267

Open
YoyinZyc wants to merge 3 commits into
kubeflow:notebooks-v2from
YoyinZyc:log_batch
Open

feat: implement endpoint to support fetching workspace pod log#1267
YoyinZyc wants to merge 3 commits into
kubeflow:notebooks-v2from
YoyinZyc:log_batch

Conversation

@YoyinZyc

@YoyinZyc YoyinZyc commented Jul 21, 2026

Copy link
Copy Markdown

Implement the batch log API proposed in #886 (comment)
closes: #887
related: #886

Behavior

A new one-shot endpoint returning a workspace pods container(including the initContainer like istio) logs as a plain text.

Query params: container(defaults to first/primary container); tail(default to 1000); previous (default to false); sinceTime(default to none)

API

GET /api/v1/workspaces/{namespace}/{name}/podtemplate/logs/batch
      ?container=<name>    # optional, defaults to the first (primary) container
      &tail=<int>          # optional, default 1000
      &previous=<bool>     # optional, default false (previous terminated instance)
      &sinceTime=<string> #optional, default to none

Response

2026-07-23T18:37:19.502427795Z 2026-07-23T18:37:19.502162Z	info	xdsproxy	connected to delta upstream XDS server: istiod.istio-system.svc:15012	id=96
2026-07-23T19:07:20.316168674Z 2026-07-23T19:07:20.315975Z	info	xdsproxy	connected to delta upstream XDS server: istiod.istio-system.svc:15012	id=97
2026-07-23T19:36:29.611434886Z 2026-07-23T19:36:29.611255Z	info	xdsproxy	connected to delta upstream XDS server: istiod.istio-system.svc:15012	id=98
2026-07-23T20:04:05.870345556Z 2026-07-23T20:04:05.870108Z	info	xdsproxy	connected to delta upstream XDS server: istiod.istio-system.svc:15012	id=99
2026-07-23T20:32:49.598960074Z 2026-07-23T20:32:49.598795Z	info	xdsproxy	connected to delta upstream XDS server: istiod.istio-system.svc:15012	id=100
2026-07-23T21:01:53.168136917Z 2026-07-23T21:01:53.167896Z	info	xdsproxy	connected to delta upstream XDS server: istiod.istio-sy

Unit tests

internal/repositories/logs/repo_test.go
workspace_logs_handler_test.go

Tested Manually

BASE_URL=https://localhost:8443/workspaces/api/v1/workspaces/default/jupyterlab-workspace/podtemplate/logs/batch

Positive

Path HTTP Code Result
empty 200 default the main container with tail set to 1000 and previous=false
tail=15 200 15 line of log
container=main 200 return log for main container
container=istio-proxy 200 return log for istio proxy
sinceTime=2026-07-23T18:30:00Z 200 return main log since that time
container=istio-proxy&sinceTime=2026-07-23T18:30:00Z 200 return istio proxy log since that time

Negative

Path HTTP Code Error Msg
previous=true(never restarted) 409 no logs found for the previous container instance
container= 400 container not found in pod
tail= / tail=0 / previous=maybe / sinceTime= 422 field validation error
non-existent workspace 404 workspace not found
non-running container(in waiting state) 409 container has not started yet (note: this one is hard to test manually, mostly rely on unit test)

@github-project-automation github-project-automation Bot moved this to Needs Triage in Kubeflow Notebooks Jul 21, 2026
@google-oss-prow google-oss-prow Bot added the area/backend area - related to backend components label Jul 21, 2026
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign andyatmiami for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow Bot added area/v2 area - version - kubeflow notebooks v2 size/XXL labels Jul 21, 2026
@YoyinZyc
YoyinZyc force-pushed the log_batch branch 2 times, most recently from f184804 to fcb68f7 Compare July 21, 2026 19:50
@christian-heusel

Copy link
Copy Markdown
Member

@YoyinZyc FYI I have added a compression middleware to the backend in parallel which should help quite a bit for the log endpoint 🤗 #1269

YoyinZyc added 2 commits July 25, 2026 00:02
… workspace pod log

Signed-off-by: Yuchen Zhou <yczhou@google.com>
… level unit tests

Signed-off-by: Yuchen Zhou <yczhou@google.com>
Signed-off-by: Yuchen Zhou <yczhou@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/backend area - related to backend components area/v2 area - version - kubeflow notebooks v2 size/XXL

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants