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

[RCA] Start investigation from alert details page #190307

Merged

Conversation

benakansara
Copy link
Contributor

@benakansara benakansara commented Aug 12, 2024

Resolves #190320 and #190396

  • Start investigation from Custom threshold alert details page
  • Go to ongoing investigation instead of creating new one if one already exists
  • Initial investigation status is set as ongoing
  • Investigation origin is set as alert

"Start investigation" is hidden for other alert types and when investigate plugin is disabled.

Testing

  • Add the following in kibana.dev.yml
xpack.investigate.enabled: true
xpack.investigateApp.enabled: true
  • Create Custom threshold rule
  • Open Custom threshold alert details page
  • Click on "Start investigation"
  • Verify that a new saved object is created for the investigation
Screen.Recording.2024-08-12.at.12.24.02.mov

@benakansara benakansara self-assigned this Aug 12, 2024
@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@benakansara benakansara added release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-management Observability Management User Experience Team v8.16.0 labels Aug 12, 2024
@benakansara benakansara marked this pull request as ready for review August 12, 2024 10:30
@benakansara benakansara requested review from a team as code owners August 12, 2024 10:30
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Aug 12, 2024
Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

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

just some comments about the cache keys.

@benakansara benakansara marked this pull request as draft August 12, 2024 14:04
@benakansara benakansara removed request for a team August 13, 2024 09:18
@benakansara
Copy link
Contributor Author

/ci

@benakansara
Copy link
Contributor Author

/ci

@benakansara benakansara marked this pull request as ready for review August 13, 2024 10:14
Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

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

Just did a quick review before the meeting, will continue after. Looking good so far

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

Changes to kibana.jsoncLGTM

Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

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

I left some comments, thanks for the initial refactoring of the search API.
A few things that we can tackle in another PR: duplication of hooks

Comment on lines 41 to 47
const alertId = investigationDetails?.origin.id ?? '';

const {
data: alertDetails,
isLoading: isFetchAlertLoading,
isError: isFetchAlertError,
} = useFetchAlert({ id: alertId });
Copy link
Contributor

Choose a reason for hiding this comment

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

More of a philosophical question, but do you think the get investigation API should query RAC and include the alert details directly in its response?
So instead of doing two request sequentially, the client would just do one and get everything?
That's maybe a bit of a premature optimization. But something to think about.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's a good question, something I was thinking about it too while implementing. We would need to have rac in context to use alerts client. I will look into it.

return (
<>
<EuiFlexGroup direction="row" gutterSize="s" justifyContent="flexEnd">
{investigate &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Is investigate null when the feature flag is off?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's undefined

} = useKibana().services;

const { rule, refetch } = useFetchRule({
ruleId: alert?.fields[ALERT_RULE_UUID] || '',
});

const { data: investigations } = useFetchInvestigationsByAlert({
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 we should not even try to fetch the investigations in case the investigate feature flag is not enabled

Copy link
Contributor Author

@benakansara benakansara Aug 13, 2024

Choose a reason for hiding this comment

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

Good catch. Addressed in 5a24c0b

benakansara and others added 2 commits August 13, 2024 20:01
…a/find.ts

Co-authored-by: Kevin Delemme <kdelemme@gmail.com>
@benakansara benakansara requested a review from kdelemme August 13, 2024 20:20
@kibana-ci
Copy link
Collaborator

kibana-ci commented Aug 13, 2024

💛 Build succeeded, but was flaky

  • Buildkite Build
  • Commit: 7e0abe4
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-190307-7e0abe45c945

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
investigate 21 26 +5
investigateApp 512 552 +40
observability 1070 1072 +2
total +47

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
investigate 112 119 +7
observability 694 695 +1
total +8

Async chunks

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

id before after diff
investigateApp 431.4KB 439.5KB +8.0KB
observability 424.7KB 426.8KB +2.1KB
total +10.2KB

Page load bundle

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

id before after diff
investigate 9.2KB 9.9KB +700.0B
observability 101.9KB 102.0KB +48.0B
total +748.0B
Unknown metric groups

API count

id before after diff
investigate 112 119 +7
observability 701 702 +1
total +8

History

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

cc @benakansara

Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

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

LGTM ! Thanks for the changes, I think we'll have to move things around to avoid too much duplication at some point. But for now, it's fine.

title: 'Something went wrong while fetching Investigations',
});
},
enabled: Boolean(investigatePlugin),
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻 nice

@benakansara benakansara merged commit 95736fb into elastic:main Aug 14, 2024
23 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Aug 14, 2024
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 ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-management Observability Management User Experience Team v8.16.0
Projects
None yet
7 participants