Commit graph

35792 commits

Author SHA1 Message Date
Caroline Horn 0e3ba45ea9
Update CODEOWNERS for design (again) (#75801) 2020-08-24 17:03:25 -04:00
spalger 637e87d0fb skip flaky suite (#75794) 2020-08-24 13:52:31 -07:00
spalger 1fbb6e57a1 skip flaky suite (#75697) 2020-08-24 13:46:58 -07:00
spalger 6dbc2f7fd1 skip flaky suite (#75699) 2020-08-24 13:43:09 -07:00
Ryland Herrick 0758df87fc
[Security Solution][Detections] Cleaning up mocks/tests (#74920)
* Simplify our kibana mocks

* Simpler mock factory that returns an object instead of a thunk
  * We can use mockReturnValue instead of mockImplementation to
  accomplish the same
  * Allows us to replace createStartServices mock
* Uses unknown instead of any for mocks

* Clean up our manual use of kibana mocks in tests

* Since our useKibana mock returns a consistent mock, we can modify its
return value instead of re-mocking the entire thing
* Removes unnecessary uses of clearing/resetting mocks
  * If your mocks are configured at the beginning of each test this is
  usually unnecessary.
  * I left one case of clearAllMocks in all_cases/index.test since it
  defined several mock functions that were persistent across tests, and
  it was easier than moving their definitions to a beforeEach
* Removes some unnecessary overrides that seemed due to storage
previously not being mocked

* Rename some old occurrences of SIEM

* Cross-reference similar hooks via JSDoc

There's a good chance that the consumer might want the OTHER hook, so
let's make that discoverable.

* Adds jest tests for our useListsConfig hook

* adds mocks for the hooks upon which it depends

* Add a mock for our useListsConfig hook

Leverages this mock factory in our manual mock for this hook.

* Remove unneeded eslint exception

* Move kibana_react mocks into their own .mock file

We're trying to consolidate mocks to this pattern so that they're easier
to find and reuse.

* Remove intermediate mock factory

This was only being consumed by our general createStartServicesMock.

* Replace security_solution's alias for a core mock

This is just noise/tech debt, we should use the core mock directly when
we can.

* Remove unnecessary wrapper around core mocks

Instead let's just reference the core mocks themselves.

* Remove outdated references from upstream

* More accurate mock

Throw an error of the same type if an unexpected key is used.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 15:38:35 -05:00
Pierre Gayvallet 4e3f47ac62
migrate 'core' ui settings to core (#75544)
* migrate ui settings to core

* add basic test on service

* add unit tests

* adapt buildNum schema

* use any for buildNum...

* move i18n keys to core prefix

* translate added validation messages

* using number for schema for buildNum

* move state:storeInSessionStorage setting to core

* remove overrides config validation

* remove defaultRoute from config schema
2020-08-24 21:39:57 +02:00
gchaps d20c653bb4
[DOCS] Adds redirect for rbac content (#75803) 2020-08-24 11:56:14 -07:00
Frank Hassanabad 9dfcde2cee
Reduces field capabilities event loop block times by scaling linearly using hashes (#75718)
## Summary

On the `security_solution` project from different customers we have been getting reports of scaling issues and excessive NodeJS event blocking times. After in-depth tracing through some of the index and field capabilities calls we identified two of the "hot paths" running through `field_capabilities` to where it is using double looped arrays rather than hashes. By switching these two hot spots out for hashes we are now able to reduce the event loop block times by an order of magnitude. 

Before this PR you can see event loop block times as high as:

```ts
field_cap: 575.131ms
```

And after this PR you will see event loop block times drop by an order of magnitude to:

```ts
field_cap: 31.783ms
```

when you're calling into indexes as large as `filebeat-*`. This number can be higher if you're concatenating several large indexes together trying to get capabilities from each one all at once. We already only call `getFieldCapabilities` with one index at a time to spread out event block times.

The fix is to use a hash within two key areas within these two files:

```ts
src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.ts
src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_caps_response.ts
```

This effect happens during the query of `SourceQuery`/`IndexFields` within `security_solution` but you should be able to trigger it with any application code who calls into those code paths with large index sizes such as `filebeat-*` anywhere in Kibana.

An explanation of how to see the block times for before and after
---

Add, `console.time('field_cap');` and `console.timeEnd('field_cap');` to where the synchronize code is for testing the optimizations of before and after.

For example around lines 45 with the original code:
```ts
  const esFieldCaps: FieldCapsResponse = await callFieldCapsApi(callCluster, indices);
  console.time('field_cap'); // <--- start timer
  const fieldsFromFieldCapsByName = keyBy(readFieldCapsResponse(esFieldCaps), 'name');

  const allFieldsUnsorted = Object.keys(fieldsFromFieldCapsByName)
    .filter((name) => !name.startsWith('_'))
    .concat(metaFields)
    .reduce(concatIfUniq, [] as string[])
    .map<FieldDescriptor>((name) =>
      defaults({}, fieldsFromFieldCapsByName[name], {
        name,
        type: 'string',
        searchable: false,
        aggregatable: false,
        readFromDocValues: false,
      })
    )
    .map(mergeOverrides);

  const sorted = sortBy(allFieldsUnsorted, 'name');
  console.timeEnd('field_cap'); // <--- outputs the end timer
  return sorted;

```

And around lines 45 with this pull request:

```ts
  const esFieldCaps: FieldCapsResponse = await callFieldCapsApi(callCluster, indices);
  console.time('field_cap'); // <--- start timer
  const fieldsFromFieldCapsByName = keyBy(readFieldCapsResponse(esFieldCaps), 'name');

  const allFieldsUnsorted = Object.keys(fieldsFromFieldCapsByName)
    .filter((name) => !name.startsWith('_'))
    .concat(metaFields)
    .reduce<{ names: string[]; hash: Record<string, string> }>(
      (agg, value) => {
        // This is intentionally using a "hash" and a "push" to be highly optimized with very large indexes
        if (agg.hash[value] != null) {
          return agg;
        } else {
          agg.hash[value] = value;
          agg.names.push(value);
          return agg;
        }
      },
      { names: [], hash: {} }
    )
    .names.map<FieldDescriptor>((name) =>
      defaults({}, fieldsFromFieldCapsByName[name], {
        name,
        type: 'string',
        searchable: false,
        aggregatable: false,
        readFromDocValues: false,
      })
    )
    .map(mergeOverrides);

  const sorted = sortBy(allFieldsUnsorted, 'name');
  console.timeEnd('field_cap'); // <--- outputs the end timer
  return sorted;

```

And then reload the security solutions application web page or generically anything that is going to call filebeat-* index or another large index or you could concatenate several indexes together as well to test out the performance. For security solutions we can just visit any page such as this one below which has a filebeat-* index:

```
http://localhost:5601/app/security/timelines/
```

Be sure to load it _twice_ for testing as NodeJS will sometimes report better numbers the second time as it does optimizations after the first time it encounters some code paths.

You should begin to see numbers similar to this in the before:

```ts
field_cap: 575.131ms
```

This indicates that it is blocking the event loop for around half a second before this fix. If an application adds additional indexes on-top of `filebeat`, or if it tries to execute other code after this (which we do in security solutions) then the block times will climb even higher.


However, after this fix, the m^n are changed to use hashing so this only climb by some constant * n where n is your fields and for filebeat-* it will should very low around:

```ts
field_cap: 31.783ms
```

### Checklist

Unit tests already present, so this shouldn't break anything 🤞 .
- [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
2020-08-24 12:12:48 -06:00
Josh Dover c5870589af
Expose overall status to plugins (#75503)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 11:41:47 -06:00
Devon Thomson f495b7def5
Updated and unskipped lens breadcrumb test after #74523 (#75714)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 12:42:11 -04:00
Alejandro Fernández Haro 8fe62c33a5
[Data Telemetry] Rename dataset.* to data_stream.* (#75415)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 17:32:52 +01:00
Thomas Neirynck a3d3abd22d
[Maps] Introduce ILayer#isFittable (#75504) 2020-08-24 12:29:52 -04:00
Alejandro Fernández Haro f49f010d90
[Telemetry] Swallow errors in opt-in remote notification from the server (#75641) 2020-08-24 17:28:19 +01:00
Pierre Gayvallet 9fa43b4e47
avoid error when logging invalid response error (#75757) 2020-08-24 18:25:02 +02:00
Wylie Conlon 3dea4444b9
[Lens] Remove beta labels (#75574)
* [Lens] Remove beta labels

* Remove translations

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 12:07:28 -04:00
Tiago Costa f2f83b0f68
skip flaky suite (#75722) 2020-08-24 17:01:43 +01:00
Melissa Alvarez 33d3f4090a
[ML] DF Analytics list: ensure job messages and jobs load correctly (#75676)
* ensure messages load on first open

* ensure analytics management list does not load infinitely
2020-08-24 11:46:18 -04:00
Stacey Gammon 4ffef0a481
Add asciidoc support for generated plugin list (#72292)
* add asciidoc support for generated plugin list

Try level offset "=+2" instead of "=+1" to stop the inlining of the includes.

remove +2 back to +1

* Remove asciidoc, switch to regex. Rearrange dev guide to avoid nesting limit.

* Add tests for regex

* add a description to not throw off the table. Remove the heading from the paragraph snippet.

* Fix more READMEs so table renders correctly

* Update plugin list

* Remove code-exploration file, moved to plugin-list

* fix typo

* Add link to developer examples

* Update plugin list

* fix typo
2020-08-24 11:31:27 -04:00
Kevin Logan 6f6566310a
[SECURITY_SOLUTION] Host Details Tests need to wait for title component after loading (#75748) 2020-08-24 11:16:18 -04:00
Pete Harverson d5a698475c
[ML] Disable Overview view links for analytics jobs with no results (#75740) 2020-08-24 16:12:19 +01:00
Ahmad Bamieh ec7578c8c3
[Telemetry] schema check throw on missing schema (#75750) 2020-08-24 18:01:17 +03:00
Alexey Antonov 262088208c
Add Timelion deprecation warning to server log (#75541)
* Add Timelion deprecation warning to the migration assistant

Closes: #63014

* fix PR comments

* update message

* fix integration tests

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 17:27:09 +03:00
Mike Côté 4dd0205c11
Add support for decorating and handling 429 errors with the saved objects client (#75664)
* Add support for decorating 429 errors in the saved objects client

* Update the docs

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 10:16:54 -04:00
Sandra Gonzales ed53ca6b46
[Ingest Manager] check for packages stuck installing and reinstall (#75226)
* check for packages stuck installing and reinstall

* update mock endpoint package

* diferentiate between reinstall and reupdate type of install, remove isUpdate, add integration test

* create new EpmPackageInstallStatus type instead of using InstallStatus

* fix merge conflict

* change EpmPackageInstallStatus to a union type

* change time to install to 1 minute

* used saved object find

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 09:42:39 -04:00
Tiago Costa fdc93af824
skip flaky suite (#75721) 2020-08-24 14:34:33 +01:00
Marius Dragomir 7eb02d11aa
Handle change in saml VM name (#73808)
* Handle change in saml VM name

* fix lint problem

* Update login_page.ts

* Fix tslint

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 15:28:25 +02:00
Patryk Kopyciński 65c724808f
[Security Solution] Fix setting the initial Kibana filters (#75215)
* [Security Solution] Fix setting the initial Kibana filters

* add unit test

* keep appState in kibana storage

* fix logic

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 15:25:51 +02:00
MadameSheema 3768aab743
[SIEM] Fixes 'sets and reads the url state for timeline by id' timeline Cypress test (#75125)
* fixes 'sets and reads the url state for timeline by id' timeline ttest

* makes test more reliable

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 14:41:40 +02:00
Vadim Dalecky c6e86cf773
In-chart "Explore underlying data" action telemetry (#74516)
* feat: 🎸 add telemetry for in-chart "Explore underlying data"

* refactor: 💡 use shared Config type from /common folder

* feat: 🎸 register usage collector

* chore: 🤖 upate telemetry schema

* fix: 🐛 use relative import for usage_collector

* fix: 🐛 use relative imports for core

* fix: 🐛 use relative import

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 14:06:57 +02:00
James Gowdy f3799c37f6
[ML] Fixing new population job wizard with saved search (#75731) 2020-08-24 11:43:44 +01:00
Pete Harverson 0f42b1aeb5
[ML] Add date picker back onto index based data visualizer page (#75658)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-24 11:09:02 +01:00
Liza Katz bdb73b55ef
[Search] Cleanup SearchRequest and SearchResponse types (#75471)
* improve test stability

* Replace SearchRequest = any with Record<string, any>

* Remove SearchResponse = any from data plugin

* docs

* logs

* Revert "Replace SearchRequest = any with Record<string, any>"

This reverts commit 9914ab5a01.

* code review

* list control

* null check

* null null null

* Jest fix
2020-08-23 15:34:40 +03:00
Xavier Mouligneau 6dbc4be8f7
[SECURITY SOLUTION] Add our first search strategy for all host query (#75439)
* add security solution search strategy on server side

* get security solution search strategy in the public app for all host

* fix types

* fix Check core API changes

* thank you cypress test

* Remove any by the right type IESearchRequest

Co-authored-by: Lukas Olson <olson.lukas@gmail.com>

* add translation and filter error when we abort the query

* pr review

* fix translation

* review II

* fix merge issue

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Lukas Olson <olson.lukas@gmail.com>
2020-08-22 08:59:14 -04:00
Luke Elmers f7cfceae1c
[@elastic/datemath] Remove build step from datemath package. (#75505)
* Remove build step from datemath.

* Remove outdated docs reference to datemath.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-21 19:27:34 -06:00
CJ Cenizal 50499a589c
Surface data stream stats, index template, and ILM policy in the UI (#75107)
* Add Index Management README and quick testing steps for data streams.
* Surface data stream health in Data Streams tab (table and detail panel).
  - Extract out DataHealth component for use in both Data Streams and Indices tabs.
  - Refactor detail panel to use data structure & algo to build component.
  - Refactor detail panel to use i18n.translate instead of FormattedMessage.
* Render index template name and index lifecycle policy name in the detail panel.
* Render storage size and max timestamp information in table and detail panel.
  - Add 'Include stats' switch.
  - Add humanizeTimeStamp service, localized to data streams.
2020-08-21 17:53:03 -07:00
spalger 19c5ba838a skip suite blocking es snapshot promotion (#75707) 2020-08-21 16:49:36 -07:00
Brian Seeders 6c02dc8e20 skip suite blocking es snapshot promotion (#75707) 2020-08-21 17:58:11 -04:00
Nathan Reese 3df47dc66b
[Maps] convert style classes to TS (#75374)
* [Maps] convert style classes to TS

* convert VectorStyle to TS

* clean up

* revert change to fix unit test

* review feedback

* review feedback

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-21 15:40:07 -06:00
Lukas Olson a4fa73054a
[Search] Change logging level to debug (#74971)
* [Search] Change logging level to debug

* Fix tests
2020-08-21 13:53:41 -07:00
Tim Sullivan e0cea771f3
[Reporting/Fn Test] Re-enable listing of reports tests (#75383)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-21 13:21:16 -07:00
Brian Seeders 8e770ea86e
Skip failing security_solution test 2020-08-21 15:14:58 -04:00
Joe Portner 68dc4e8410
Filter saved object version during legacy import (#75597) 2020-08-21 14:30:25 -04:00
Marta Bondyra 5edba21e30
[Lens] Show 'No data for this field' for empty field in accordion (#73772) 2020-08-21 20:07:19 +02:00
Brian Seeders 6a334c3546
Skip failing lens test 2020-08-21 13:35:18 -04:00
Josh Dover 384213fd49
Configure ScopedHistory consistenty regardless of URL used to mount app (#75074)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-21 11:29:18 -06:00
Alejandro Fernández Haro a9b62a85db
Fix returned payload by "search" usage collector (#75340)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-21 18:18:55 +01:00
Steph Milovic d013eb2f1b
[Security Solution] Fix missing key error (#75576) 2020-08-21 11:02:43 -06:00
Greg Thompson 82e30f6eff
Upgrade EUI to v27.4.1 (#75240)
* eui to 27.4.1

* src snapshot updates

* x-pack snapshot updates

* remove increased default timeout

* revert date change

* delete default_timeout file

* reinstate storyshot

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-21 10:48:04 -06:00
Jen Huang 3031e66806
Update datasets UI copy to data streams (#75618) 2020-08-21 09:16:17 -07:00
Joe Reuter 86f73cb0c2
[Lens] Register saved object references (#74523) 2020-08-21 18:08:25 +02:00