-
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
Resolver refactoring #70312
Resolver refactoring #70312
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -301,3 +301,46 @@ export function databaseDocumentIDToAbort(state: DataState): string | null { | |
return null; | ||
} | ||
} | ||
|
||
/** | ||
* `ResolverNodeStats` for a process (`ResolverEvent`) | ||
*/ | ||
const relatedEventStatsForProcess: ( | ||
state: DataState | ||
) => (event: ResolverEvent) => ResolverNodeStats | null = createSelector( | ||
relatedEventsStats, | ||
(statsMap) => { | ||
if (!statsMap) { | ||
return () => null; | ||
} | ||
return (event: ResolverEvent) => { | ||
const nodeStats = statsMap.get(uniquePidForProcess(event)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just leaving the note here like we talked about before @oatkiller this function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll get something formally added to the team's backlog about this. |
||
if (!nodeStats) { | ||
return null; | ||
} | ||
return nodeStats; | ||
}; | ||
} | ||
); | ||
|
||
/** | ||
* The sum of all related event categories for a process. | ||
*/ | ||
export const relatedEventTotalForProcess: ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was the justification for this? I'd like to put it down in comments here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that I understand what this is doing I see that this number doesn't match the number of events. Is there any point in showing this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bkimmel you might want to comment here. There is a difference between total events and the total amount of all the categories added up which is what is happening here. It really depends on what we want to communicate to the user. If we communicate that there are 5 total related events, when they look at the break down the values won't always added up to 5 because a single event could fall into multiple categories. So it could be confusing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I'm not following is: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For a set of related events with the following ECS categories:
There are 2 choices then, for how to display the total: If I'm not mistaken, I believe it was you, Robert, who suggested that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /shrug |
||
state: DataState | ||
) => (event: ResolverEvent) => number | null = createSelector( | ||
relatedEventStatsForProcess, | ||
(statsForProcess) => { | ||
return (event: ResolverEvent) => { | ||
const stats = statsForProcess(event); | ||
if (!stats) { | ||
return null; | ||
} | ||
let total = 0; | ||
for (const value of Object.values(stats.events.byCategory)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
total += value; | ||
} | ||
return total; | ||
}; | ||
} | ||
); |
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.
The logic that used to populate this piece of state has been moved to the selector called
relatedEventsStats
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.
See: https://github.com/elastic/kibana/pull/69728/files#diff-b013c0d85f67056fb127d2247c99a538L78