[ResponseOps] Execution log - data grid component, date picker, and status filter#128183
Conversation
|
Pinging @elastic/response-ops (Team:ResponseOps) |
901bde0 to
344a0fa
Compare
ymao1
left a comment
There was a problem hiding this comment.
LGTM! Left some minor comments and questions but verified that the exec log table shows up on the rule details view :)
| .sort((leftAlert, rightAlert) => leftAlert.sortPriority - rightAlert.sortPriority); | ||
|
|
||
| const pageOfAlerts = getPage(alerts, pagination); | ||
| const pageOfAlerts = getPage<AlertListItem>(alerts, pagination); |
There was a problem hiding this comment.
Is there a reason to keep the alert table pagination in this component instead of moving it into <RuleAlertList?
There was a problem hiding this comment.
Good point, I'll move it to the alert list component
| ]; | ||
|
|
||
| const renderTabs = () => { | ||
| const isEnabled = getIsExperimentalFeatureEnabled('rulesListDatagrid'); |
There was a problem hiding this comment.
Should this be rulesDetailLogs instead of rulesListDatagrid?
| return date; | ||
| }; | ||
|
|
||
| const SORTABLE_COLUMNS = [ |
There was a problem hiding this comment.
We have this const and also SortFields in x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_execution_log_aggregations.ts. Can we collapse to just one definition to make sure we're keeping them in sync?
Something like
const SortableColumns =[
'timestamp',
'execution_duration',
'total_search_duration',
'es_search_duration',
'schedule_delay',
'num_triggered_actions',
] as const;
type SortFields = typeof SortableColumns[number];
| }); | ||
|
|
||
| // Date related states | ||
| const [isLoading, setIsLoading] = useState<boolean>(false); |
There was a problem hiding this comment.
Is there some sort of loading indicator for the EuiDataGrid that we can set? I added a delay to the API response for testing and I just see a table with an empty header while waiting for the response. Would be nice to have some sort of loading indicator.
There was a problem hiding this comment.
I didn't find one inherently while working on the alerts table, but I found that adding a <EuiProgress> on the top of the grid worked well. See what I did here
It also made it much easier to functionally test, as I could properly wait for server requests to finish
There was a problem hiding this comment.
Yea right now the only indication is the refresh button, but yes I can add what chris did to the execution log list
|
I just remembered we were planning to show something similar to Discover if the |
chrisronline
left a comment
There was a problem hiding this comment.
Looking great so far! Made a first pass and had some questions/comments
| { | ||
| id: ALERT_LIST_TAB, | ||
| name: i18n.translate('xpack.triggersActionsUI.sections.ruleDetails.rule.alertsTabText', { | ||
| defaultMessage: 'Alerts', |
There was a problem hiding this comment.
Is this an attempt to normalize the terminology here? We aren't technically showing alerts, right?
There was a problem hiding this comment.
So this tab is where the previous alert list in the rule summary would go, it technically would be alerts here
There was a problem hiding this comment.
Yea I'm just saying we aren't querying alerts-as-data indices here, but rather getting this information from the event log I think?
There was a problem hiding this comment.
I think you're right, these alerts come from the rule summary, which queries event logs
There was a problem hiding this comment.
Yea I'm not sure if it's a big deal or not, cc @XavierM
| ]; | ||
|
|
||
| const renderTabs = () => { | ||
| const isEnabled = getIsExperimentalFeatureEnabled('rulesListDatagrid'); |
There was a problem hiding this comment.
Did you run into this bug while developing this? Or maybe not because it's on by default?
There was a problem hiding this comment.
It's on by default, I recently noticed the issue when poking at the config values for integration testing
There was a problem hiding this comment.
I should merge the fix by EOD so don't worry about fixing it yourself
| const columns = [ | ||
| { | ||
| id: 'id', | ||
| displayAsText: i18n.translate( |
There was a problem hiding this comment.
Can we use the initialWidth property to make the default columns more user friendly? We can easily shrink the Status column while making the Message column wider
| }); | ||
|
|
||
| // Date related states | ||
| const [isLoading, setIsLoading] = useState<boolean>(false); |
There was a problem hiding this comment.
I didn't find one inherently while working on the alerts table, but I found that adding a <EuiProgress> on the top of the grid worked well. See what I did here
It also made it much easier to functionally test, as I could properly wait for server requests to finish
| // Main cell renderer, renders durations, statuses, etc. | ||
| const renderCell = ({ rowIndex, columnId }: EuiDataGridCellValueElementProps) => { | ||
| const { pageIndex, pageSize } = pagination; | ||
| const pagedRowIndex = rowIndex - pageIndex * pageSize; |
There was a problem hiding this comment.
I found a visibleRowIndex property available to use instead of needing to do this.
There was a problem hiding this comment.
unfortunately I think theres a bug with this. visibleRowIndex doesn't seem to exist when its in the "popover" mode. It becomes undefined :(
| return null; | ||
| } | ||
|
|
||
| if (columnId === 'status') { |
There was a problem hiding this comment.
Is there a way to use an enum or something here? Seems brittle that if the column id changes, this will silently fail
.../triggers_actions_ui/public/application/sections/rule_details/components/rule_alert_list.tsx
Outdated
Show resolved
Hide resolved
| | 'schedule_delay' | ||
| | 'num_triggered_actions'; | ||
|
|
||
| export type SortOrder = 'asc' | 'desc'; |
There was a problem hiding this comment.
We shouldn't need to explicitly define this - maybe we can use estypes.SortOrder?
| date_end: dateEnd, | ||
| filter: getFilter(filter), | ||
| per_page: perPage, | ||
| page: page + 1, |
There was a problem hiding this comment.
Probably worth adding a comment explaining why we have to add 1 - honestly, I don't know why the API works this way when it just subtracts 1 from the page variable later. I'd add something here to remind us about this.
x-pack/plugins/triggers_actions_ui/public/application/lib/monitoring_utils.ts
Show resolved
Hide resolved
@ymao1 I wasn't aware of this, do you have more context for what it looks like or where I can find an example of its usage? I don't mind adding it with this PR |
I thought it was in meta issue but it turns out it's in a discussion thread on my API PR. Sorry! Here is the link: #127339 (comment) |
mdefazio
left a comment
There was a problem hiding this comment.
Awesome to see this in place! Some comments on the UI:
Move controls to the left: I know this will have a search bar in the future, but in the meantime, lets' just keep these left-aligned
No flex-grow on the inputs: Again, just to clean things up some more until the search bar is in.
Styling of EuiSuperDatePicker: Let's make the width set to auto and then change the refresh button to only be an icon and remove the fill on it as well.
Duration should include milliseconds: I know we don't show milliseconds on the rule list page, but for these logs I feel it makes sense, particularly since its right next to a timestamp with milliseconds. Perhaps theres another opinion about this, but it felt odd to show timestamp with milliseconds and not the duration.
Right align columns with numbers: Columns where we are comparing numbers across rows, these should be right-aligned.
Filter popover Looks like there's extra padding getting applied to the filter popover. Not sure if the EuiSelectable is being used here. While the docs say a 'long list' is best to use EuiSelectable, I think it's worth considering so we can have this appear consistent next to other upcoming filters that may have longer lists (though we can omit the search for this filter group). The issue currently is the padding, but something to consider.
|
|
||
| const RULE_EVENT_LOG_LIST_STORAGE_KEY = 'xpack.triggersActionsUI.ruleEventLogList.initialColumns'; | ||
|
|
||
| export const DEFAULT_INITIAL_VISIBLE_COLUMNS = [ |
There was a problem hiding this comment.
This looks like a good list of columns to start with! Once this is live, we'll probably have a better sense if there's more we need.
|
@elasticmachine merge upstream |
@mdefazio So it seems like the data grid should automatically format numeric values to be right aligned, I can't seem to achieve this functionality despite boiling it down to the simplest case possible (
I'm currently using a div that wraps multiple |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
chrisronline
left a comment
There was a problem hiding this comment.
Looking really good! I commented about a few visual things but I think what we have is great!
| defaultMessage: 'Timestamp', | ||
| } | ||
| ), | ||
| isSortable: getIsColumnSortable('timestamp'), |
There was a problem hiding this comment.
Try adding initialWidth: 250,
| defaultMessage: 'Duration', | ||
| } | ||
| ), | ||
| isSortable: getIsColumnSortable('execution_duration'), |
There was a problem hiding this comment.
Try adding initialWidth: 100,
| } | ||
| ), | ||
| isSortable: getIsColumnSortable('message'), | ||
| initialWidth: 400, |
There was a problem hiding this comment.
Try removing this so the message takes up the rest of the available space
| <EuiFlexItem grow={false}> | ||
| <RuleEventLogListStatusFilter selectedOptions={filter} onChange={onFilterChange} /> | ||
| </EuiFlexItem> | ||
| <EuiFlexItem grow={false}> |
There was a problem hiding this comment.
Maybe grow={true} so it expands?
Addressed Michael's comments but he is OOO
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
ESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |



Summary
Resolves the following issues:
#126841
#126842
Implements the execution log list component inside the rules summary page. Uses the new aggregation API and supports sorting/filtering/pagination via the data grid component.
We're using the super date picker to allow filtering on dates.
Currently the filtering is only on the event outcome status (
success,failure, or 'unknown`). In the future we will implement a KQL query bar to support filtering on more fields.Sorting is limited to the following fields:
timestampexecution_durationtotal_search_durationes_search_durationschedule_delaynum_triggered_actionsThis PR has a dependency on #128179, so it contains changes from there as well.