Your window into the Elastic Stack
Find a file
Frank Hassanabad a8823102c2
[Security Solutions] Adds bsearch service to FTR e2e tests to reduce flake, boilerplate, and technique choices (#116211) (#116500)
## Summary

Fixes flake tests of:
https://github.com/elastic/kibana/issues/115918
https://github.com/elastic/kibana/issues/103273
https://github.com/elastic/kibana/issues/108640
https://github.com/elastic/kibana/issues/109447
https://github.com/elastic/kibana/issues/100630
https://github.com/elastic/kibana/issues/94535
https://github.com/elastic/kibana/issues/104260

Security solution has been using `bsearch` and has encountered flake in various forms. Different developers have been fixing the flake in a few odd ways (myself included) which aren't 100%. This PR introduces a once-in-for-all REST API retry service called `bsearch` which will query `bsearch` and if `bsearch` is not completed because of async occurring due to slower CI runtimes it will continuously call into the `bsearch` with the correct API to ensure it gets a complete response before returning.

## Usage

Anyone can use this service like so:
```ts
const bsearch = getService('bsearch');
const response = await bsearch.send<MyType>({
 supertest,
 options: {
   defaultIndex: ['large_volume_dns_data'],
}
  strategy: 'securitySolutionSearchStrategy',
});
```

If you're using a custom auth then you can set that beforehand like so:
```ts
const bsearch = getService('bsearch');
const supertestWithoutAuth = getService('supertestWithoutAuth');
const supertest supertestWithoutAuth.auth(username, password);
const response = await bsearch.send<MyType>({
 supertest,
 options: {
   defaultIndex: ['large_volume_dns_data'],
  }
  strategy: 'securitySolutionSearchStrategy',
});
```

## Misconceptions in the tests leading to flake
* Can you just call the bsearch REST API and it will always return data first time? Not always true, as when CI slows down or data increases `bsearch` will give you back an async reference and then your test will blow up.
* Can we wrap the REST API in `retry` to fix the flake? Not always but mostly true, as when CI slows down or data increases `bsearch` could return the async version continuously which could then fail your test. It's also tedious to tell everyone in code reviews to wrap everything in `retry` instead of just fixing it with a service as well as inform new people why we are constantly wrapping these tests in `retry`.
* Can we manually parse the `bsearch` if it has `async` for each test? This is true but is error prone and I did this for one test and it's ugly and I had issues as I have to wrap 2 things in `retry` and test several conditions. Also it's harder for people to read the tests rather than just reading there is a service call. Also people in code reviews missed where I had bugs with it. Also lots of boiler plate.
* Can we just increase the timeout with `wait_for_completion_timeout` and the tests will pass for sure then? Not true today but maybe true later, as this hasn't been added as plumbing yet. See this [open ticket](https://github.com/elastic/kibana/issues/107241). Even if it is and we increase the timeout to a very large number bsearch might return with an `async` or you might want to test the `async` path. Either way, if/when we add the ability we can increase it within 1 spot which is this service for everyone rather than going to each individual test to add it. If/when it's added if people don't use the bsearch service we can remove it later if we find this is deterministic enough and no one wants to test bsearch features with their strategies down the road.

## Manual test of bsearch service
If you want to manually watch the bsearch operate as if the CI system is running slow or to cause an `async` manually you manually modify this setting here:
https://github.com/elastic/kibana/blob/master/src/plugins/data/server/search/strategies/ese_search/request_utils.ts#L61

To be of a lower number such as `1ms` and then you will see it enter the `async` code within `bsearch` consistently

## Reference PRs
We cannot set the wait_for_complete just yet
https://github.com/elastic/kibana/issues/107241 so we decided this was the best way to reduce flake for testing for now.

### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios

# Conflicts:
#	x-pack/test/api_integration/apis/security_solution/hosts.ts
2021-10-27 23:57:22 +01:00
.buildkite adds lists plugin to security solution cypress tests execution (#116442) (#116494) 2021-10-27 23:42:10 +01:00
.ci [7.16] chore(NA): generic config changes for renaming 7.x into 7.16 (#115779) 2021-10-20 10:00:44 -07:00
.github/ISSUE_TEMPLATE Improve APM issue template (#109561) (#109778) 2021-08-24 04:03:21 -04:00
api_docs Rename apm-generator to apm-synthtrace (#116075) (#116420) 2021-10-27 13:29:28 +01:00
config [7.x] Bump node to 16.11.1 (#115298) 2021-10-16 16:22:17 -05:00
dev_docs Update kibana_platform_plugin_intro with more details on packages vs plugins (#114713) (#114882) 2021-10-13 20:30:34 +00:00
docs [DOCS] Fixes monitoring setting (#116309) (#116486) 2021-10-27 14:52:19 -04:00
examples Replace EuiCodeEditor with CodeEditor in app-services code (#114316) (#114793) 2021-10-13 11:25:07 -04:00
licenses [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
packages Rename apm-generator to apm-synthtrace (#116075) (#116420) 2021-10-27 13:29:28 +01:00
plugins [7.x] [dev/cli] ensure plugins/ and all watch source dirs exist (#78973) (#78998) 2020-09-30 11:53:12 -07:00
rfcs v2 migration algorithm docs for rewriting saved object id's (#93002) (#109472) 2021-08-20 10:37:44 -04:00
scripts [7.x] Remove securityOss plugin (#113946) (#114322) 2021-10-07 16:45:09 -04:00
src Unskip migrations actions integration tests (#116285) (#116477) 2021-10-27 20:44:16 +01:00
test [Security Solutions] Adds bsearch service to FTR e2e tests to reduce flake, boilerplate, and technique choices (#116211) (#116500) 2021-10-27 23:57:22 +01:00
typings [Fix] Replace Osquery query parser lib (#113425) (#113467) 2021-09-29 16:34:45 -04:00
vars adds lists plugin to security solution cypress tests execution (#116442) (#116494) 2021-10-27 23:42:10 +01:00
x-pack [Security Solutions] Adds bsearch service to FTR e2e tests to reduce flake, boilerplate, and technique choices (#116211) (#116500) 2021-10-27 23:57:22 +01:00
.backportrc.json chore(NA): adds backport config for 8.1.0 bump (#116431) (#116499) 2021-10-27 16:35:43 -04:00
.bazelignore chore(NA): stop grouping bazel out symlink folders (#96066) (#96085) 2021-04-01 17:34:54 -04:00
.bazeliskversion Development and build support for ARM based Apple devices (#114879) (#115663) 2021-10-19 20:34:47 -04:00
.bazelrc [bazel] Remove Bazel cache for now (#116351) (#116355) 2021-10-26 12:08:02 -07:00
.bazelrc.common [ci] Disable Bazel cache on CI (#115428) (#115660) 2021-10-20 02:53:07 +01:00
.bazelversion Development and build support for ARM based Apple devices (#114879) (#115663) 2021-10-19 20:34:47 -04:00
.browserslistrc [7.x] [browserslist] remove unnecessary browsers (#89186) (#89250) 2021-01-25 18:22:34 -07:00
.editorconfig .editorconfig MDX files should follow the same rules as MD (#96942) (#97079) 2021-04-14 05:34:57 -04:00
.eslintignore [kbn/ui-shared-deps] split into two packages (#110558) (#112475) 2021-09-16 18:02:17 -04:00
.eslintrc.js [kibanaUtils] Don't import full semver client side (#114986) (#115343) 2021-10-18 10:32:38 -04:00
.fossa.yml Adds FOSSA CLI configuration file (#70137) (#70614) 2020-07-02 14:53:42 -07:00
.gitattributes [7.x] [canvas] Color fixes + Storybook 5 (#34075) (#34369) 2019-04-02 16:35:28 -05:00
.gitignore [build] Add cloud docker images (#107949) (#111818) 2021-09-10 00:13:19 -04:00
.i18nrc.json [MetricVis] Move the expression function and renderer to a separate plugin. (#113427) (#114384) 2021-10-08 04:28:29 -04:00
.node-version [7.x] Bump node to 16.11.1 (#115298) 2021-10-16 16:22:17 -05:00
.npmrc chore(NA): assure puppeteer_skip_chromium_download is applied across every yarn install situation (#88346) (#88379) 2021-01-14 20:32:48 +00:00
.nvmrc [7.x] Bump node to 16.11.1 (#115298) 2021-10-16 16:22:17 -05:00
.prettierignore [7.x] [dev] Replace sass-lint with stylelint (#86177) (#88498) 2021-01-15 14:36:34 -06:00
.prettierrc Increase prettier line width to 100 (#20535) 2018-07-09 22:50:37 +02:00
.stylelintignore chore(NA): stop grouping bazel out symlink folders (#96066) (#96085) 2021-04-01 17:34:54 -04:00
.stylelintrc Amsterdam helpers (#93701) (#94323) 2021-03-10 13:36:11 -05:00
.telemetryrc.json [Usage collection] Collect non-default kibana configs (#97368) (#97653) 2021-04-20 13:04:54 -04:00
.yarnrc chore(NA): manage npm dependencies within bazel (#92864) (#93474) 2021-03-03 15:21:20 -05:00
api-documenter.json Normalize EOL symbol in platform docs (#56021) (#56041) 2020-01-27 21:04:26 +01:00
BUILD.bazel [build_ts_refs] improve caches, allow building a subset of projects (#107981) (#108139) 2021-08-11 05:08:54 -04:00
CONTRIBUTING.md Update doc slugs to improve analytic tracking, move to appropriate folders (#113630) (#113862) 2021-10-04 20:43:23 -04:00
FAQ.md propose language changes (#10709) 2017-03-05 12:10:32 -05:00
github_checks_reporter.json implementing github checks - second attempt (#35757) (#35906) 2019-05-01 19:53:02 -05:00
Jenkinsfile [CI] Disable tracked branch jobs in Jenkins, enable reporting in Buildkite (#112604) (#112684) 2021-09-21 13:57:58 -04:00
jest.config.integration.js chore(NA): introduce preset for jest-integration tests on @kbn/test (#105144) (#105667) 2021-07-14 22:05:07 +00:00
jest.config.js [Canvas] Expression tagcloud (#108036) (#109627) 2021-08-23 09:58:32 -04:00
kibana.d.ts [7.x] Remove /src/legacy (#95510) (#96283) 2021-04-06 06:08:31 -04:00
LICENSE.txt [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
NOTICE.txt [Detections] Adds automatic updating for Prebuilt Security Detection Rules package (#101846) (#103366) 2021-06-28 17:13:25 +00:00
package.json Rename apm-generator to apm-synthtrace (#116075) (#116420) 2021-10-27 13:29:28 +01:00
preinstall_check.js [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
README.md STYLEGUIDE reference .md => .mdx (#107440) (#107456) 2021-08-02 15:17:17 -04:00
STYLEGUIDE.mdx Update doc slugs to improve analytic tracking, move to appropriate folders (#113630) (#113862) 2021-10-04 20:43:23 -04:00
tsconfig.base.json Adds missing DOM.Iterable (#115218) (#115419) 2021-10-18 19:52:42 +00:00
tsconfig.bazel.json [build_ts_refs] improve caches, allow building a subset of projects (#107981) (#108139) 2021-08-11 05:08:54 -04:00
tsconfig.browser.json Introduce TS incremental builds & move src/test_utils to TS project (#76082) (#76632) 2020-09-03 23:02:05 +02:00
tsconfig.browser_bazel.json [build_ts_refs] improve caches, allow building a subset of projects (#107981) (#108139) 2021-08-11 05:08:54 -04:00
tsconfig.json [build_ts_refs] improve caches, allow building a subset of projects (#107981) (#108139) 2021-08-11 05:08:54 -04:00
tsconfig.types.json [build_ts_refs] improve caches, allow building a subset of projects (#107981) (#108139) 2021-08-11 05:08:54 -04:00
TYPESCRIPT.md [7.x] Fixed grammar (#74725) (#74745) 2020-08-11 13:21:03 -04:00
WORKSPACE.bazel Development and build support for ARM based Apple devices (#114879) (#115663) 2021-10-19 20:34:47 -04:00
yarn.lock Rename apm-generator to apm-synthtrace (#116075) (#116420) 2021-10-27 13:29:28 +01:00

Kibana

Kibana is your window into the Elastic Stack. Specifically, it's a browser-based analytics and search dashboard for Elasticsearch.

Getting Started

If you just want to try Kibana out, check out the Elastic Stack Getting Started Page to give it a whirl.

If you're interested in diving a bit deeper and getting a taste of Kibana's capabilities, head over to the Kibana Getting Started Page.

Using a Kibana Release

If you want to use a Kibana release in production, give it a test run, or just play around:

Building and Running Kibana, and/or Contributing Code

You might want to build Kibana locally to contribute some code, test out the latest features, or try out an open PR:

Documentation

Visit Elastic.co for the full Kibana documentation.

For information about building the documentation, see the README in elastic/docs.

Version Compatibility with Elasticsearch

Ideally, you should be running Elasticsearch and Kibana with matching version numbers. If your Elasticsearch has an older version number or a newer major number than Kibana, then Kibana will fail to run. If Elasticsearch has a newer minor or patch number than Kibana, then the Kibana Server will log a warning.

Note: The version numbers below are only examples, meant to illustrate the relationships between different types of version numbers.

Situation Example Kibana version Example ES version Outcome
Versions are the same. 5.1.2 5.1.2 💚 OK
ES patch number is newer. 5.1.2 5.1.5 ⚠️ Logged warning
ES minor number is newer. 5.1.2 5.5.0 ⚠️ Logged warning
ES major number is newer. 5.1.2 6.0.0 🚫 Fatal error
ES patch number is older. 5.1.2 5.1.0 ⚠️ Logged warning
ES minor number is older. 5.1.2 5.0.0 🚫 Fatal error
ES major number is older. 5.1.2 4.0.0 🚫 Fatal error

Questions? Problems? Suggestions?

  • If you've found a bug or want to request a feature, please create a GitHub Issue. Please check to make sure someone else hasn't already created an issue for the same topic.
  • Need help using Kibana? Ask away on our Kibana Discuss Forum and a fellow community member or Elastic engineer will be glad to help you out.