-
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
[AO] - Add scaffolding and the main chart to the Logs threshold Alert Details page #153081
[AO] - Add scaffolding and the main chart to the Logs threshold Alert Details page #153081
Conversation
...k/plugins/infra/public/alerting/log_threshold/components/alert_details_app_section/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/infra/server/routes/log_alerts/chart_preview_data.ts
Outdated
Show resolved
Hide resolved
…-ref HEAD~1..HEAD --fix'
export interface AlertDetailsAppSectionProps { | ||
rule: Rule<PartialRuleParams>; | ||
alert: TopAlert; | ||
timeZone: string; | ||
setAlertSummaryFields: React.Dispatch<React.SetStateAction<AlertSummaryField[] | undefined>>; | ||
} |
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.
Are we not supposed to export the Props directly from the component file?
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.
Not sure if it is the same in the infra plugin.
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.
oh yes indeed, it might be different
x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.test.ts
Outdated
Show resolved
Hide resolved
@@ -401,3 +401,8 @@ export const isOptimizableGroupedThreshold = ( | |||
return false; | |||
} | |||
}; | |||
|
|||
export interface ExecutionTimeRange { | |||
gte?: number; |
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.
Why is this optional?
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.
Because this is not used on the server side, it's used only if we define it for the Logs chart.
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.
From what I see, we use both on the server side: https://github.com/elastic/kibana/pull/153081/files#diff-a71ca536380c1fde8805744b23566ce795707f92b94a03af73347cac46ccac63R654-R655
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.
@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)
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.
LGTM, If I want to test this locally, what feature flag do I need to enable?
|
@maryam-saeidi here is the issue related to the no data message #153749 |
...k/plugins/infra/public/alerting/log_threshold/components/alert_details_app_section/index.tsx
Outdated
Show resolved
Hide resolved
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.
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!
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.
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; |
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.
From what I see, we use both on the server side: https://github.com/elastic/kibana/pull/153081/files#diff-a71ca536380c1fde8805744b23566ce795707f92b94a03af73347cac46ccac63R654-R655
export interface AlertDetailsAppSectionProps { | ||
rule: Rule<PartialRuleParams>; | ||
alert: TopAlert; | ||
timeZone: string; |
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.
You don't use these two fields in this PR:
timeZone: string;
setAlertSummaryFields: React.Dispatch<React.SetStateAction<AlertSummaryField[] | undefined>>;
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.
@maryam-saeidi, Really! 😄 Okay, I will delete them.
@@ -112,6 +112,11 @@ export interface LensOptions { | |||
breakdownSize: number; | |||
} | |||
|
|||
export interface ExecutionTimeRange { |
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.
Is this interface needed? There is also one in alerting/logs/log_threshold/types
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.
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(), |
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.
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;
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.
@maryam-saeidi, no need here. The executor doesn't use gte
...k/plugins/infra/public/alerting/log_threshold/components/alert_details_app_section/index.tsx
Show resolved
Hide resolved
@elasticmachine merge upstream |
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.
LGTM! 👍🏻
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsasync chunk count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @fkanout |
Summary
This is a kickoff PR; more PRs will follow up.
It closes #152738
Checklist
Delete any items that are not applicable to this PR.