Skip to content
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

[Security Solution] Refactor resolver children _source #77343

Merged

Conversation

jonathan-buttner
Copy link
Contributor

@jonathan-buttner jonathan-buttner commented Sep 14, 2020

This PR refactors a portion of the children functionality to reduce the _source fields used when querying the document. Only a portion of the fields are needed for an intermediate step while finding the children nodes of a process. To accomplish this, a number of the model function's parameters were changed to only take the necessary fields for a single function.

@jonathan-buttner jonathan-buttner added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Endpoint Data Visibility Team managing the endpoint resolver Feature:Resolver Security Solution Resolver feature v7.10.0 labels Sep 14, 2020
@jonathan-buttner jonathan-buttner marked this pull request as ready for review September 14, 2020 13:39
@jonathan-buttner jonathan-buttner requested review from a team as code owners September 14, 2020 13:39
@elasticmachine
Copy link
Contributor

Pinging @elastic/endpoint-app-team (Feature:Resolver)

@elasticmachine
Copy link
Contributor

Pinging @elastic/endpoint-data-visibility-team (Team:Endpoint Data Visibility)

@oatkiller
Copy link
Contributor

@jonathan-buttner AFAIK the children API is unused. What is the motivation for this PR?

@jonathan-buttner
Copy link
Contributor Author

jonathan-buttner commented Sep 14, 2020

@jonathan-buttner AFAIK the children API is unused. What is the motivation for this PR?

@oatkiller sorry "children API" is misleading, I meant it in a general sense. The tree api uses the same code paths as the children api to retrieve the descendants of a node. So these changes affect the tree api as well which is used by the UI to retrieve the tree. I'll update the description.

}>;
}
| {
event: Partial<{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ What does this second part of the union do? Doesn't the first part being marked 'partial' make this redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first Partial marks the fields like endgame and event as optional but not the fields inside those fields (it's not recursive). This line marks type as optional and any future fields added to event.

*/
type TimestampFields = Pick<SafeResolverEvent, '@timestamp'>;

export function timestampSafeVersion(event: TimestampFields): undefined | number {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 doc comments on exports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment

*/
type GetAncestryArrayFields = AncestryArrayFields & ParentEntityIDFields;

export function getAncestryAsArray(event: GetAncestryArrayFields | undefined): string[] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 doc comments on exports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

async chunks size

id value diff baseline
securitySolution 10.1MB +376.0B 10.1MB

History

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

@jonathan-buttner jonathan-buttner merged commit 17fec25 into elastic:master Sep 16, 2020
@jonathan-buttner jonathan-buttner deleted the refactor-children-source branch September 16, 2020 19:28
jonathan-buttner added a commit to jonathan-buttner/kibana that referenced this pull request Sep 16, 2020
* Moving generator to safe type version

* Finished generator and alert

* Gzipping again

* Finishing type conversions for backend

* Trying to cast front end tests back to unsafe type for now

* Working reducer tests

* Adding more comments and fixing alert type

* Restoring resolver test data

* Updating snapshot with timestamp info

* Getting the models figured out

* Event models type fixes

* Adding more comments

* Fixing more comments

* Adding comments
jonathan-buttner added a commit that referenced this pull request Sep 17, 2020
* Moving generator to safe type version

* Finished generator and alert

* Gzipping again

* Finishing type conversions for backend

* Trying to cast front end tests back to unsafe type for now

* Working reducer tests

* Adding more comments and fixing alert type

* Restoring resolver test data

* Updating snapshot with timestamp info

* Getting the models figured out

* Event models type fixes

* Adding more comments

* Fixing more comments

* Adding comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Resolver Security Solution Resolver feature release_note:skip Skip the PR/issue when compiling release notes Team:Endpoint Data Visibility Team managing the endpoint resolver v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants