Commit graph

12591 commits

Author SHA1 Message Date
Daniil bb023c5c1c
[TSVB] Custom renderer (#83554)
* Implement custom renderer

* Remove legacy code

* Use custom expression

* Convert to typescript

* Remove savedObjectId extra param

* Other updates

* Fix types

* Cleanup

* Fix functional tests

* Bind uiSettings

* Update snapshot

* Update types

* Remove extra params

* Move common types

* Return back validation error message

* Use panel types enum

* Fix types

* Lazy load visualizations
2020-11-23 19:41:26 +03:00
Alejandro Fernández Gómez 378d89b5cd
[Logs UI] Allow custom columns in the <LogStream /> component (#83802) 2020-11-23 17:30:02 +01:00
Alejandro Fernández Gómez 10afcf032f
[Logs UI] wrap lines inside <LogStream /> (#83449)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 17:07:54 +01:00
Matthew Kime fd9f504e3b
[Index patterns] Remove field cache (#82223) 2020-11-23 09:52:25 -06:00
Gidi Meir Morris 348f6b6500
Prevents errors in Action and Alert Type UIs from cascading through Alerts Management (#83925)
This PR wraps the components injected by Alert Type and Action in `EuiErrorBoundary` components, which ensures you can still edit the Alert and other Actions when these components fail.
2020-11-23 15:38:42 +00:00
Frank Hassanabad 24c7b2d2f8
Adds safe guards against in-determinism by checking list items after uploads (#84015)
## Summary

Fixes flakey tests by adding explicit list value upload items through either the fixture that was uploaded or by a specific test value in case the uploaded list is a range value. Also filters out any empty values for more safeguards from prettier formatters that add them to fixture files.

https://github.com/elastic/kibana/issues/84014

### 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
2020-11-23 08:13:55 -07:00
Tiago Costa 0a0672f15a
skip flaky suite (#81668) 2020-11-23 15:08:52 +00:00
Thom Heymann 7d929fe903
Allow predefined ids for encrypted saved objects (#83482)
* Allow predefined ids for encrypted saved objects

* Fix mock

* fix tests

* Added suggestions from code review

* added jsdocs params

* Fixed jsdocs
2020-11-23 14:53:35 +00:00
Kevin Logan d51437e891
change ingest manager text to Fleet (#83991)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 09:51:39 -05:00
Shahzad 22fb0005a1
[Uptime] Add ts support for es queries aggs (#83331)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 14:38:59 +01:00
Jason Stoltzfus 26e9dbf06a
[App Search] Added the Document Detail View (#83564) 2020-11-23 08:38:43 -05:00
Sandra Gonzales 4e9afeebd5
[Fleet] index patterns to handle uploaded packages (#83994)
* fix index patterns, remove install_source from cache key, add missing test file

* remove unused function

* fix types

* fix comment

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 08:29:13 -05:00
Nathan L Smith c15ab563af
Add search bar and fix layout on service node metrics (#83945) 2020-11-23 14:27:21 +01:00
Shahzad ea4ff59448
[UX]Page load chart breakdown tooltip formatting (#83627)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 14:02:45 +01:00
Mikhail Shustov 95861a0fb0
[DX] Prettier v2.2 (#83899)
* update prettier with ts version support

* mute type-error

* run prettier on codebase

* fix examples

* fix errors after master merged
2020-11-23 13:17:05 +01:00
Alejandro Fernández Haro df4f4758fa
Remove the parameter timestamp in /api/telemetry/v2/clusters/_stats (#83791)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 12:09:16 +00:00
Joe Reuter ade7278cf2
[Lens] Add unit tests for format_column expression function (#83424) 2020-11-23 13:03:23 +01:00
Cauê Marcondes ac73b6a5b4
[Observability] Load hasData call asynchronously (#80644)
* obs perf

* fixing unit tests

* fixing ts issues

* fixing empty state

* addressing pr comments

* addressing pr comments

* fixing TS issue

* fixing some stuff

* refactoring

* fixing ts issues and unit tests

* addressing PR comments

* fixing TS issues

* fixing eslint issue

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 11:58:49 +01:00
Aleh Zasypkin e3ca8a928d
Implement AnonymousAuthenticationProvider. (#79985) 2020-11-23 11:41:08 +01:00
Uladzislau Lasitsa 197b9dd582
Deprecate visualization:colorMapping advanced setting (#83372)
* Added deprecation for visualization:colorMapping

* Update text of deprecation

* Update message

* Delete from translations for re-translation

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 13:00:08 +03:00
Tiago Costa d7cdcf61c7
Revert "[Search] Search batching using bfetch (#83418)" (#84037)
This reverts commit 5708c5d004.
2020-11-23 01:22:34 +00:00
Tiago Costa 9fcf1f0664
skip flaky suite (#83772) 2020-11-22 22:58:39 +00:00
Tiago Costa 152819f9ed
skip flaky suite (#69849) 2020-11-22 22:51:31 +00:00
Liza Katz 5708c5d004
[Search] Search batching using bfetch (#83418)
* Use bfetch for search (no abort behavior)

* fix merge

* Handle request abortion + unit tests

* fix jest

* shim totals in oss

* proper formatting for errors

* jest, types and docs

* Fix doc

* Remove old search code and rename UI Setting

* jest mocks

* jest

* Solve unhanled error

* Use AbortSignal

* ts

* code review - use abort controller instead of observable

* Revert "Remove old search code and rename UI Setting"

This reverts commit 17de9fa257.

* Remove old search code and rename UI Setting

* revert search route

* fix event unsubscribe

* code review 2

* revert filter

* simplify batch done logic

* code review

* filter items in the beginning

* jest

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-22 17:13:08 +02:00
Patryk Kopyciński 59053d569d
[Security Solution] Refactor Timeline flyout to take a full page (#82033) 2020-11-22 13:35:06 +01:00
Thomas Watson 90658d5ccb
Drop use of console-stamp (#83922) 2020-11-22 11:14:57 +01:00
Tiago Costa b321e0134a
skip flaky suite (#84011 , #84012) 2020-11-22 01:44:29 +00:00
Yuliia Naumenko 3ee6e476ee
Fixed usage of isReady for usage collection of alerts and actions (#83760)
* Fixed usage of `isReady` for usage collection of alerts and actions

* fixed index

* fixed due to comments

* fixed type check

* fixed due to comments
2020-11-20 20:27:03 -08:00
Nathan Reese 658ecb6c8a
[maps] support URL drilldowns (#83732)
* url drilldowns

* onSingleValueTrigger

* cleanup

* tslint

* revert changes to ui_actions_service

* remove unused method added to es_tooltip_property

* remove unused file

* update drilldown docs to reflect maps supports URL drilldowns

* add functional test case for URL drilldown

* do not show URL drilldowns in geometry filter action selection

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-20 15:35:55 -07:00
Brian Seeders 21995e6c5f
Revert "Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. (#83226)"
This reverts commit f79188aace.
2020-11-20 17:22:06 -05:00
Yuliia Naumenko f79188aace
Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. (#83226)
* Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. Set default savedObjectId as  {{alertInstanceId}} for ServiceNow, Resilient and Jira

* fixed comment

* fixed due to comments

* fixed doc

* fixed due to comments
2020-11-20 13:04:33 -08:00
Dan Panzarella 2cd2528ac8
[Security Solution] Give notice when endpoint policy is out of date (#83469) 2020-11-20 15:21:23 -05:00
Kevin Qualters a11f70f9bb
[Security Solution] Sync url state on any changes to query string (#83314) 2020-11-20 14:56:20 -05:00
Brian Seeders 314e40fba3
[CI] Initial TeamCity implementation (#81043) 2020-11-20 14:32:53 -05:00
Frank Hassanabad 5f4c211ea3
[Security Solutions][Detection Engine] Adds e2e FTR runtime support and 213 tests for exception lists (#83764)
## Summary

Adds support to the end to end (e2e) functional test runner (FTR) support for rule runtime tests as well as 213 tests for the exception lists which include value based lists. Previously we had limited runtime support, but as I scaled up runtime tests from 5 to 200+ I noticed in a lot of areas we had to use improved techniques for determinism.

The runtime support being added is our next step of tests. Up to now most of our e2e FTR tests have been structural testing of REST and API integration tests. Basically up to now 95% tests are API structural as:

* Call REST input related to a rule such as GET/PUT/POST/PATCH/DELETE.
* Check REST output of the rule, did it match expected output body and status code?
* In some rare cases we check if the the rule can be executed and we get a status of 'succeeded'

With only a small part of our tests ~5%, `generating_signals.ts` was checking the signals being produced. However, we cannot have confidence in runtime based tests until the structural tests have been built up and run through the weeks against PR's to ensure that those are stable and deterministic.

Now that we have confidence and 90%+ coverage of the structural REST based tests, we are building up newer sets of tests which allow us to do runtime based validation tests to increase confidence that:

* Detection engine produces signals as expected
* Structure of the signals are as expected, including signal on signals
* Exceptions to signals are working as expected
* Most runtime bugs can be TDD'ed with e2e FTR's and regressions
* Whack-a-mole will not happen
* Consistency and predictability of signals is validated
* Refactoring can occur with stronger confidence
* Runtime tests are reference points for answering questions about existing bugs or adding new ones to test if users are experiencing unexpected behaviors  
* Scaling tests can happen without failures
* Velocity for creating tests increases as the utilities and examples increase

Lastly, this puts us within striking distance of creating FTR's for different common class of runtime situations such as:
* Creating tests that exercise each rule against a set of data criteria and get signal hits
* Creating tests that validate the rule overrides operate as expected against data sets
* Creating tests that validate malfunctions, corner cases, or misuse cases such as data sets that are _all_ arrays or data sets that put numbers as strings or throws in an expected `null` instead of a value. 

These tests follow the pattern of:
* Add the smallest data set to a folder in data.json (not gzip format)
* Add the smallest mapping to that folder (mapping.json) 
* Call REST input related to exception lists, value lists, adding prepackaged rules, etc...
* Call REST input related endpoint with utilities to create and activate the rule
* Wait for the rule to go into the `succeeded` phase
* Wait for the N exact signals specific to that rule to be available
* Check against the set of signals to ensure that the matches are exactly as expected 

Example of one runtime test:

A keyword data set is added to a folder called "keyword" but you can add one anywhere you want under `es_archives`, I just grouped mine depending on the situation of the runtime. Small non-gzipped tests `data.json` and `mappings.json` are the best approach for small focused tests. For _larger_ tests and cases I would and sometimes do use things such as auditbeat but try to avoid using larger data sets in favor of smaller focused test cases to validate the runtime is operating as expected.

```ts
{
  "type": "doc",
  "value": {
    "id": "1",
    "index": "long",
    "source": {
      "@timestamp": "2020-10-28T05:00:53.000Z",
      "long": 1
    },
    "type": "_doc"
  }
}

{
  "type": "doc",
  "value": {
    "id": "2",
    "index": "long",
    "source": {
      "@timestamp": "2020-10-28T05:01:53.000Z",
      "long": 2
    },
    "type": "_doc"
  }
}

{
  "type": "doc",
  "value": {
    "id": "3",
    "index": "long",
    "source": {
      "@timestamp": "2020-10-28T05:02:53.000Z",
      "long": 3
    },
    "type": "_doc"
  }
}

{
  "type": "doc",
  "value": {
    "id": "4",
    "index": "long",
    "source": {
      "@timestamp": "2020-10-28T05:03:53.000Z",
      "long": 4
    },
    "type": "_doc"
  }
}
```

Mapping is added. Note that this is "ECS tolerant" but not necessarily all ECS meaning I can and will try to keep things simple where I can, but I have ensured that  `"@timestamp"` is at least there.

```ts
{
  "type": "index",
  "value": {
    "index": "long",
    "mappings": {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "long": { "type": "long" }
      }
    },
    "settings": {
      "index": {
        "number_of_replicas": "1",
        "number_of_shards": "1"
      }
    }
  }
}
```

Test is written with test utilities where the `beforeEach` and `afterEach` try and clean up the indexes and load/unload the archives to keep one test from effecting another. Note this is never going to be 100% possible so see below on how we add more determinism in case something escapes the sandbox. 
```ts
    beforeEach(async () => {
      await createSignalsIndex(supertest);
      await createListsIndex(supertest);
      await esArchiver.load('rule_exceptions/keyword');
    });

    afterEach(async () => {
      await deleteSignalsIndex(supertest);
      await deleteAllAlerts(supertest);
      await deleteAllExceptions(es);
      await deleteListsIndex(supertest);
      await esArchiver.unload('rule_exceptions/keyword');
    });

    describe('"is" operator', () => {
      it('should filter 1 single keyword if it is set as an exception', async () => {
        const rule = getRuleForSignalTesting(['keyword']);
        const { id } = await createRuleWithExceptionEntries(supertest, rule, [
          [
            {
              field: 'keyword',
              operator: 'included',
              type: 'match',
              value: 'word one',
            },
          ],
        ]);
        await waitForRuleSuccess(supertest, id);
        await waitForSignalsToBePresent(supertest, 3, [id]);
        const signalsOpen = await getSignalsById(supertest, id);
        const hits = signalsOpen.hits.hits.map((hit) => hit._source.keyword).sort();
        expect(hits).to.eql(['word four', 'word three', 'word two']);
      });
   });
```

### Changes for better determinism
To support more determinism there are changes and utilities added which can be tuned during any sporadic failures we might encounter as well as better support unexpected changes to other Elastic Stack pieces such as alerting, task manager, etc...

Get simple rule and others are now defaulting to false, meaning that the structural tests will no longer activate a rule and run it on task manger. This should cut down on error outputs as well as reduce stress and potentials for left over rules interfering with the runtime rules. 
```ts
export const getSimpleRule = (ruleId = 'rule-1', enabled = false): QueryCreateSchema => ({
```

Not mandatory to use, but for most tests that should be runtime based tests, I use this function below which will enable it by default and run it using settings such as `type: 'query'`, `query: '*:*',` `from: '1900-01-01T00:00:00.000Z'`, to cut down on boiler plate noise. However, people can use whatever they want out of the grab bag or if their test is more readable to hand craft a REST request to create signals, or if they just want to call this and override where they want to, then 👍 .
 ```ts
export const getRuleForSignalTesting = (index: string[], ruleId = 'rule-1', enabled = true)
```

This waits for a rule to succeed before continuing
```ts
await waitForRuleSuccess(supertest, id);
```

I added a required array of id that _waits_ only for that particular id here. This is useful in case another test did not cleanup and you are getting signals being produced or left behind but need to wait specifically for yours.
```ts
await waitForSignalsToBePresent(supertest, 4, [id]);
```

I only get the signals for a particular rule id using either the auto-generated id or the rule_id. It's safer to use the ones from the auto-generated id but either of these are fine if you're careful enough. 
```ts
const signalsOpen = await getSignalsById(supertest, id);
const signalsOpen = await getSignalsByIds(supertest, [createdId]);
const signalsOpen = await getSignalsByRuleIds(supertest, ['signal-on-signal']);
```

I delete all alerts now through a series of steps where it properly removes all rules using the rules bulk_delete and does it in such a way that all the API keys and alerting will be the best it can destroyed as well as double check that the alerts are showing up as being cleaned up before continuing.
```ts
deleteAllAlerts()
```

When not explicitly testing something structural, prefer to use the utilities which can and will do retries in case there are over the wire failures or es failures. Examples are:
```ts
installPrePackagedRules()
waitForRuleSuccess()
importFile() // This does a _lot_ of checks to ensure that the file is fully imported before continuing
```

Some of these utilities might still do a `expect(200);` but as we are and should use regular structural tests to cover those problems, these will probably be more and more removed when/if we hit test failures in favor of doing retries, waitFor, and countDowns.

### Checklist

Delete any items that are not applicable to this PR.

- [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-11-20 12:09:38 -07:00
Christos Nasikas 52c6b7b81b
[Security Solution][Case] Create comment types (#82715) 2020-11-20 21:03:05 +02:00
Zacqary Adam Xeper 9e084f389c
[Metrics UI] Implement Resolved action group in Metrics alerts (#83687)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-20 13:00:57 -06:00
Søren Louv-Jansen a703524853
[APM] Only fetch custom links for users with a valid license (#83836)
* [APM] Only fetch custom links when user has valid license

* Rename more files for consistency

* i18n fixes

* Fix tests

* Addess feedback and minor cleanup

* Fix test (and more cleanup)

* Make cachable
2020-11-20 19:59:30 +01:00
Patrick Mueller 50dbe8f171
[event_log] index event docs in bulk instead of individually (redo) (#83927)
resolves #55634
resolves #65746

Buffers event docs being written for a fixed interval / buffer size,
and indexes those docs via a bulk ES call.

Also now flushing those buffers at plugin stop() time, which
we couldn't do before with the single index calls, which were
run via `setImmediate()`.

This is a redo of PR https://github.com/elastic/kibana/pull/80941 which
had to be reverted.
2020-11-20 13:49:30 -05:00
Jen Huang a8913d30c1
[Fleet] Agent logs UI (#83356)
* Initial agent log table

* Add data and storage services to Kibana context, rename useCore to useStartServices and replace usage of useStartDeps

* Initial attempt at adding query bar for log stream

* Adjust app layout to allow page content to be full height

* Dataset and log level filters, split into smaller files

* Use data plugin's `QueryStringInput` component for query bar

* Add open in Logs UI link

* Clean up unused storage dependency

* Remove agent activity log and related dead code

* Clean up i18n

* Clean up plugin deps, fix routing

* Add back storage dependency that data plugin components need

* Remove dependency on infra for logs UI link

* Change default date range to last one day

* Adjust panel padding

* Add comment

* Move module declarations to top-level x-pack/typings

* Fix missed renaming

* Remove unused path

* Move building of log stream query into separate service with unit tests

* Adjust test conditions
2020-11-20 10:49:02 -08:00
Nathan L Smith 6164d04aa1
Use Elastic Charts for metrics charts (#83863) 2020-11-20 12:43:31 -06:00
Wylie Conlon b50e7ba7da
[Lens] Implement types for reference-based operations (#83603)
* [Lens] Implement types for reference-based operations

* Update from review feedback
2020-11-20 13:42:12 -05:00
Shahzad b6b7897995
[Uptime] Remove apm dep from uptime (#83565)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-20 19:25:02 +01:00
Larry Gregory d1e998fff8
Adjust encoding for security management pages (#83629)
* Adjust encoding for security management pages

* introduce tryDecodeURIComponent
2020-11-20 13:06:59 -05:00
Nathan Reese ac2c16d8e7
[Maps] background color map setting (#83822)
* [Maps] background color map setting

* tslint and jest tests

* get eui theme from kbn/ui-shared-deps/theme
2020-11-20 10:02:36 -07:00
Sandra Gonzales 39291e16b5
[Fleet] update getPackageInfo to handle uploaded packages (#83854)
* update getPackgeInfo handler to fetch from install source

* add tests and modify fixtures  to distinguish between registry and uploaded package

* improve error handling

* fix type

* fix test

* remove try/catch

* fix zip file test to have the right number of assets

* fix compressed files
2020-11-20 11:40:45 -05:00
Robert Oskamp d28897b275
[ML] Functional tests - recognize and setup module tests for heartbeat and auditbeat (#83796)
This PR adds api integration tests to recognize and setup the modules uptime_heartbeat and auditbeat_process_hosts_ecs.
2020-11-20 17:35:21 +01:00
Marshall Main f4e7362b45
[Security Solution][Detections] Prevents recursive EQL rules (#82857)
* Prevents recursive EQL rules

* Remove unused import

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-20 11:22:11 -05:00
Joe Reuter 1c5fc14d1c
simplify time interval checking (#83545) 2020-11-20 17:18:22 +01:00
ymao1 8ca1e93763
[Actions] Microsoft Teams connector (#83169)
* First cut at adding teams connector

* Getting teams connector working

* Unit tests

* Updating docs

* PR comments

* PR comments

* Changing error to debug log

* Fixing imports

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-20 11:14:17 -05:00