Commit graph

3990 commits

Author SHA1 Message Date
jennypavlova
fec2318ee3
[Infra] Create new formulas for rx and tx metrics (#189281)
Closes #188641

## Summary

This PR adds new formulas for rx and tx metrics for hosts. In inventory
we show the old metrics as legacy and the new ones with the old metrics
labels (this affects only hosts):

<img width="1788" alt="image"
src="https://github.com/user-attachments/assets/d3e5bf26-e521-4ff8-b00b-1d78eebd56f9">

All old alerts should work - The only difference is that it will show
the metric as "Legacy" and it still can be used in the rules. The hosts
view and the lens charts are using a new formula

## Testing
- Check the network metrics in the inventory / alert flyout (both the
new ones and the old ones)
- Check the network metrics and charts in the hosts view (only the new
ones should be available)


https://github.com/user-attachments/assets/886fd5a0-858c-458b-9025-eb55913b1932



https://github.com/user-attachments/assets/7752939f-f693-4021-bf23-89e264ef0c2d

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Carlos Crespo <crespocarlos@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-01 09:51:39 -05:00
Tiago Costa
7902ce7ff6
skip failing artifacts snapshot suites (#189590) 2024-07-31 02:22:03 +01:00
Tiago Costa
c90567a218
skip flaky suite (#189537) 2024-07-31 02:10:25 +01:00
Tiago Costa
8333b4c5af
skip flaky suite (#189565) 2024-07-31 02:05:40 +01:00
Walter Rafelsberger
f391ed6bcf
[ML] AIOps: Update fields filter popover to be able to filter fields from analysis (not just grouping) (#188913)
## Summary

Part of #187684.

So far the popover to filter fields was only available when grouping was
enabled. This PR updates the behavior so it's available all the time and
can be used to exclude field candidates from the analysis. If we detect
the index to be based on an ECS schema, we auto-select a set of
predefined fields.

Changes in this PR:

- Creates a new route
`/internal/aiops/log_rate_analysis/field_candidates` to be able to fetch
field candidates independent of the main streaming API call.
- Fixes the code to consider "remaining" field candidates to also
consider text field candidates. This was originally developed to allow
to continue an analysis that errored for some reason. We use that option
to also pass on the custom field list from the field selection popover.
- Fetching the field candidates is done in a new redux slice
`logRateAnalysisFieldCandidatesSlice` using an async thunk.
- Filters the list of field candidates by a predefined field of allowed
fields when an ECS schema gets detected.
- Renames `fieldCandidates` to `keywordFieldCandidates` for clearer
distinction against `textFieldCandidates`.
- Refactors `getLogRateAnalysisTypeForCounts` args to a config object.
- Bump the API version for the full log rate analysis to version 3. We
missed bumping the version in
https://github.com/elastic/kibana/pull/188648. This update manages
proper versioning between v2 and v3, also the API integration tests
cover both versions.


[aiops-log-rate-analysis-fields-filter-0001.webm](https://github.com/user-attachments/assets/e3ed8d5b-f01c-42ef-8033-caa7135b8cc0)

### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-07-30 10:12:53 +02:00
Alejandro Fernández Haro
11b750b10a
Minimize shared-common everywhere (#188606)
## Summary


![8xfggo](https://github.com/user-attachments/assets/f3d9312f-2ad3-4fa2-9daf-01e2b1ad6cac)

At the moment, our package generator creates all packages with the type
`shared-common`. This means that we cannot enforce boundaries between
server-side-only code and the browser, and vice-versa.

- [x] I started fixing `packages/core/*`
- [x] It took me to fixing `src/core/` type to be identified by the
`plugin` pattern (`public` and `server` directories) vs. a package
(either common, or single-scoped)
- [x] Unsurprisingly, this extended to packages importing core packages
hitting the boundaries eslint rules. And other packages importing the
latter.
- [x] Also a bunch of `common` logic that shouldn't be so _common_ 🙃 

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-29 12:47:46 -06:00
Carlos Crespo
c07595fe00
[Infra] Display friendlier Lens generated error messages (#189099)
closes [#189064](https://github.com/elastic/kibana/issues/189064)

## Summary

This PR changes Lens embeddable to support creating custom error
messages by using the new `customBadgeMessages` prop.

<img width="500px" alt="image"
src="https://github.com/user-attachments/assets/d48d86fa-b4a7-4dd5-ad84-9fe4bf144672">

The custom error message will only be displayed in the context of the
hosts view and asset details, which is where this new prop is being
used. Everywhere else will display the default error handling provided
by Lens

<img width="500px" alt="image"
src="https://github.com/user-attachments/assets/38ecaee9-5f25-4d34-85e4-f176095982c5">


### How to test
- Start a local kibana and es instances
- Run `node scripts/synthtrace infra_hosts_with_apm_hosts --live`
- Change the the index patter in Settings to `metrics-apm`
- Navigate to Infrastructure > Hosts View and open the asset details
flyout
- The missing field message should be displayed as the screenshot above
- Open a chart in lens
  - The default Lens message will be shown

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-29 12:34:02 +02:00
Joe McElroy
1b84a24872
[Search] [Playground] Enable Gemini Connector on ES3 (#189267)
## Summary

Enable Gemini connector on ES3 search projects so playground can use.


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-07-26 07:14:49 -05:00
elena-shostak
3f3713b567
Fixed URL hash appending for space next redirect URL (#189204)
## Summary

Fixed URL hash appending for space next redirect URL.

### 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

__Fixes: https://github.com/elastic/kibana/issues/189184__
2024-07-26 10:40:50 +02:00
Marco Liberati
c47f371471
[Lens][FTR] Fix afterAll issue (#189069)
## Summary

Fixes #189056, #189057, #164623

Bring back the window handler for other tests correctly.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-25 14:48:28 +02:00
Alexey Antonov
631baa336f
fix: [Obs Alert Rules > Rule Detail][KEYBOARD]: N Alerts and N Active Now elems must both be keyboard focsuable (#186529)
Closes: https://github.com/elastic/observability-dev/issues/3371

## Description

The Obs Alert Rule Detail view has a card that is clickable with a
focusable element inside it. This is a confusing paradigm and prevents
keyboard users from filtering by all alerts because it's not focusable.
It would be better to make the two alert number widgets the focusable
elements. Screenshot attached below.

PR is based on the following comment posted by @1Copenut in
https://github.com/elastic/observability-dev/issues/3371#issuecomment-2129446431_

> @alexwizp Agreed, panels should not be focusable. The highlighted
panel is clickable, and that was unexpected. I could click the entire
panel, and click the "1 Active now" text to filter by all alerts or
active alerts in the table below.
> 
> It would be better to have the "All alerts" text be clickable and
focusable, and keep the "1 Active now" clickable and focusable. That way
the two text blocks have the interactive behavior, while the panel
(card) is just a container.

### Steps to recreate

1. Open the [Obs
Alerts](https://keepserverless-qa-oblt-b4ba07.kb.eu-west-1.aws.qa.elastic.cloud/app/observability/alerts)
table
2. Click the "Manage Rules" link
3. Create a new rule and verify it appears in the Rules table
4. Click on the rule name to load the Rule Detail view
6. Verify the `1 Active Now`


### What was done?:
1. The click event was **REMOVED** from the panel and has been moved to
`All alerts.`
2. `aria-describedby` attributes were added for `AllAlertCounts` and
`ActiveAlertCounts`
3. `h3` attributes were replaced to `EuiTitle` in `AllAlertCounts` and
`ActiveAlertCounts`
2024-07-25 12:52:56 +03:00
Kibana Machine
3ef6427a28 skip failing test suite (#164623) 2024-07-24 18:54:06 +02:00
Nick Partridge
49a985625b
Upgrade prettier dependencies (#188032)
## Summary

- Upgrade `prettier` to `v2.8.x`.
- Upgrade related decencies.
- Adds `prettier` group to renovate config.
- Fixes bootstrapping type error.

## Main Changes

### Add parentheses for `TypeofTypeAnnotation` to improve readability

[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-for-typeoftypeannotation-to-improve-readability-14458-by-fisker)

```ts
// Input
type A = (typeof node.children)[];

// Prettier 2.8.4
type A = typeof node.children[];

// Prettier 2.8.5
type A = (typeof node.children)[];
```

### Add parentheses to head of `ExpressionStatement` instead of the
whole statement


[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-to-head-of-expressionstatement-instead-of-the-whole-statement-14077-by-fisker)

```ts
// Input
({}).toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);

// Prettier 2.8.1
({}.toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo));

// Prettier 2.8.2
({}).toString.call(foo.forEach) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);
```

## Details

This started because I noticed we were on `typescript@^5` but still on
an old prettier that complained about use of new TS features such as
[`satisfies`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-24 17:29:05 +01:00
Tiago Costa
7bbc37f42b
skip flaky suite (#189057) 2024-07-24 15:37:48 +01:00
Kibana Machine
c325e3caf2 skip failing test suite (#189056) 2024-07-24 15:00:16 +02:00
Marco Liberati
997ec8dd49
[Lens][FTR] Skip failing test (#189039)
## Summary

Skip #164623 for now

---------

Co-authored-by: Alex Szabo <alex.szabo@elastic.co>
2024-07-24 12:21:59 +02:00
Kibana Machine
0694566dda skip failing test suite (#164623) 2024-07-24 12:14:10 +02:00
Sébastien Loix
14770214fd
[Spaces] Add warning for changes that impact other users (#188728) 2024-07-23 16:06:20 +01:00
Hannah Mudge
5c4eae1286
[Embeddable Rebuild] [Saved Search] Migrate saved search embeddable to new embeddable framework (#180536)
Closes https://github.com/elastic/kibana/issues/174959

## Summary

This PR converts the Saved Search embeddable to the new React embeddable
framework. There should not be **any** changes in user-facing behaviour
(except for the intentional change described
[here](https://github.com/elastic/kibana/pull/180536#discussion_r1647924825))
- therefore, testing of this PR should be focused on ensuring that no
behaviour is changed and/or broken with this refactor.

> [!WARNING]  
> The saved search embeddable takes **many forms** and so, while I tried
my best to test everything thoroughly, it is very, very likely that I
missed some test cases due to not being the expert in this area. It is
important that @elastic/kibana-data-discovery in particular approaches
this PR review with a fine-tooth comb 🙇 Thanks so much.

### Notes about the embeddable state:
As part of this refactor, I made three significant changes to how the
state is managed:

1. Once the embeddable is being built in `buildEmbeddable`, the **only
difference** between the runtime state of a by reference and a by value
panel is that the by reference one will have three saved object-specific
keys: `savedObjectId`, `savedObjectDescription`, and `savedObjectTitle`.
2. Number 1 made it possible for me to "flatten out" the runtime state
of the embeddable by removing the `attributes` key, which makes it
easier to access the pieces of state that you need.
3. Previously, the `savedSearch` element of the Saved Search embeddable
object was never modified; instead, changes made to the columns, sort,
sample size, etc. from the dashboard were stored in `explicitInput`.
This essentially created two sources of truth.
   
With the new embeddable system, we only ever want **one** source of
truth - so, the saved search is now modified **directly** when making
changes from the dashboard. However, in order to keep behaviour
consistent with the old embeddable, changes made from the dashboard to a
by reference saved search **should not** modify the underlying saved
object (this behaviour will have to change if we ever want inline
editing for saved searches, but that is another discussion) - therefore,
when **serializing** the runtime state (which happens when the dashboard
is saved), we [only serialize state that has **changed** from the
initial
state](https://github.com/elastic/kibana/pull/180536/files#diff-7346937694685b85c017fb608c6582afb3aded0912bfb42fffa4b32a6d27fdbbR93-R117);
then, on deserialization, we take this "changed" state and
[**overwrite** the state of the saved search with
it](https://github.com/elastic/kibana/pull/180536/files#diff-7346937694685b85c017fb608c6582afb3aded0912bfb42fffa4b32a6d27fdbbR44-R54).
    
Note that this **only** applies to by reference saved searches - with by
value saved searches, we don't have to worry about this and can freely
modify the state.

I also had to make changes to how the **search source** is stored in
runtime state. Previously, when initializing the embeddable, fetching
the saved search saved object also created and returned an
**unserializable** search source object. However, in the new system,
runtime state **most always be serializable** (see
https://github.com/elastic/kibana/pull/186052) - therefore, I've had to
instead use the **serialized** search source in my runtime state saved
search - therefore, I've had to make changes to `toSavedSearch` method
to [allow for a **serializable** saved search to be
returned](https://github.com/elastic/kibana/pull/180536/files#diff-3baaeaeef5893a5a4db6379a1ed888406a8584cb9d0c7440f273040e4aa28166R160-R169).

| | Runtime state (`input`) before | Runtime state after |
|--------|--------|--------|
| **By value** |
![image](d019f904-aac3-4bf2-8f9f-a98787d3b78a)
|
![image](dd820202-f1ef-4404-9450-610989204015)
|
| **By reference** |
![image](ebb0d4a9-b918-48a4-8690-0434a2a17561)
|
![image](16fa1e4d-064d-457b-98af-4697f52de4dd)
|


### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [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
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-22 15:14:21 -06:00
Ievgen Sorokopud
0077b0e645
[Security Solution][Detections][BUG] Rule execution error when source document has a non-ECS compliant text field (#187630) (#187673)
## Summary

-  https://github.com/elastic/kibana/issues/187630
- https://github.com/elastic/kibana/issues/187768

These changes fix the error on saving the alert
> An error occurred during rule execution: message: "[1:6952] failed to
parse field [event.original] of type [keyword] in document with id
'330b17dc2ac382dbdd2f2577c28e83b42c5dc66eaf95e857ec0f222abfc486fa'..."

The issue happens when source index has non-ECS compliant text field
which is expected to be a keyword. If the text value is longer than
32766 bytes and keyword field does not have ignore_above parameter set,
then on trying to store the text value in keyword field we will hit the
Lucene's term byte-length limit (for more details see [this
page](https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-above.html)).

See the main ticket for steps to reproduce the issue.

---------

Co-authored-by: Vitalii Dmyterko <92328789+vitaliidm@users.noreply.github.com>
2024-07-22 13:32:38 -05:00
Joe McElroy
ce5ca1db2e
[Search] [Playground] Session persistence (#188523)
## Summary

Stores working state into localstorage so when you visit again, you are
where you left off.

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-07-22 12:26:01 +01:00
Abdul Wahab Zahid
acf25bc64d
[Logs Explorer] Fixe flaky virtual column popover actions e2e tests (#188773)
The PR attempts to fix the flakiness in the e2e tests by avoiding clicks
on an already opened popover. The click statement within
`retry.tryForTime` can be called in succession, which could
inadvertently close the popover, which we want to avoid in this case.

The screenshot from failed tests suggests that the assertion is made on
a closed down popover:

![image](https://github.com/user-attachments/assets/bd3a9e2c-c292-47db-be89-b4f0a35911f9)
2024-07-22 12:18:36 +02:00
Melissa Alvarez
c830fbb39b
[ML] Single metric viewer functional test: add retry to reduce flakiness (#188686)
## Summary

Fixes https://github.com/elastic/kibana/issues/188493

This PR unskips the single metric viewer functional test that is failing
(confirmed functionality is working as expected) and increases the
retries to reduce flakiness.

Flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6593


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2024-07-19 11:26:11 -06:00
Rachel Shen
4960bb38ac
[Share Modal] Fix disabled license to not show export tab (#188439)
## Summary

Closes https://github.com/elastic/kibana/issues/184871

This PR adds a check for if the license is disabled for reporting and
does not show the Export tab in the share modal. It might be good to
have a message in the export tab to show the users that they need to
update their license but that might need some feedback from
@elastic/kibana-design. This can be accomplished in another PR but this
PR is just to avoid the nasty error to the users who might be in this
situation.

### 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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-19 03:44:18 +10:00
Davis McPhee
cf3bef6c89
[Discover] [Logs Explorer] Use LogLevelBadge in log overview tab and Logs Explorer grid (#188615)
## Summary

This PR updates the log level displays in the log overview doc viewer
tab and Logs Explorer content cell to use the shared `LogLevelBadge`
component also used by the Discover logs data source profile for
consistency across the UI.

Discover:

![discover](https://github.com/user-attachments/assets/de9f66d1-19b3-4431-9a88-00d6eb968625)

Logs Explorer:

![logs_explorer](https://github.com/user-attachments/assets/9158a4e0-8526-4cb5-9533-a35c1128e388)

Resolves #188553.

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-18 13:49:05 -03:00
Giorgos Bamparopoulos
e049eca8e7
Remove extra call to navigateTo from Dataset Quality functional tests (#188638)
Removes extra function calls from the Dataset Quality functional tests
2024-07-18 23:24:48 +10:00
Tiago Costa
b9e3612d5d
skip flaky suite (#188493) 2024-07-17 17:20:19 +01:00
Melissa Alvarez
e49ded918d
[ML] Single Metric Viewer embeddable in dashboards: add tests for anomaly action menu (#187801)
## Summary

Related meta issue https://github.com/elastic/kibana/issues/182235

- Adds tests for click action on anomaly markers in the single metric
viewer embeddable


### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-16 11:16:27 -06:00
Carlos Crespo
5ec5b994dc
[Infra] Limit the number of metrics accepted by Metrics Explorer API (#188112)
part of [3628](https://github.com/elastic/observability-dev/issues/3628)
- private

## Summary

After adding 20 items, users can no longer add more fields and will see
the message below


<img width="1725" alt="image"
src="fd504212-0e0f-485d-a8fe-b991c829950e">


### Extra

- There was an unused and duplicate `metrics_explorer` route in infra. I
removed it. It should've been removed when the `metrics_data_access`
plugin was created.
- Cleaned up `constants` field in `metrics_data_access` and `infra`
plugins

### How to test

- Start a local Kibana instance pointing to an oblt cluster
- Navigate to Infrastructure > Metrics Explorer
- Try to select more than 20 fields in the metrics field

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-16 15:44:05 +02:00
Yan Savitski
37845b04e8
[Search][Playground] Fix playground selected fields (#188278)
When user selected fields in query mode, goes to chat mode and then back
to query mode. Some fields may return to default value

---------

Co-authored-by: Joseph McElroy <joseph.mcelroy@elastic.co>
2024-07-15 23:37:41 +01:00
Davis McPhee
10c27a9bbf
[Discover] Add support for log overview tab to Discover log profile (#186680)
## Summary

This PR adds the log overview tab from Logs Explorer to the Discover log
document profile. The only difference between the tab in Logs Explorer
and Discover is that the one in Logs Explorer includes the O11y AI
assistant while the Discover one doesn't (for now at least):

![log_overview](https://github.com/user-attachments/assets/3c5b3ea0-227e-41fa-ab1e-5618008b5d39)

Resolves #187096.

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-15 19:09:44 -03:00
Julia Rechkunova
4e25754dc9
[OneDiscover] Add data table row log.level severity indication (#186418)
- Closes https://github.com/elastic/kibana/issues/186264

## Summary

This PR adds color indicators for `log.level` or `log_level` to the
Discover data grid.

<img width="1448" alt="Screenshot 2024-07-04 at 09 03 18"
src="68d7e91a-7192-492a-9f9c-3b46c9684697">


### 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
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
2024-07-15 10:10:03 -04:00
Carlos Crespo
f2d1a8b6d2
[Infra] Limit the number of metrics accepted by Snapshot API (#188181)
part of [3628](https://github.com/elastic/observability-dev/issues/3628)
- private


## Summary

After adding 20 items, users can no longer add more metrics and will see
the "Add metric" button disabled with a tooltip

<img width="1713" alt="image"
src="https://github.com/user-attachments/assets/c784b08b-e118-4491-b53d-46bfde898216">


### How to test

- Start a local Kibana instance pointing to an oblt cluster
- Navigate to Infrastructure
- Try to add more than 20 metrics in the Metrics dropdown.
2024-07-12 15:53:53 +02:00
Tiago Costa
51da2d98a4
skip flaky suite (#179307) 2024-07-12 04:56:01 +01:00
Carlos Crespo
ce9cadf899
[Infra] Fix Source Configuration test clean up (#187955)
fixes [#177141](https://github.com/elastic/kibana/issues/177141)

## Summary

Apparently the error was caused by some hanging promise.

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6508

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-11 13:29:35 +02:00
Saarika Bhasi
46b21546aa
[Index management] Refactor api_integration tests for create inference endpoint (#187521)
## Summary
 * delete underlying trained model during `after all` clean up 
 * handle request time out error when creating inference endpoint

Tested against QA deployment and locally.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-11 01:18:53 +10:00
Yan Savitski
77267b28ba
[Search][Playground] Update UI (#187608)
## Summary

Summarize your PR. If it involves visual changes include a screenshot or
gif.


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Joseph McElroy <joseph.mcelroy@elastic.co>
2024-07-10 15:05:59 +02:00
Melissa Alvarez
8f95f955e6
[ML] Functional tests: unskip anomaly detection results forecast flaky test (#187795)
## Summary

Unskip skipped test due to flakiness:
https://github.com/elastic/kibana/issues/164381
Initial investigation appears to indicate something in the testing
environment - likely the chrome version. That has been updated since so
letting the CI run to confirm.

Flaky test runner build:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6494

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2024-07-09 11:00:36 -06:00
Achyut Jhunjhunwala
ee62412c7b
[Dataset Quality] Fix flaky integration tests [WIP] (#187851)
## Summary

This PR 

closes https://github.com/elastic/kibana/issues/187589
closes https://github.com/elastic/kibana/issues/187566


## Results

- Tested locally against MKI and the tests are now passing
✔️
- Tested locally for Stateful ✔️
- Tested locally for Serverless ✔️
2024-07-09 19:56:38 +03:00
Dima Arnautov
7997d6fe33
[ML] Hide ML embeddables from the "Add panel" flyout when ML feature isn't available (#187639)
## Summary

Fixes #187007 

Hides ML embeddables from the "Add panel" flyout when
1. ML feature isn't available for the user role 
2. ML is hidden in a current space 


### How to test 
1. Create a custom role with disabled ML privilege and assign it to a
user

![image](07fe2865-2ebe-448f-8e31-c36581b57b28)

2. Remove ML feature visibility in a current space 

![image](dc3f19fa-cb29-424a-a04d-677518bb45fa)

### 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
2024-07-09 22:21:20 +10:00
Marta Bondyra
e6f17e7c06
[Unified field list] debounce search (#187143)
## Summary

Updates to unified field list on typing are debounced - this way we
don't get so many updates when typing in the search input.

Flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6424

## Performance comparison
Test: typing the string: activem for metricbeat data (~6000 fields)

before (costly update on every keystroke):
<img width="669" alt="Screenshot 2024-06-28 at 17 28 38"
src="7075f7bc-2d90-4177-acac-69ac101b2ef1">

after (only one costly update when user stops typing):
<img width="269" alt="Screenshot 2024-06-28 at 17 24 43"
src="8c0ce4a3-7c1a-428b-a482-f6b4d87911e0">
2024-07-06 14:47:26 +02:00
Ievgen Sorokopud
0a4ed61699
[Security Solution][Detections][BUG] ES|QL rule execution error when source document has a non-ECS compliant sub-field with data under event field (#187384) (#187549)
## Summary

Ticket https://github.com/elastic/kibana/issues/187384

These changes fix the error on saving the alert
> An error occurred during rule execution: message: "[1:6778] failed to
parse field [kibana.alert.original_event.action] of type [keyword] in
document with id '027b925ae2799635a0dee97a6aa9d58dc87d9771'."

which happens due to not stripping non-ECS compliant sub-fields of the
`event.action` field.

See the main ticket for steps to reproduce the issue.
2024-07-05 13:29:22 +02:00
Kibana Machine
5c7eca70eb skip failing test suite (#187589) 2024-07-05 13:01:10 +02:00
Tiago Costa
ed038adf9d
skip flaky suite (#175443) 2024-07-05 00:57:09 +01:00
Achyut Jhunjhunwala
c4837014c5
[Dataset Quality] Refactor integrations in DQ Flyout to not depend on main DQ Page page (#187450)
## Summary

This PR is a prerequisite to the Locator Implementation for Logs
Explorer - https://github.com/elastic/kibana/pull/186287

## Problem Statement

- Integrations were fetched when the main DQ page loads and stored in
the State Machine. This means when the Flyout Opens, it was referencing
already fetched data from the main page, updating the URL and then that
was used to render certain sections on the Flyout. This causes issues as
when a Locator is used to directly open the Flyout from some other page.
In that case everything happen asynchronously causing the data to be not
present when the flyout open thus those integration sections were not
present.

## Solution

- Now when the flyout is opened or is already open, it reads the basic
params from the URL like `DataStream`. With this information, it make
API call to fetch Integration information and thus making it
independent.
- Does this means you duplicated the Logic to fetch Integrations ? Yes
and No. Logic has to be duplicated as Flyout is moving to its own page
very soon. This means it would anyhow not be able to re-use that
Integration Information available. Secondly the duplication is not one
to one, its more catered towards Flyout logic
- Split the state machine to make Integration Calls only when the opened
Dataset is actually an integration. This is done by chaining the
respective states after the `DataStreamSettings` state confirms presence
of Integration.

## What else has been done

- Type cleaning: A lot of types has to be refactored to make this
change. Also simplified some duplicate types. We were using
  - Runtime types
  - Types Derived from Runtime Types
  - Inferred Types from API Responses
  We don't need the 3rd one. 1 and 2 and sufficient.
2024-07-04 20:49:46 +10:00
Miriam
7274f44e9c
[OnWeek][ObsUX] Add fields to hosts in synthtrace to improve data generation (#187147)
## Summary

After improving the synthtrace data creation for containers we were able
to add more specific tests for container view, the aim of this spacetime
is to add some improvements to hosts so we can in the future use
synthtrace for testing

### What was done

First I thought that adding `event.dataset` was needed to get the
metadata, or make the request work, as I did for containers, but in
containers was needed not because of the metadata query itself but the
integration check to know if we need to display k8s or docker metrics.
I simplified the scenarios and data generation in the tests, adding the
metadata fields we need in the synthtrace clients for host and docker
and k8s containers, the values of the metadata fields doesn't need to
change for different scenarios, so it's ok to have them set in the
client.
2024-07-03 11:01:11 +01:00
Ryland Herrick
2aa94a27f0
[Detection Engine] Adds Alert Suppression to ML Rules (#181926)
## Summary
This PR introduces Alert Suppression for ML Detection Rules. This
feature is behaviorally similar to alerting suppression for other
Detection Engine Rule types, and nearly identical to the analogous
features for EQL rules.

There are some additional UI behaviors introduced here as well, mainly
intended to cover the shortcomings discovered in
https://github.com/elastic/kibana/issues/183100. Those behaviors are:

1. Populating the suppression field list with fields from the anomaly
index(es).
1. Disabling the suppression UI if no selected ML jobs are running
(because we cannot populate the list of fields on which they'll be
suppressing).
1. Warning the user if _some_ selected ML jobs are not running (because
the list of suppression fields may be incomplete).

See screenshots below for more info.

### Intermediate Serverless Deployment
As per the "intermediate deployment" requirements for serverless, while
the schema (and declared alert SO mappings) will be extended to allow
this functionality, the user-facing features are currently hidden behind
a feature flag. Once this is merged and released, we can issue a "final"
deployment in which the feature flag is enabled, and the feature
effectively released.


## Screenshots
* Overview of new UI fields
<img width="1044" alt="Screenshot 2024-05-16 at 3 22 02 PM"
src="8c07700d-5860-4d1e-a701-eac84fc35558">
* Example of Anomaly fields in suppression combobox
<img width="881" alt="Screenshot 2024-06-06 at 5 14 17 PM"
src="9aa6ed99-1e02-44a0-ad1b-785136510d68">
* Suppression disabled due to no jobs running
<img width="668" alt="Screenshot 2024-06-17 at 11 23 39 PM"
src="a8636a52-31bd-4579-9bcd-d59d93c26984">
* Warning due to not all jobs running
<img width="776" alt="Screenshot 2024-06-17 at 11 26 16 PM"
src="f44c2400-570e-4fde-adce-e5841a2de08d">

## Steps to Review
1. Review the Test Plan for an overview of behavior
2. Review Integration tests for an overview of implementation and edge
cases
3. Review Cypress tests for an overview of UX changes
4. Testing on [Demo
Instance](https://rylnd-pr-181926-ml-rule-alert-suppression.kbndev.co/)
(elastic/changeme)
1. This instance has the relevant feature flag enabled, has some sample
auditbeat data, as well as the [anomalies archive
data](https://github.com/elastic/kibana/tree/main/x-pack/test/functional/es_archives/security_solution/anomalies)
for the purposes of exercising an ML rule against "real" anomalies
    1. There are a few example rules in the default space:
1. A simple [query
rule](f6f5960d-7e4b-40c1-ae15-501112822130)
against auditbeat data
1. An [ML
rule](9122669e-b2e1-41ce-af25-eeae15aa9ece)
with per-execution suppression on both `by_field_name` and
`by_field_value` (which ends up not actually suppressing anything)
1. An [ML
rule](0aabc280-00bd-42d4-82e6-65997c751797)
with per-execution suppression on `by_field_name` (which suppresses all
anomalies into a single alert)

## Related Issues
- This feature was temporarily blocked by
https://github.com/elastic/kibana/issues/183100, but those changes are
now in this PR.

## Checklist
- [x] Functional changes are hidden behind a feature flag. If not
hidden, the PR explains why these changes are being implemented in a
long-living feature branch.
- [x] Functional changes are covered with a test plan and automated
tests.
    * [Test Plan](https://github.com/elastic/security-team/pull/9279)
- [x] Stability of new and changed tests is verified using the [Flaky
Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner) in
both ESS and Serverless. By default, use 200 runs for ESS and 200 runs
for Serverless.
* [ESS - Cypress x
200](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6449)
* [Serverless - Cypress x
200](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6450)
* [ESS - API x
200](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6447)
* [Serverless - API x
200](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6448)
- [ ] Comprehensive manual testing is done by two engineers: the PR
author and one of the PR reviewers. Changes are tested in both ESS and
Serverless.
- [ ] Mapping changes are accompanied by a technical design document. It
can be a GitHub issue or an RFC explaining the changes. The design
document is shared with and approved by the appropriate teams and
individual stakeholders.
- [ ] (OPTIONAL) OpenAPI specs changes include detailed descriptions and
examples of usage and are ready to be released on
https://docs.elastic.co/api-reference. NOTE: This is optional because at
the moment we don't have yet any OpenAPI specs that would be fully
"documented" and "GA-ready" for publishing on
https://docs.elastic.co/api-reference.
- [ ] Functional changes are communicated to the Docs team. A ticket is
opened in https://github.com/elastic/security-docs using the [Internal
documentation request (Elastic
employees)](https://github.com/elastic/security-docs/issues/new?assignees=&labels=&projects=&template=docs-request-internal.yaml&title=%5BRequest%5D+)
template. The following information is included: feature flags used,
target ESS version, planned timing for ESS and Serverless releases.

---------

Co-authored-by: Nastasha Solomon <79124755+nastasha-solomon@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-02 14:33:11 -05:00
Janki Salvi
8bf9aa56b4
[ResponseOps][Cases] Allow users to create case using templates (#187138)
## Summary

Fixes https://github.com/elastic/kibana/issues/181309

This PR 
- allows users to create, edit or delete templates via cases > settings
page
- allows users to create case using templates


39226aa4-9d9a-41a8-a900-ca765ed98e1b

## Testing

1. Go to all solutions and create cases with all fields (including all
fields of all supported connectors) without using templates. Verify that
everything is working as expected.
2. Go to all solutions and create and edit templates with various
fields. Verify that everything is working as expected.
3. Go to all solutions, create different templates on each solution, and
verify that when creating a case you can use templates and everything is
working as expected.
4. Go to the alerts table of o11y and security and attach alerts to a
new case. Verify that in the flyout the templates are working as
expected.
5. Go to ML and try to attach an ML visualization to a new case. Verify
that the solution picker is working as expected and it resets the form
when changing solutions.
6. Create a template with custom fields. Delete one of the custom fields
from the settings page. Verify that it is also deleted from the
template.

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [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
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))

**Flaky test runner**:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6425

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)


## Release notes
Allow users to create case using templates.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: adcoelho <antonio.coelho@elastic.co>
2024-07-02 11:45:49 +01:00
Abdul Wahab Zahid
d003ae3023
[Dataset quality] EBT for Datasets table and Dataset Details (#187125)
Implement the Event Based Telemetry for Datasets table (main
page) and the Dataset details (the flyout at the time of
writing).

The following EBT events are reported:
- `"Dataset Quality Navigated"`
- `"Dataset Quality Dataset Details Opened"`
- `"Dataset Quality Dataset Details Navigated"`

The above allow to track the following:
1. Used query, available and chosen filters for "Integrations",
"Namespaces" and "Qualities" when user clicks on the degraded documents
percentage link (with `_ignored` filter) from main table's column or
"Open" link from row actions.
2. Dataset health, percentage of degraded documents, duration to load
and breakdown field when user opens the flyout.
3. All included in 2 plus whether `_ignored` filter is present in
navigation, source and target of the navigation when user navigates away
from the flyout.
4. All events also track selected date range and user's privileges state
for the respective data stream.


### Main page - Datasets table
Event Name: `"Dataset Quality Navigated"`
This event is reported whenever a degraded percentage link or "Open"
link is navigated to on the main datasets table.

The following properties are tracked:

### <a name="dqn" >Properties</a>
| Property | Type | Schema Type | Description |
| --- | --- | --- | --- |
| `index_name` | string | keyword | The name of the index e.g.
`logs-apache.access-default` |
| `data_stream` | object | object | Object containing [ECS Data Stream
Fields](https://www.elastic.co/guide/en/ecs/current/ecs-data_stream.html)
i.e. `dataset`, `namespace`, and `type` |
| `data_stream_health` | object | keyword | Any of `"poor"`,
`"degraded"` and `"good"` representing the health/quality of data stream
|
| `data_stream_aggregatable` | boolean | boolean | A boolean indicating
whether the data stream is aggregatable for the `_ignored` field |
| `from` | string | date | ISO start date string selected on datepicker
|
| `to` | string | date | ISO end date string selected on datepicker |
| `degraded_percentage` | number | float | A number representing the
percentage of degraded documents in the data stream |
| `integration` | string (optional) | keyword | An optional string
representing the integration name associated with the dataset |
| `privileges` | object | object | An object representing the
privileges. It includes `can_monitor_data_stream`,
`can_view_integrations`, and an optional `can_view_dashboards`. All are
boolean. |
| `filters` | object | object | An object containing filter details. It
includes `is_degraded`, `query_length`, `integrations`, `namespaces`,
and `qualities`. See below for more details |

The `filters` property is an object with the following sub-properties:

| <div style="min-width:80px">Sub-Property</div> | <div
style="min-width:60px">Type</div> | <div style="min-width:60px">Schema
Type</div> | Description |
| --- | --- | --- | --- |
| `is_degraded` | boolean | boolean | A boolean indicating whether
navigation included `ignored` filter |
| `query_length` | number | short | The length of the query used |
| `integrations` | object | object | An object including `total`,
`included`, and `excluded` properties representing applied filters. |
| `namespaces` | object | object | An object including `total`,
`included`, and `excluded` properties representing applied filters |
| `qualities` | object | object | An object including `total`,
`included`, and `excluded` properties representing applied filters |

### Details page - Flyout

Event `"Dataset Quality Dataset Details Opened"` is reported when flyout
is opened whereas `"Dataset Quality Dataset Details Navigated"` is
reported when a link is clicked on the flyout which navigates the user
away from Dataset Quality page. Important properties are tracked which
help analyse the state user had before the navigation e.g. breakdown
field, selected date range and whether user clicked the degraded docs or
all docs link.

_Note that, the flyout is expected to be converted into a routed page,
hence "Dataset Details" is used for event names instead of the flyout._

#### Properties
`"Dataset Quality Dataset Details Opened"` only differs from [`"Dataset
Quality Navigated"`](#dqn) by the following properties:

| <div style="min-width:80px">Property</div> | <div
style="min-width:60px">Type</div> | <div style="min-width:60px">Schema
Type</div> | Description |
| --- | --- | --- | --- |
| `tracking_id` | string | keyword | Id to group flyout opening and
navigation for funnel analysis |
| `duration` | number | long | Time it took in milliseconds from opening
the flyout until the data stream details are available |
| `breakdown_field` | string (optional) | keyword | Fields used to break
the chart down by |

`"Dataset Quality Dataset Details Navigated"` only differs from
[`"Dataset Quality Navigated"`](#dqn) by the following properties:

| <div style="min-width:80px">Property</div> | <div
style="min-width:60px">Type</div> | <div style="min-width:60px">Schema
Type</div> | Description |
| --- | --- | --- | --- |
| `tracking_id` | string | keyword | Id to group flyout opening and
navigation for funnel analysis |
| `filters` | object | object | `{ "is_degraded": <boolean> }` which
represent whether the user is navigating with `_ignored` filter applied|
| `breakdown_field` | string (optional) | keyword | Fields used to break
the chart down by |
| `target` | enum value | keyword | Action that user took to navigate
away from the dataset details page. Possible values are `Exit`,
`LogsExplorer`, `Discover`, `Lens`, `Integration`, `IndexTemplate`,
`Dashboard`, `Hosts` and `Services` |
| `source` | enum value | keyword | Section of dataset details page the
action is originated from. Possible values are `"Header"`, `"Footer"`,
`"Summary"`, `"Chart"`, `"Table"` and `"ActionMenu"` |
2024-07-02 11:26:26 +02:00
Abdul Wahab Zahid
b9c903bf1f
[Dataset quality] - Enable links to Dataset Quality from Management and Logs Explorer (#186143)
Add links to Dataset Quality in the following places:
1. "Data sets" link on Logs Explorer nav header (on both Serverless and
Stateful)
2. "Data Set Quality" side nav menu item under Stack Management -> Data
(Stateful)
3. "Data Set Quality" card under Management -> Data (Serverless)

On Logs Explorer - Stateful

![dataset-quality-logs-explorer-link-stateful](ea9b37ef-abfd-433d-97d2-ee678d679aa3)

On Logs Explorer - Serverless

![dataset-quality-logs-explorer-link-serverless](6fac1e8a-9ff5-423d-bacb-5a777158c30d)

Stack Management - Stateful

![dataset-quality-side-nav-stateful-link](3561047d-5f65-469d-bfd1-c235058b71ac)

Stack Management - Serverless

![image](a4182040-8565-4ad9-9ef2-909e0161ce78)

---------

Co-authored-by: Yngrid Coello <yngrid.coello@elastic.co>
2024-06-28 15:30:21 +02:00