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

[AO] - Add scaffolding and the main chart to the Logs threshold Alert Details page #153081

Conversation

fkanout
Copy link
Contributor

@fkanout fkanout commented Mar 10, 2023

Summary

This is a kickoff PR; more PRs will follow up.

It closes #152738
Screenshot 2023-03-23 at 13 10 09

Checklist

Delete any items that are not applicable to this PR.

@fkanout fkanout self-assigned this Mar 23, 2023
@fkanout fkanout added v8.8.0 release_note:skip Skip the PR/issue when compiling release notes labels Mar 23, 2023
@fkanout fkanout marked this pull request as ready for review March 23, 2023 14:45
@fkanout fkanout requested a review from a team as a code owner March 23, 2023 14:45
Comment on lines 13 to 18
export interface AlertDetailsAppSectionProps {
rule: Rule<PartialRuleParams>;
alert: TopAlert;
timeZone: string;
setAlertSummaryFields: React.Dispatch<React.SetStateAction<AlertSummaryField[] | undefined>>;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we not supposed to export the Props directly from the component file?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure if it is the same in the infra plugin.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yes indeed, it might be different

@@ -401,3 +401,8 @@ export const isOptimizableGroupedThreshold = (
return false;
}
};

export interface ExecutionTimeRange {
gte?: number;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because this is not used on the server side, it's used only if we define it for the Logs chart.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maryam-saeidi, only the Alert Details page (frontend) will fill up the gte, which is sent to the server side.
Something to mention is ExecutionTimeRange is not only used to get the chart data (where we could use gte). But also in the log threshold executor (where gte is not used)

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, If I want to test this locally, what feature flag do I need to enable?

@maryam-saeidi
Copy link
Member

LGTM, If I want to test this locally, what feature flag do I need to enable?

xpack.observability.unsafe.alertDetails.logs.enabled

@maryam-saeidi
Copy link
Member

When checked the chart, it first showed no data:

Then loading:

And then chart:

Is there a ticket to fix the loading?

@fkanout
Copy link
Contributor Author

fkanout commented Mar 27, 2023

@maryam-saeidi here is the issue related to the no data message #153749

Copy link
Contributor

@tonyghiani tonyghiani left a comment

Choose a reason for hiding this comment

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

LGTM, the main doubts were already covered by other comments (no-data chart) and I just left a nit totally non-blocking!
Thanks for this work!

Copy link
Member

@maryam-saeidi maryam-saeidi left a comment

Choose a reason for hiding this comment

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

Checked locally, and it worked as expected.
I left some comments in the PR.

@@ -401,3 +401,8 @@ export const isOptimizableGroupedThreshold = (
return false;
}
};

export interface ExecutionTimeRange {
gte?: number;
Copy link
Member

Choose a reason for hiding this comment

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

export interface AlertDetailsAppSectionProps {
rule: Rule<PartialRuleParams>;
alert: TopAlert;
timeZone: string;
Copy link
Member

Choose a reason for hiding this comment

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

You don't use these two fields in this PR:

  timeZone: string;
  setAlertSummaryFields: React.Dispatch<React.SetStateAction<AlertSummaryField[] | undefined>>;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maryam-saeidi, Really! 😄 Okay, I will delete them.

@@ -112,6 +112,11 @@ export interface LensOptions {
breakdownSize: number;
}

export interface ExecutionTimeRange {
Copy link
Member

Choose a reason for hiding this comment

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

Is this interface needed? There is also one in alerting/logs/log_threshold/types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. One with gte required a type for the frontend, and the other one gte is optional for backend.

@@ -140,7 +140,9 @@ const baseRuleParams: Pick<RuleParams, 'count' | 'timeSize' | 'timeUnit' | 'logV

const TIMESTAMP_FIELD = '@timestamp';
const FILEBEAT_INDEX = 'filebeat-*';
const EXECUTION_TIMESTAMP = new Date('2022-01-01T00:00:00.000Z').valueOf();
const EXECUTION_TIMERANGE = {
lte: new Date('2022-01-01T00:00:00.000Z').valueOf(),
Copy link
Member

Choose a reason for hiding this comment

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

Since we might have gte shall we add a test for that case too?

  const to = executionTimeRange?.lte || Date.now();
  const from = executionTimeRange?.gte || to - intervalAsMs;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maryam-saeidi, no need here. The executor doesn't use gte

@fkanout
Copy link
Contributor Author

fkanout commented Mar 28, 2023

@elasticmachine merge upstream

Copy link
Member

@maryam-saeidi maryam-saeidi left a comment

Choose a reason for hiding this comment

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

LGTM! 👍🏻

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
infra 1291 1292 +1

Async chunks

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

id before after diff
infra 1.3MB 1.4MB +11.7KB

Page load bundle

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

id before after diff
infra 88.0KB 88.3KB +207.0B
Unknown metric groups

async chunk count

id before after diff
infra 24 25 +1

ESLint disabled line counts

id before after diff
infra 47 48 +1
securitySolution 433 436 +3
total +4

Total ESLint disabled count

id before after diff
infra 55 56 +1
securitySolution 513 516 +3
total +4

History

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

cc @fkanout

@fkanout fkanout merged commit c1a8b90 into elastic:main Mar 28, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Mar 28, 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:skip Skip the PR/issue when compiling release notes v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AO] - Setup the scaffolding of the Log threshold Alert Details page (AlertDetailsAppSection component)
6 participants