-
-
Notifications
You must be signed in to change notification settings - Fork 326
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
Change Api::log_stream
to return AsyncBufRead
#1235
Conversation
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.
this looks sensible to me at a quick look. thanks for tackling this.
some quick comments.
0281b8f
to
32ae94f
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1235 +/- ##
=======================================
Coverage 71.93% 71.93%
=======================================
Files 71 71
Lines 5725 5727 +2
=======================================
+ Hits 4118 4120 +2
Misses 1607 1607
|
I think this is one of those cases that makes sense and we should make it easy.. but we shouldn't make it required. If you're writing a It would probably be possible to have a |
This comment was marked as outdated.
This comment was marked as outdated.
Is it not possible to expose a |
I think that would be ideal, yes. |
request_text_stream
to return a stream of log lineslog_stream
to return an async buf reader
changed the implementation to return an |
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.
Even if I think these are good changes, it's now a breaking change. @clux
don't know why clippy is complaining, these changes don't touch any of the reported code blocks. |
Unlucky timing, nightly must have added more lints, see #1238 I'll try to get them fixed separately, you can just ignore them here |
57ede7a
to
a84f9f8
Compare
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.
LGTM now. Have left a minor doc suggestion, and leaving open for David.
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.
I like the changes, I had some ideas for the docs, let me know what you think.
Also I think we should rename request_text_stream
since we're already breaking the API.
Modify `kube_client::api::subresource::Api::log_stream()` to return an async buf reader (`futures::io::AsyncBufRead`) that can read logs asynchronously. Users can call call `.lines()` on it to get a newline buffered stream of logs using `futures::io::AsyncBufReadExt`. Signed-off-by: Sanskar Jaiswal <[email protected]>
log_stream
to return an async buf readerApi::log_stream
to return AsyncBufRead
Motivation
The current log_stream implementation returns a stream of bytes that aren't newline buffered. This can cause a visual mess, when for example, there are multiple log lines in one chunk of the stream.
Solution
Modify
kube_client::api::subresource::Api::log_stream()
to return an async buf reader (futures::io::AsyncBufRead
) that can read logs asynchronously. Users can call call.lines()
on it to get a newline buffered stream of logs.Fixes #1160