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

[APM] Show recommended minimum size when reducing rule interval below 5 minutes #144170

Merged

Conversation

sorenlouv
Copy link
Member

@sorenlouv sorenlouv commented Oct 28, 2022

We've seen that users create rules where the ingest delay is larger than the look back window. This means that alerts will not fire as expected because there's no data available when evaluating the rule.

This PR increases the default window size to 5 minutes, and adds a warning if the window size is lowered below this level.

@sorenlouv sorenlouv requested review from a team as code owners October 28, 2022 14:32
@botelastic botelastic bot added the Team:APM - DEPRECATED Use Team:obs-ux-infra_services. label Oct 28, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:APM)

import { ApmRuleParamsContainer } from '../../ui_components/apm_rule_params_container';

export interface RuleParams {
windowSize?: number;
windowUnit?: TimeUnit;
windowUnit?: TIME_UNITS;
Copy link
Member Author

Choose a reason for hiding this comment

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

Replace our custom units with units from alerting.

@@ -65,7 +64,7 @@ export function ErrorCountRuleType(props: Props) {
(callApmApi) => {
const { interval, start, end } = getIntervalAndTimeRange({
windowSize: params.windowSize,
windowUnit: params.windowUnit as TimeUnit,
Copy link
Member Author

Choose a reason for hiding this comment

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

Typecasting no longer needed because we use the same types as alerting

@@ -142,7 +142,7 @@ export { loadRule } from './application/lib/rule_api/get_rule';
export { loadAllActions } from './application/lib/action_connector_api';
export { suspendedComponentWithProps } from './application/lib/suspended_component_with_props';
export { loadActionTypes } from './application/lib/action_connector_api/connector_types';
export type { TIME_UNITS } from './application/constants';
export { TIME_UNITS } from './application/constants';
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to export this to access the runtime value

@sophiec20
Copy link
Contributor

cc @elastic/mlr-docs

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.

alerting change LGTM

Poking through the rest of the PR, noticing a type change on RuleParams::windowUnit (TimeUnit -> TIME_UNITS). Which have the same values, but the types are different. Since this looks like params for a rule, which would be saved in the SO, need to consider migration issues.

I'm thinking this will not cause a migration, since the values remain unchanged, but thought I'd mention that sometimes changes similar to this could cause a migration - for instance, if the version was a value in the old type not in the new type, kinda thing. Does not look like that's the case here - both types support all the values.

Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

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

LGTM. Just some nits that don't block it.

}) {
return (
<EuiCallOut
title={`Please increase "For the last" to at least ${
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using i18n and down below?!

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point

@@ -33,6 +56,10 @@ export function ApmRuleParamsContainer(props: Props) {
}, []);
return (
<>
{showMinimumWindowSizeWarning && minimumWindowSize && (
Copy link
Contributor

@cauemarcondes cauemarcondes Oct 28, 2022

Choose a reason for hiding this comment

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

Looks like useShowMinimumWindowSize already checks if minimumWindowSize is defined and if not it returns false so I don't think you need these two checks.

Suggested change
{showMinimumWindowSizeWarning && minimumWindowSize && (
{showMinimumWindowSizeWarning && (

Copy link
Member Author

Choose a reason for hiding this comment

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

afair this is needed to satisfy Typescript because minimumWindowSize is optional. I'll see what I can do though

);
}

function useShowMinimumWindowSize({
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it have to be a hook at all? It looks like a normal function that returns true/false?!

Copy link
Member Author

@sorenlouv sorenlouv Oct 28, 2022

Choose a reason for hiding this comment

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

Are you suggesting to inline this? I think it's better to extract it but I don't feel strongly about it.

@sorenlouv sorenlouv changed the title [APM] Show recommended minimum size when going below [APM] Show recommended minimum size when going below 5 minutes Oct 28, 2022
@sorenlouv sorenlouv force-pushed the show-recommended-minimum-window-size branch from 1836766 to 06e8dbd Compare October 31, 2022 00:06
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #38 / alerting api integration spaces only Alerting builtin alertTypes es_query rule runs correctly: use epoch millis - threshold on hit count < > for searchSource search type

Metrics [docs]

Async chunks

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

id before after diff
apm 3.1MB 3.1MB +4.3KB

Page load bundle

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

id before after diff
triggersActionsUi 100.5KB 100.6KB +54.0B
Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 57 63 +6
osquery 103 108 +5
securitySolution 439 443 +4
total +17

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 65 71 +6
osquery 104 110 +6
securitySolution 516 520 +4
total +18

History

  • 💔 Build #83778 failed ecbd317934e965a5c2765c01bd847fcc9f895ade
  • 💔 Build #83557 failed 837b99c923c6a908f3181225c7c51dbf4683c709

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

@sorenlouv sorenlouv merged commit e502ecf into elastic:main Oct 31, 2022
@sorenlouv sorenlouv deleted the show-recommended-minimum-window-size branch October 31, 2022 21:42
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Oct 31, 2022
jloleysens added a commit to jloleysens/kibana that referenced this pull request Nov 1, 2022
* main: (43 commits)
  [Synthetics] Step details page screenshot (elastic#143452)
  [Lens] Datatable expression types improvement. (elastic#144173)
  [packages/kbn-journeys] start apm after browser start and stop after browser is closed (elastic#144267)
  [Files] Make files namespace agnostic (elastic#144019)
  Implement base browser-side logging system (elastic#144107)
  Correct wrong multiplier for byte conversion (elastic#143751)
  [Monaco] Add JSON syntax support to the Monaco editor (elastic#143739)
  CCS Smoke Test for Remote Clusters and Index Management  (elastic#142423)
  [api-docs] Daily api_docs build (elastic#144294)
  chore(NA): include progress on Bazel tasks (elastic#144275)
  [RAM] Allow users to see event logs from all spaces they have access to (elastic#140449)
  [APM] Show recommended minimum size when going below 5 minutes (elastic#144170)
  [typecheck] delete temporary target_types dirs in packages (elastic#144271)
  [Security Solution][Endpoint] adds new alert loading utility and un-skip FTR test for endpoint (elastic#144133)
  [performance/journeys] revert data_stress_test_lens.ts journey step (elastic#144261)
  [TIP] Use search strategies in Threat Intelligence (elastic#143267)
  Optimize react-query dependencies (elastic#144206)
  [babel/node] invalidate cache when synth pkg map is updated (elastic#144258)
  [APM] AWS lambda estimated cost (elastic#143986)
  [Maps] layer group wizard (elastic#144129)
  ...
@sorenlouv sorenlouv changed the title [APM] Show recommended minimum size when going below 5 minutes [APM] Show recommended minimum size when reducing rule interval below 5 minutes Jan 5, 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:fix Team:APM - DEPRECATED Use Team:obs-ux-infra_services. v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants