-
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
no longer pass related event stats to process node component #72435
Changes from 1 commit
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ import { NodeSubMenu, subMenuAssets } from './submenu'; | |
import { applyMatrix3 } from '../models/vector2'; | ||
import { Vector2, Matrix3 } from '../types'; | ||
import { SymbolIds, useResolverTheme, calculateResolverFontSize } from './assets'; | ||
import { ResolverEvent, ResolverNodeStats } from '../../../common/endpoint/types'; | ||
import { ResolverEvent } from '../../../common/endpoint/types'; | ||
import { useResolverDispatch } from './use_resolver_dispatch'; | ||
import * as eventModel from '../../../common/endpoint/models/event'; | ||
import * as processEventModel from '../models/process_event'; | ||
|
@@ -73,7 +73,6 @@ const UnstyledProcessEventDot = React.memo( | |
projectionMatrix, | ||
isProcessTerminated, | ||
isProcessOrigin, | ||
relatedEventsStatsForProcess, | ||
timeAtRender, | ||
}: { | ||
/** | ||
|
@@ -100,12 +99,6 @@ const UnstyledProcessEventDot = React.memo( | |
* Whether or not to show the process as the originating event. | ||
*/ | ||
isProcessOrigin: boolean; | ||
/** | ||
* A collection of events related to the current node and statistics (e.g. counts indexed by event type) | ||
* to provide the user some visibility regarding the contents thereof. | ||
* Statistics for the number of related events and alerts for this process node | ||
*/ | ||
relatedEventsStatsForProcess?: ResolverNodeStats; | ||
|
||
/** | ||
* The time (unix epoch) at render. | ||
|
@@ -128,6 +121,12 @@ const UnstyledProcessEventDot = React.memo( | |
const selectedDescendantId = useSelector(selectors.uiSelectedDescendantId); | ||
const nodeID = processEventModel.uniquePidForProcess(event); | ||
|
||
/** | ||
* A collection of events related to the current node and statistics (e.g. counts indexed by event type) | ||
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. i'll remove the comment. fwiw, that was the existing comment for 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. Maybe at one point it did have that collection with it in whatever form it was being consumed here. |
||
* to provide the user some visibility regarding the contents thereof. | ||
* Statistics for the number of related events and alerts for this process node | ||
*/ | ||
const relatedEventStats = useSelector(selectors.relatedEventsStats)(nodeID); | ||
// define a standard way of giving HTML IDs to nodes based on their entity_id/nodeID. | ||
// this is used to link nodes via aria attributes | ||
const nodeHTMLID = useCallback((id: string) => htmlIdGenerator(htmlIDPrefix)(`${id}:node`), [ | ||
|
@@ -270,15 +269,13 @@ const UnstyledProcessEventDot = React.memo( | |
const relatedEventOptions = useMemo(() => { | ||
const relatedStatsList = []; | ||
|
||
if (!relatedEventsStatsForProcess) { | ||
if (!relatedEventStats) { | ||
// Return an empty set of options if there are no stats to report | ||
return []; | ||
} | ||
// If we have entries to show, map them into options to display in the selectable list | ||
|
||
for (const [category, total] of Object.entries( | ||
relatedEventsStatsForProcess.events.byCategory | ||
)) { | ||
for (const [category, total] of Object.entries(relatedEventStats.events.byCategory)) { | ||
relatedStatsList.push({ | ||
prefix: <EuiI18nNumber value={total || 0} />, | ||
optionTitle: category, | ||
|
@@ -296,9 +293,9 @@ const UnstyledProcessEventDot = React.memo( | |
}); | ||
} | ||
return relatedStatsList; | ||
}, [relatedEventsStatsForProcess, dispatch, event, pushToQueryParams, nodeID]); | ||
}, [relatedEventStats, dispatch, event, pushToQueryParams, nodeID]); | ||
|
||
const relatedEventStatusOrOptions = !relatedEventsStatsForProcess | ||
const relatedEventStatusOrOptions = !relatedEventStats | ||
? subMenuAssets.initialMenuStatus | ||
: relatedEventOptions; | ||
|
||
|
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.
❔ Isn't more correct to say
events
? Using the singular implies you are providing stats about one related event, which isn't really the case, right?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.
I see your point. My motivation for changing this was just because I kept typing it as
relatedEventStats
. How do you feel aboutnodeStats
? @bkimmelThere 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.
nvm, putting back the original name
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.
To be consistent with our naming in a few other places, should we add a
ByEntityId
at the end, too? LikenodeStatsByEntityId
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.
dunno