-
Notifications
You must be signed in to change notification settings - Fork 777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚀 feat: implement logs streaming for pods #568
🚀 feat: implement logs streaming for pods #568
Conversation
# Conflicts: # cyclops-ui/src/components/k8s-resources/Deployment.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naineel1209 thanks for the PR! Looks awesome 🧡
Left some comments on code structure
cyclops-ui/src/components/k8s-resources/common/PodTable/PodLogs.tsx
Outdated
Show resolved
Hide resolved
…eel1209/cyclops into feat/log-streaming-for-pods
…eel1209/cyclops into feat/log-streaming-for-pods
…eel1209/cyclops into feat/log-streaming-for-pods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naineel1209, I tried testing it and noticed that when I fetch the logs, those are streamed as expected, but when the window with my Cyclops is not in focus or I change the tab in my browser, it stops the connection and refetches all the logs again. This results in duplicated logs.
Could Abort controller be at fault? To be honest if its the root cause we can remove it, but could you look into it?
- set the flag `openWhenHidden` to true in `fetchEventSource`
Hi @petar-cvit, I examined the issue, and it was happening due to the default behaviour of the I have resolved this issue by setting the |
@naineel1209, that makes sense. This didn't happen when getting updates for workloads getting a new update would not affect data. However, if the sse gets disconnected for some other reason (e.g. load balancer having a timeout of one minute) it will still refetch all the logs and append them. Can you handle the case when see reconnects? We should still keep the |
- added `isReset` flag to reset the error modal and logs on every successful connection and future reconnections
@petar-cvit, I reviewed the disconnection issue that leads to duplicate logs upon reconnection and an unresolved error modal, even after a successful reconnection. To tackle this, I introduced an |
Hi @petar-cvit, any updates on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @naineel1209! I removed the abort controller state since it wasn't used.
Also, we need to cover the case when streaming is disabled, but I will do it in a separate PR
closes #555
📑 Description
[BE]
[FE]
logs
state to store array of strings to easily manage logs by usinglogs.join("\n")
.logStream
function which streams the logs and sets it in the state.logsSignalController
state to be passed to thelogStream
function to handle the SSE connection scenarios i.e. close the connection via signal when modal is closed, close the current connection via signal and make a new signal for the new connection when the container tab is changed.Streamed Logs Demo + No more events fired after the modal is closed:
https://github.com/user-attachments/assets/1f3f5fdf-102d-4697-9188-002092279098
✅ Checks
ℹ Additional context