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

[Synthetics] Improve synthetics alerting #186585

Merged
merged 268 commits into from
Oct 1, 2024

Conversation

shahzad31
Copy link
Contributor

@shahzad31 shahzad31 commented Jun 21, 2024

Summary

Fixes #175298

Improve synthetics alerting !!

We have improved synthetics alerting to allow users to create custom rules, users will be able to limit rules scope by filtering monitors by Monitor name, tags, type or location. This will allow users to send alerts to different teams for different monitors by defining respective action connectors in each rule.

User will be able to create custom synthetics status alert by defining two kind of criteria

First kind of threshold is Monitor is down over last consecutive checks with threshold from x locations. This will allow users to let’s say define a threshold, Monitor abc is down 3 times from the last 5 checks from 1 location. Users can also change the location threshold to specify from how many locations the threshold should be met.

The other threshold specifies a time window for checks, example being Monitor is down 3 times in the last 10 minutes from 2 locations.

By default if only 1 location threshold is selected, users can choose either to get an alert per location or get a summary message for all locations. If the user chooses multiple locations threshold then a summary message is always sent.

Monitor is down over last consective checks with threshold

image

with Locations threshold

user can also select location threshold to say only when down from x locations

image

Over time with checks threshold just like uptime custom status alert

@shahzad31
Copy link
Contributor Author

/ci

@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!)

@shahzad31
Copy link
Contributor Author

/ci

1 similar comment
@shahzad31
Copy link
Contributor Author

/ci

@shahzad31 shahzad31 force-pushed the improve-synth-alerting branch from bd7d959 to 49a2a8f Compare June 27, 2024 14:17
@shahzad31
Copy link
Contributor Author

/ci

@dominiqueclarke dominiqueclarke self-requested a review July 16, 2024 13:18
@shahzad31
Copy link
Contributor Author

/ci

@shahzad31
Copy link
Contributor Author

/ci

@shahzad31
Copy link
Contributor Author

/ci

@elasticmachine
Copy link
Contributor

elasticmachine commented Jul 19, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #28 / Synthetics API Tests GetMonitorsOverview accepts search queries
  • [job] [logs] FTR Configs #28 / Synthetics API Tests GetMonitorsOverview accepts search queries

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
synthetics 914 1079 +165

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
@kbn/observability-synthetics-test-data - 4 +4

Async chunks

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

id before after diff
synthetics 854.8KB 1.1MB ⚠️ +247.7KB
triggersActionsUi 1.7MB 1.7MB +119.0B
total +247.8KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/observability-synthetics-test-data - 1 +1

Page load bundle

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

id before after diff
synthetics 19.4KB 21.7KB +2.3KB
Unknown metric groups

API count

id before after diff
@kbn/observability-synthetics-test-data - 4 +4

async chunk count

id before after diff
synthetics 8 9 +1

ESLint disabled line counts

id before after diff
synthetics 84 83 -1

Total ESLint disabled count

id before after diff
synthetics 91 90 -1

History

Copy link
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

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

This is looking a lot better and pretty close IMO.

In terms of smoke testing, I:

  • ran TLS rules that should not fail
  • ran TLS rules that should alert
  • ran MS rules that check location
  • ran MS rules that check project
  • ran MS rules that check monitor name
  • ran MS rules that check tags
  • changed the value of the failure threshold
  • changed the number of locations required to be down

I did see this error logged in my Kibana

Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments: 
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: now-2m, _f: undefined, _strict: undefined, _locale: [object Object]
Error: 
    at Function.createFromInputFallback (kibana/node_modules/moment/moment.js:324:25)
    at configFromString (kibana/node_modules/moment/moment.js:2613:19)
    at configFromInput (kibana/node_modules/moment/moment.js:3056:13)
    at prepareConfig (kibana/node_modules/moment/moment.js:3039:13)
    at createFromConfig (kibana/node_modules/moment/moment.js:3006:44)
    at createLocalOrUTC (kibana/node_modules/moment/moment.js:3100:16)
    at createLocal (kibana/node_modules/moment/moment.js:3104:16)
    at cloneWithOffset (kibana/node_modules/moment/moment.js:3353:20)
    at Moment.diff (kibana/node_modules/moment/moment.js:3917:16)
    at StatusRuleExecutor.getRange (status_rule_executor.ts:223:60)
    at StatusRuleExecutor.getDownChecks (status_rule_executor.ts:136:24)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.executor (monitor_status_rule.ts:77:60)
    at rule_type_runner.ts:212:28
    at TaskRunnerTimer.runWithTimer (task_runner_timer.ts:50:20)
    at RuleTypeRunner.run (rule_type_runner.ts:187:57)
    at TaskRunner.runRule (task_runner.ts:355:9)
    at TaskRunner.run (task_runner.ts:645:9)
    at TaskManagerRunner.run (task_runner.ts:389:22)

isClearable
fullWidth
isLoading={isLoading}
onChange={(selected: Array<EuiComboBoxOptionOption<string>>) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice to have this handler tested.

import React, { useState, ReactNode } from 'react';
import { EuiExpression, EuiPopover } from '@elastic/eui';

type ExpressionColor = 'subdued' | 'primary' | 'success' | 'accent' | 'warning' | 'danger';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type ExpressionColor = 'subdued' | 'primary' | 'success' | 'accent' | 'warning' | 'danger';

As noted before, I think you can simply import this type from EUI.

Copy link
Contributor

@justinkambic justinkambic 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

kibana-ci commented Oct 1, 2024

💚 Build Succeeded

  • Buildkite Build
  • Commit: c9fa0da
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-186585-c9fa0da1c8f1

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
synthetics 1019 1154 +135

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
@kbn/observability-synthetics-test-data - 4 +4

Async chunks

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

id before after diff
synthetics 964.5KB 1.2MB ⚠️ +237.5KB
triggersActionsUi 1.6MB 1.6MB +115.0B
total +237.6KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/observability-synthetics-test-data - 1 +1

Page load bundle

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

id before after diff
synthetics 36.9KB 37.1KB +221.0B
Unknown metric groups

API count

id before after diff
@kbn/observability-synthetics-test-data - 4 +4

ESLint disabled line counts

id before after diff
@kbn/synthetics-e2e 19 18 -1
@kbn/test-suites-xpack 721 722 +1
synthetics 49 52 +3
total +3

Total ESLint disabled count

id before after diff
@kbn/synthetics-e2e 20 19 -1
@kbn/test-suites-xpack 745 746 +1
synthetics 55 58 +3
total +3

History

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

@shahzad31 shahzad31 merged commit 82d0b00 into elastic:main Oct 1, 2024
42 checks passed
@shahzad31 shahzad31 deleted the improve-synth-alerting branch October 1, 2024 16:48
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11129829761

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

You might need to backport the following PRs to 8.x:
- [Synthetics] Remove dead code (#193335)

Manual backport

To create the backport manually run:

node scripts/backport --pr 186585

Questions ?

Please refer to the Backport tool documentation

@shahzad31
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

shahzad31 added a commit to shahzad31/kibana that referenced this pull request Oct 2, 2024
## Summary

Fixes elastic#175298

Improve synthetics alerting !!

User will be able to create custom synthetics status alert by defining
three kind of criteria

### Monitor is down over last consective checks with threshold

<img width="639" alt="image"
src="https://github.com/elastic/kibana/assets/3505601/390da238-f7f2-4eb0-9606-3279b3199fdf">

### From Locations threshold

Will be considered down only when from defined number of locations

<img width="618" alt="image"
src="https://github.com/elastic/kibana/assets/3505601/24741a10-0880-4247-9048-8ce03df25bf5">

### Over time with checks threshold just like uptime custom status alert

<img width="631" alt="image"
src="https://github.com/elastic/kibana/assets/3505601/64e1c808-8d4b-4dd0-b794-eb7f4e5d1e6b">

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Dominique Clarke <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Maryam Saeidi <[email protected]>
Co-authored-by: Justin Kambic <[email protected]>
(cherry picked from commit 82d0b00)

# Conflicts:
#	.github/CODEOWNERS
#	x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/alerts/query_bar.tsx
shahzad31 added a commit that referenced this pull request Oct 2, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Synthetics] Improve synthetics alerting
(#186585)](#186585)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Shahzad","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-01T16:48:39Z","message":"[Synthetics]
Improve synthetics alerting (#186585)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/175298\r\n\r\nImprove
synthetics alerting !!\r\n\r\nUser will be able to create custom
synthetics status alert by defining\r\nthree kind of criteria\r\n\r\n###
Monitor is down over last consective checks with threshold\r\n\r\n<img
width=\"639\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/3505601/390da238-f7f2-4eb0-9606-3279b3199fdf\">\r\n\r\n###
From Locations threshold\r\n\r\nWill be considered down only when from
defined number of locations\r\n\r\n<img width=\"618\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/3505601/24741a10-0880-4247-9048-8ce03df25bf5\">\r\n\r\n\r\n###
Over time with checks threshold just like uptime custom status
alert\r\n\r\n<img width=\"631\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/3505601/64e1c808-8d4b-4dd0-b794-eb7f4e5d1e6b\">\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>\r\nCo-authored-by:
Dominique Clarke <[email protected]>\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by: Maryam
Saeidi <[email protected]>\r\nCo-authored-by: Justin Kambic
<[email protected]>","sha":"82d0b008cdc4f9bcfe3bc858b15d6d30e91fed89","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","release_note:feature","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management"],"number":186585,"url":"https://github.com/elastic/kibana/pull/186585","mergeCommit":{"message":"[Synthetics]
Improve synthetics alerting (#186585)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/175298\r\n\r\nImprove
synthetics alerting !!\r\n\r\nUser will be able to create custom
synthetics status alert by defining\r\nthree kind of criteria\r\n\r\n###
Monitor is down over last consective checks with threshold\r\n\r\n<img
width=\"639\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/3505601/390da238-f7f2-4eb0-9606-3279b3199fdf\">\r\n\r\n###
From Locations threshold\r\n\r\nWill be considered down only when from
defined number of locations\r\n\r\n<img width=\"618\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/3505601/24741a10-0880-4247-9048-8ce03df25bf5\">\r\n\r\n\r\n###
Over time with checks threshold just like uptime custom status
alert\r\n\r\n<img width=\"631\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/3505601/64e1c808-8d4b-4dd0-b794-eb7f4e5d1e6b\">\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>\r\nCo-authored-by:
Dominique Clarke <[email protected]>\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by: Maryam
Saeidi <[email protected]>\r\nCo-authored-by: Justin Kambic
<[email protected]>","sha":"82d0b008cdc4f9bcfe3bc858b15d6d30e91fed89"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/186585","number":186585,"mergeCommit":{"message":"[Synthetics]
Improve synthetics alerting (#186585)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/175298\r\n\r\nImprove
synthetics alerting !!\r\n\r\nUser will be able to create custom
synthetics status alert by defining\r\nthree kind of criteria\r\n\r\n###
Monitor is down over last consective checks with threshold\r\n\r\n<img
width=\"639\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/3505601/390da238-f7f2-4eb0-9606-3279b3199fdf\">\r\n\r\n###
From Locations threshold\r\n\r\nWill be considered down only when from
defined number of locations\r\n\r\n<img width=\"618\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/3505601/24741a10-0880-4247-9048-8ce03df25bf5\">\r\n\r\n\r\n###
Over time with checks threshold just like uptime custom status
alert\r\n\r\n<img width=\"631\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/3505601/64e1c808-8d4b-4dd0-b794-eb7f4e5d1e6b\">\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>\r\nCo-authored-by:
Dominique Clarke <[email protected]>\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by: Maryam
Saeidi <[email protected]>\r\nCo-authored-by: Justin Kambic
<[email protected]>","sha":"82d0b008cdc4f9bcfe3bc858b15d6d30e91fed89"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) ci:project-deploy-observability Create an Observability project release_note:enhancement release_note:feature Makes this part of the condensed release notes Team:obs-ux-management Observability Management User Experience Team v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please bring back the option to create segregated synthetic alert rules for each of our synthetic monitors.