[Sessions] Add meta.size to bfetched responses#95774
[Sessions] Add meta.size to bfetched responses#95774lizozom wants to merge 1 commit intoelastic:masterfrom
Conversation
|
Pinging @elastic/kibana-app-services (Team:AppServices) |
| items[response.id].future.reject(response.error); | ||
| } else if (response.result !== undefined) { | ||
| if (typeof response.result === 'object') { | ||
| response.result.meta = { |
There was a problem hiding this comment.
i don't really like it that we are adding things to actual response, i would preffer to se meta information separate from actual responses.
also, i think this information could be useful on the server as well, and i would really prefer to keep our server/client API as similar as possible.
There was a problem hiding this comment.
I'm worried that the responses now may contain this meta property which is not expected. And it is unfortunate to add the BatchResultBase interface, as Peter also mentioned.
Could you please make it such that the result data is not modified, i.e. with the extra meta property? One way that comes to mind could be to return the whole response, like so (instead of just response.result):
That way you can use response.json.length to get the size of the raw response. And response.result to get the response data as before.
|
@streamich yep, thanks! |
|
@elasticmachine merge upstream |
|
ignoring request to update branch, pull request is closed |

Summary
Since we want to avoid stringifying responses to calculate their size, after consulting with @ppisljar, I added a new
metasection to the response coming from anybfetchfunction.It will contain the response's size in bytes, so it can then be used anywhere it's needed.
Specifically, I intend to use it in #92439 for its cache eviction logic.
I split this out to a separate PR to simplify testing and reviewing.
Checklist
Delete any items that are not applicable to this PR.
For maintainers