Skip to content

[8.15] [Automatic Import] Adding support for larger samples in ECS graph (#190426)#191314

Merged
P1llus merged 2 commits intoelastic:8.15from
kibanamachine:backport/8.15/pr-190426
Aug 27, 2024
Merged

[8.15] [Automatic Import] Adding support for larger samples in ECS graph (#190426)#191314
P1llus merged 2 commits intoelastic:8.15from
kibanamachine:backport/8.15/pr-190426

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 8.15:

Questions ?

Please refer to the Backport tool documentation

…astic#190426)

## Summary

This PR prepares the ECS Mapping graph to support larger samples by
chunking and running certain parts of the graph concurrently side by
side and merging the results rather than trying to use one large
context.

More details below, but in general there is only a slight modification
to the actual code, most of the lines are related to moving code around
to new files and updated tests.

There are also some minor tweaks to the ECS graph code in general, below
is the related changes:

1. Moved some code out of graph.ts to make it a bit smaller (moved
model* functions to a new model.ts, moved state to its own file.
2. Added chunkSize as a optional input to the graph (default to 10
fields with an actual string value per chunk). Just to allow it to be
overwritten if necessary later.
3. Renamed the `samples` state to `prefixedSamples` and
`formattedSamples` to `combinedSamples` as it got really confusing at
some point when debugging. I also updated the function argument names
that used them to the new names to better understand which sample type
they are using.
4. Renamed `modifySamples` to `prefixSamples` to clarify what it
actually modifies
5. Moved `mapping`, `invalid`, `duplicate`, `missing` and `validate`
nodes to its own subgraph. The `combinedSamples` state is now set when
invoking the subgraph, the value will be its related `chunk`, so it only
needs to work on this smaller subset of data.
6. The `currentMapping` state is now only used by the sub graph, once
all the subgraphs has finished, the will post their own results to
`finalMapping` state. This state uses a reducer function, that combines
the existing state with the new, so all results from the X subgraphs
running will be merged into the same resulting object as before this PR.

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit 8e66a3e)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Aug 26, 2024
@kibanamachine kibanamachine enabled auto-merge (squash) August 26, 2024 20:06
@P1llus P1llus disabled auto-merge August 26, 2024 20:10
@P1llus
Copy link
Copy Markdown
Member

P1llus commented Aug 27, 2024

@elasticmachine merge upstream

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
integrationAssistant 3 4 +1

Total ESLint disabled count

id before after diff
integrationAssistant 10 11 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @P1llus

@P1llus P1llus merged commit 98eb41c into elastic:8.15 Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants