[EventLog] Added event log API to get events for multiple saved objects.#87596
[EventLog] Added event log API to get events for multiple saved objects.#87596YulNaumenko merged 12 commits intoelastic:masterfrom
Conversation
…ed to findEventsBySavedObjectIds
…for non existing id
pmuellr
left a comment
There was a problem hiding this comment.
This seems like it's headed in the right direction. We'll have more work to do to get to the point where we can use this to get all active instances - this isn't all of it. So I think the title should be changed to "Added event log API to get events for multiple saved objects".
| ? Promise.all( | ||
| objects.map(async (objectItem) => await (await client).get({ id: objectItem.id })) | ||
| ) | ||
| : new Promise(() => []); |
There was a problem hiding this comment.
| : new Promise(() => []); | |
| : Promise.resolve([]) |
I don't think the new Promise(() => []) is doing what we want - it seems to return a promise that never resolves, but I think we want a promise that resolves to an empty array instead.
Same pattern is in the alerts plugin ...
There was a problem hiding this comment.
Even better, current PR can close the opened issue #70856 and the alerting related work will be a separate PR
|
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
| const objects = ids.reduce( | ||
| (prev: Array<{ type: string; id: string }>, id) => [...prev, { type, id }], | ||
| [] | ||
| ); |
There was a problem hiding this comment.
nit: might be clearer to use a map instead of a reduce
const objects = ids.map((id: string) => ({ type, id }));
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
…ts. (elastic#87596) * Added alerting API to get all active instances * modofied event log findEventsBySavedObject to support bulk ids, renamed to findEventsBySavedObjectIds * fixed faling typechecks * fixed crash on zpd/api/event_log/alert/84c00970-5130-11eb-9fa7/_find for non existing id * fixed faling typechecks * fixed faling typechecks * fixed due to comments * fixed due to comments * fixed failing test * fixed due to comments
…ts. (#87596) (#88116) * Added alerting API to get all active instances * modofied event log findEventsBySavedObject to support bulk ids, renamed to findEventsBySavedObjectIds * fixed faling typechecks * fixed crash on zpd/api/event_log/alert/84c00970-5130-11eb-9fa7/_find for non existing id * fixed faling typechecks * fixed faling typechecks * fixed due to comments * fixed due to comments * fixed failing test * fixed due to comments
Added support for getting events by the object type and multiple ids: exposed by EventLogClient and find_by_ids REST API
Resolve #70856