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

[ResponseOps][OnWeek] Connector logs view #148291

Merged
merged 53 commits into from
Jan 23, 2023

Conversation

doakalexi
Copy link
Contributor

@doakalexi doakalexi commented Jan 3, 2023

Resolves #147795

Summary

Adds a connectors event log tab that gives the ability to see historical activity of connectors.

Checklist

Delete any items that are not applicable to this PR.

To verify

@doakalexi doakalexi changed the title On week/connectors event logs [ResponseOps][OnWeek] Connector logs view Jan 9, 2023
@doakalexi doakalexi added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) release_note:feature Makes this part of the condensed release notes labels Jan 9, 2023
@doakalexi doakalexi marked this pull request as ready for review January 9, 2023 18:42
@doakalexi doakalexi requested review from a team as code owners January 9, 2023 18:42
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

Initial code review of server code. It's looking good but I think we could simplify the aggregations for this.

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

finished the server-side review of this PR

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

LGTM, and I think we can remove that "Filter out execution UUID buckets where actionExecution doc count is 0" bit, if we don't really need it.

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

I noticed that preconfigured connector logs only show up in the default space. I think since preconfigured connectors are available in all spaces, the logs for them should show up in all spaces automatically, WDYT?

@ymao1
Copy link
Contributor

ymao1 commented Jan 18, 2023

I created a user with Read access to Actions and Connectors and logged in with them I can see the Connectors page but when I go to the Logs tab, I get a 403 unauthorized response. Should a read-only user be able to see these logs?

@doakalexi
Copy link
Contributor Author

I created a user with Read access to Actions and Connectors and logged in with them I can see the Connectors page but when I go to the Logs tab, I get a 403 unauthorized response. Should a read-only user be able to see these logs?

Resolved in this commit 5104f14

@doakalexi
Copy link
Contributor Author

I noticed that preconfigured connector logs only show up in the default space. I think since preconfigured connectors are available in all spaces, the logs for them should show up in all spaces automatically, WDYT?

Resolved in this commit cb9821b

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

Everything looks great and works as expected!

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

Looking good. Noted one expression that might be able to be simplified, but also needs another ?. optional property operator.

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

LGTM! :shipit: !!!

Copy link
Contributor

@JiaweiWu JiaweiWu left a comment

Choose a reason for hiding this comment

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

I tested this locally, seems to work as expected. I just have a few comments

[search, setSearchText]
);

const onShowAllSpacesChange = useCallback(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be nice if we didn't duplicate this logic as much, maybe a hook to encapsulate some of this space logic? (i.e. useMultipleSpaces returning onShowAllSpacesChange and canAccessMultipleSpaces)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved in this commit b9debef

}
}, [setShowFromAllSpaces, showFromAllSpaces, visibleColumns]);

const columns: EuiDataGridColumn[] = useMemo(
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we want to make the connector name the first column like how we have it for global rule event logs?

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Also did we want to have the connectors clickable? I think it might be helpful in the cross-space scenario to navigate the user to the corresponding connector page

Copy link
Contributor Author

@doakalexi doakalexi Jan 23, 2023

Choose a reason for hiding this comment

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

Oh that is a good idea! I am wondering if this maybe could be a follow on issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did we want to make the connector name the first column like how we have it for global rule event logs?

I don't think so, UX asked for this column order.

@@ -0,0 +1,616 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have a unit test for this? This seems like the main component of this feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved in this commit 38e4176


import React from 'react';
import { act } from 'react-dom/test-utils';
import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers';
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this was written following existing patterns but for mounting react components, we are moving away from enzyme, in favour of testing-library/react, you don't have to change this test (unless you really want to haha) but just a FYI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh okay, thanks for letting me know!

Copy link
Contributor

@JiaweiWu JiaweiWu left a comment

Choose a reason for hiding this comment

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

LGTM! I just have 1 more comment. Feel free to merge after addressing it

() => (showFromAllSpaces && spacesData ? accessibleSpaceIds : undefined),
[showFromAllSpaces, spacesData, accessibleSpaceIds]
);
const { onShowAllSpacesChange, canAccessMultipleSpaces, namespaces } = useMultipleSpaces({
Copy link
Contributor

Choose a reason for hiding this comment

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

let's move the useSpacesData call above into the hook since it's not being used anywhere else, same with actions_connectors event log table. We won't have to pass in spacesData into the hook.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved in this commit b7c1703

@doakalexi doakalexi enabled auto-merge (squash) January 23, 2023 20:50
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
actions 12 13 +1
triggersActionsUi 487 495 +8
total +9

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
actions 215 251 +36
eventLog 115 116 +1
total +37

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
triggersActionsUi 707.7KB 722.1KB +14.5KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
actions 15.4KB 15.6KB +217.0B
triggersActionsUi 114.9KB 116.2KB +1.3KB
total +1.5KB
Unknown metric groups

API count

id before after diff
actions 220 256 +36
eventLog 115 116 +1
total +37

async chunk count

id before after diff
triggersActionsUi 54 57 +3

ESLint disabled in files

id before after diff
triggersActionsUi 3 4 +1

ESLint disabled line counts

id before after diff
triggersActionsUi 116 123 +7

Total ESLint disabled count

id before after diff
triggersActionsUi 119 127 +8

History

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

@doakalexi doakalexi merged commit 77742b8 into elastic:main Jan 23, 2023
@kibanamachine kibanamachine added v8.7.0 backport:skip This commit does not require backporting labels Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:feature Makes this part of the condensed release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connector logs view
8 participants