-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
bfetch #52888
bfetch #52888
Conversation
Pinging @elastic/kibana-app-arch (Team:AppArch) |
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.
Everything looks pretty good to me. Switching to rxjs instead of some random, ad-hoc thing is definitely an improvement. I'm a bit concerned about the way errors are swallowed on the server here, though.
src/plugins/bfetch/server/streaming/create_streaming_response_stream.ts
Outdated
Show resolved
Hide resolved
src/plugins/bfetch/server/streaming/create_streaming_response_stream.ts
Outdated
Show resolved
Hide resolved
src/plugins/bfetch/server/streaming/create_streaming_response_stream.ts
Outdated
Show resolved
Hide resolved
src/legacy/core_plugins/interpreter/public/canvas/load_legacy_server_function_wrappers.ts
Show resolved
Hide resolved
src/plugins/bfetch/server/streaming/create_streaming_response_stream.ts
Outdated
Show resolved
Hide resolved
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. w/ tweaks (logging should use the Kibana logger vs console)
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.
@chrisdavies I've changed it to use Kibana logger.
With regards to errors, we agreed with @chrisdavies that those are lowest level protocol errors and there is no benefit to streaming them back. Instead a higher level abstraction will implement its own application errors that will indeed be streamed back.
@lizozom I'm not sure what you mean, what are you proposing to retry?
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.
My only main concern here is using the export *
in our public/index
and server/index
files -- we are already exporting internal things here, and this is a brand new plugin. Having just started the process of cleaning these up in the data plugin, I can testify that it is incredibly time consuming to retroactively go back and figure out what pieces of a plugin are truly public. So I think we should be explicit from the start on this one so we don't create more work for ourselves later.
One broader question I'm interested in: In the original POC, this was introduced as part of the data plugin. What was the motivation for changing the approach to making this a standalone plugin? Are there technical or design reasons why this is necessary?
It feels like a relatively small domain to justify its own plugin, but I'm sure there are pros and cons which we could discuss further.
@lukeelmers with regards |
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 making those export changes! Rest of the code LGTM.
If it was part of data plugin, we would have a circular dependency between data plugin and expressions plugin.
IMO this is good enough reason to keep bfetch
separate for now.
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* feat: 🎸 add bfetch plugin stub * feat: 🎸 add sample routes * feat: 🎸 implement streaming response * feat: 🎸 add Defer class * refactor: 💡 move Defer inot /common folder * feat: 🎸 add fromStreamingXhr() method * feat: 🎸 add split method * feat: 🎸 add fetchStreaming() function * test: 💍 fix test after refactor * test: 💍 add tests for fetStreaming() method * refactor: 💡 move removeLeadingSlash() to /common folder * feat: 🎸 expor stateful fetchStreaming() throuh plugin contract * chore: 🤖 clean up bfetch * chore: 🤖 prepare to replace ajax_stream by bfetch * Change ajax_stream to use new-line delimited JSON * refactor: 💡 move batched_fetch to use bfetch service * refactor: 💡 make use of defer() utility from kibana_utils * chore: 🤖 remove ajax_stream library * fix: 🐛 fix tests and inject fetchStreaming() method as dep * refactor: 💡 make split() operator more readable * refactor: 💡 improvee PR according to feedback * docs: ✏️ add fetchStreaming() reference * refactor: 💡 use NP logger, rename to createNDJSONStream() * chore: 🤖 adress Luke's review comments * chore: 🤖 add missing type
Summary
ajax_stream
to the New Platformbfetch
plugin to host all batching and streaming servicesbfetch
for response streamingbfetch.addStreamingResponseRoute()
on the server side, which will be used in the future for implementing batch request processing on the server.batched_fetch
will be moved to NP and integreated intobfetch
plugin such that any plugin can create a batching endpoint.Partially adresses: #44393
Part of: #46909
Checklist
[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
Dev Docs
ajax_stream
has been ported to the New Platform. UsefetchStreaming()
method ofbfetch
plugin instead.