Commit graph

822 commits

Author SHA1 Message Date
Gerard Soldevila
21351df953
Split the .kibana saved objects index into multiple indices (#154888)
## Description 

Fix https://github.com/elastic/kibana/issues/104081

This PR move some of the SO types from the `.kibana` index into the
following ones:
- `.kibana_alerting_cases`
- `.kibana_analytics`
- `.kibana_security_solution`
- `.kibana_ingest`

This split/reallocation will occur during the `8.8.0` Kibana upgrade
(*meaning: from any version older than `8.8.0` to any version greater or
equal to `8.8.0`*)

**This PR main changes are:**
- implement the changes required in the SO migration algorithm to
support this reallocation
- update the FTR tools (looking at you esArchiver) to support these new
indices
- update hardcoded references to `.kibana` and usage of the
`core.savedObjects.getKibanaIndex()` to use new APIs to target the
correct index/indices
- update FTR datasets, tests and utility accordingly 

## To reviewers

**Overall estimated risk of regressions: low**

But, still, please take the time to review changes in your code. The
parts of the production code that were the most impacted are the
telemetry collectors, as most of them were performing direct requests
against the `.kibana` index, so we had to adapt them. Most other
contributor-owned changes are in FTR tests and datasets.

If you think a type is misplaced (either we missed some types that
should be moved to a specific index, or some types were moved and
shouldn't have been) please tell us, and we'll fix the reallocation
either in this PR or in a follow-up.

## .Kibana split

The following new indices are introduced by this PR, with the following
SO types being moved to it. (any SO type not listed here will be staying
in its current index)

Note: The complete **_type => index_** breakdown is available in [this
spreadsheet](https://docs.google.com/spreadsheets/d/1b_MG_E_aBksZ4Vkd9cVayij1oBpdhvH4XC8NVlChiio/edit#gid=145920788).

#### `.kibana_alerting_cases`
- action
- action_task_params
- alert
- api_key_pending_invalidation
- cases
- cases-comments
- cases-configure
- cases-connector-mappings
- cases-telemetry
- cases-user-actions
- connector_token
- rules-settings
- maintenance-window

#### `.kibana_security_solution`
- csp-rule-template
- endpoint:user-artifact
- endpoint:user-artifact-manifest
- exception-list
- exception-list-agnostic
- osquery-manager-usage-metric
- osquery-pack
- osquery-pack-asset
- osquery-saved-query
- security-rule
- security-solution-signals-migration
- siem-detection-engine-rule-actions
- siem-ui-timeline
- siem-ui-timeline-note
- siem-ui-timeline-pinned-event

#### `.kibana_analytics`

- canvas-element
- canvas-workpad-template
- canvas-workpad
- dashboard
- graph-workspace
- index-pattern
- kql-telemetry
- lens
- lens-ui-telemetry
- map
- search
- search-session
- search-telemetry
- visualization

#### `.kibana_ingest`

- epm-packages
- epm-packages-assets
- fleet-fleet-server-host
- fleet-message-signing-keys
- fleet-preconfiguration-deletion-record
- fleet-proxy
- ingest_manager_settings
- ingest-agent-policies
- ingest-download-sources
- ingest-outputs
- ingest-package-policies

## Tasks / PRs

### Sub-PRs

**Implementation**
- 🟣 https://github.com/elastic/kibana/pull/154846
- 🟣 https://github.com/elastic/kibana/pull/154892
- 🟣 https://github.com/elastic/kibana/pull/154882
- 🟣 https://github.com/elastic/kibana/pull/154884
- 🟣 https://github.com/elastic/kibana/pull/155155

**Individual index split**
- 🟣 https://github.com/elastic/kibana/pull/154897
- 🟣 https://github.com/elastic/kibana/pull/155129
- 🟣 https://github.com/elastic/kibana/pull/155140
- 🟣 https://github.com/elastic/kibana/pull/155130

### Improvements / follow-ups 

- 👷🏼 Extract logic into
[runV2Migration](https://github.com/elastic/kibana/pull/154151#discussion_r1158470566)
@gsoldevila
- Make `getCurrentIndexTypesMap` resillient to intermittent failures
https://github.com/elastic/kibana/pull/154151#discussion_r1169289717
- 🚧 Build a more structured
[MigratorSynchronizer](https://github.com/elastic/kibana/pull/154151#discussion_r1158469918)
- 🟣 https://github.com/elastic/kibana/pull/155035
- 🟣 https://github.com/elastic/kibana/pull/155116
- 🟣 https://github.com/elastic/kibana/pull/155366
## Reallocation tweaks

Tweaks to the reallocation can be done after the initial merge, as long
as it's done before the public release of 8.8

- `url` should get back to `.kibana` (see
[comment](https://github.com/elastic/kibana/pull/154888#discussion_r1172317133))

## Release Note

For performance purposes, Kibana is now using more system indices to
store its internal data.

The following system indices will be created when upgrading to `8.8.0`:

- `.kibana_alerting_cases`
- `.kibana_analytics`
- `.kibana_security_solution`
- `.kibana_ingest`

---------

Co-authored-by: pgayvallet <pierre.gayvallet@elastic.co>
Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>
2023-04-25 09:43:42 +02:00
Ersin Erdal
00dfae4312
Make rule type param validation required (#154257)
Resolves: #153755

This PR intends to make rule type param validation function required.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-04-20 19:23:47 +02:00
Zacqary Adam Xeper
56796db2c0
[RAM] [FE] Add conditional actions UI for timeframe (#153944)
## Summary

Adds the conditional timeframe to the actions UI. **Currently only
enabled in the Security Solution alerts UI using the
`showActionAlertsFilter` prop**

Part of https://github.com/elastic/kibana/issues/152026 and
https://github.com/elastic/kibana/issues/152611

<img width="880" alt="Screenshot 2023-03-29 at 4 15 24 PM"
src="https://user-images.githubusercontent.com/1445834/228567116-a0fa80ac-7664-411f-9757-41aa81b52857.png">

### UPDATED UI
<img width="857" alt="Screenshot 2023-03-31 at 3 58 12 PM"
src="https://user-images.githubusercontent.com/1445834/229140790-11aeea9b-6db9-46bc-8f35-47f9afabb606.png">


### 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] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-04-11 12:13:54 -07:00
Alexi Doak
331eb60a8b
[ResponseOps] Allow users authenticated with an API keys to manage alerting rules (#154189)
Resolves https://github.com/elastic/kibana/issues/152140

## Summary
Updates the following functions in the Rules Client to re-use the API
key in context and avoid having the system invalidate them when no
longer in use:

- bulk_delete
- bulk_edit
- clone
- create
- delete
- update
- update_api_key

Also adds a new field to the rule SO to help determine when whether an
api key was created by a user or created by us.

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

### To verify

- Follow these
[instructions](https://www.elastic.co/guide/en/kibana/master/api-keys.html#create-api-key)
to create an api key. Make sure to copy your api key
- Run the following 
```
curl -X POST "http://localhost:5601/api/alerting/rule/" -H 'Authorization: ApiKey ${API_KEY}' -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
{
  "rule_type_id": "example.pattern",
  "name": "pattern",
  "schedule": {
    "interval": "5s"
  },
  "actions": [
  ],
  "consumer": "alerts",
  "tags": [],
  "notify_when": "onActionGroupChange",
  "params": {
    "patterns": {
      "instA": " a - - a "
    }
  }
}'
```
- Verify that the request returns a rule
with`"api_key_created_by_user":true`
- Try this with the other rules clients functions listed above to verify
that you can manage alerting rules when authenticated with an api key
- Verify that `"api_key_created_by_user":false` when you remove the api
key header and add `-u ${USERNAME}:${PASSWORD}` to authenticate
2023-04-11 07:29:56 -07:00
Kevin Lacabane
d1e5dbc5c9
[Stack Monitoring] fix ccr read_exceptions alert (#153888)
## Summary

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

## Testing
- Setup CCR ([see how
to](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/dev_docs/how_to/running_components_from_source.md#multi-cluster-tests-for-ccrccs-or-listing).
I used two cloud clusters, happy to provide credentials to reviewers to
avoid the setup)
- Setup CCR between two clusters, create a follower indice and replicate
some data
- Intentionally break the remote cluster connection on the follower
cluster (update the cluster endpoint). At this point read_exceptions
should appear in ccr documents
- Start local stack
- local elasticsearch should have [this
change](https://github.com/elastic/elasticsearch/pull/94875). See [howto
run component from
source](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/dev_docs/how_to/running_components_from_source.md#single-cluster-testing)
- Enable stack monitoring default rules
- Start metricbeat collection of the follower cluster
- Ensure ccr alert triggers with metricbeat 7.x (this won't work against
cloud cluster because the license is not supported in 7.x but support
was added later, I'll see if we can [backport this
change](https://github.com/elastic/beats/pull/34105))
- Ensure ccr alert triggers with metricbeat 8.x (build should include
[this change](https://github.com/elastic/beats/pull/34957))
2023-04-03 18:17:53 +02:00
Kevin Lacabane
9ae374955d
[Stack Monitoring] support ecs format in fetch_nodes_from_cluster (#153783)
## Summary

Closes https://github.com/elastic/kibana/issues/147793
Closes https://github.com/elastic/kibana/issues/148448

The `nodes_changed` alert was not looking at the correct property path
to extract node information from ecs documents.
Also fixes a case where only one document is returned instead of two.

## Testing
- Run a multi-node env (see [howto for local
one](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/dev_docs/how_to/running_components_from_source.md#multi-node-configuration);
I used a cloud env)
- Collect elasticsearch metrics with metricbeat (use `scope: cluster`
for cloud)
- Enable default rules
- Change node configuration
- Alert is triggered

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-03-28 14:25:28 +02:00
Milton Hultgren
469c5a3761
[Monitoring] Support Metricbeat format for shard activity (#151983)
Related issue: https://github.com/elastic/beats/issues/34427

Since Metricbeat now reports the right fields, I've updated the UI to
consume those.

<img width="2935" alt="Screenshot 2023-02-23 at 12 00 05"
src="https://user-images.githubusercontent.com/2564140/220893266-1d82bc16-6bca-4eca-a5a1-1a1573eb139d.png">

Related PRs:
https://github.com/elastic/beats/pull/34653
https://github.com/elastic/elasticsearch/pull/94062
https://github.com/elastic/integrations/pull/5367

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-03-21 13:45:46 +01:00
Milton Hultgren
118609b18d
[Monitoring] Display node roles in Nodes table (#152127)
Fixes #151818 

<img width="2863" alt="Screenshot 2023-02-24 at 17 29 44"
src="https://user-images.githubusercontent.com/2564140/221235055-5742b3d3-522d-4677-9c2d-18bcd860d0b8.png">

Related PR: https://github.com/elastic/beats/pull/34668

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-03-20 15:43:40 +01:00
Coen Warmer
d762a2a6bb
Rename getEditAlertFlyout to getEditRuleFlyout (#153243) 2023-03-20 15:30:27 +01:00
Alejandro Fernández Haro
5142d73243
[Elasticsearch] Redact logs from known APIs (#153049)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-03-18 10:50:09 +01:00
Jason Stoltzfus
c339ca8394
Upgraded EUI to v76.0.0 (#152506)
👋 Hi all - the biggest breaking change of this PR is around two icon
type changes/renames.

1. ⚠️ **The  `alert` icon is now named `warning`**
- <img width="103" alt=""
src="https://user-images.githubusercontent.com/549407/223561599-8913e88c-676f-47cd-aaed-81b64783bd81.png"
align="middle">
- This change should have been automatically converted on your behalf by
the EUI team, **but if for some reason** we missed making this
conversion in this PR and your icon(s) are now broken, please ping us or
let us know in this PR (or fix yourself after this PR merges).
- In some cases, teams were using this icon for error messages,
alongside the `danger` color. In those cases, we opinionatedly changed
those icon usages to the new `error` icon instead of using the old
alert/warning icon.

2. 🛑 **The `crossInACircleFilled` icon has been removed, and a new
`error` icon added**
- <img width="84" alt=""
src="https://user-images.githubusercontent.com/549407/223561892-4406bdf6-1a55-49ac-85ad-3a11eb7c090d.png"
align="middle">
- The conversion for this breaking change was not straightforward. This
was the path we used to determine what to change `crossInACircleFilled`
usages to:
- If the icon was associated with errors or error messages, we changed
it to the new `error` icon.
- If a "delete" action was associated with this icon, we changed it to
the `trash` icon instead.
- If a "clear" action was associated with this icon, we changed it to
just the `cross` icon, or in some cases `minusInCircleFilled` (if used
alongside `plusInCircleFilled`).
- Again, if we made a mistake during this conversion or missed your
plugin, please feel free to ping us.

## Summary

`eui@75.1.2`  `eui@76.0.2`

## [`76.0.2`](https://github.com/elastic/eui/tree/v76.0.2)

**Bug fixes**

- Added a legacy `alert` alias for the `warning` `EuiIcon` type
([#6640](https://github.com/elastic/eui/pull/6640))

## [`76.0.1`](https://github.com/elastic/eui/tree/v76.0.1)

**Bug fixes**

- Fixed broken icons on all `isInvalid` form controls
([#6629](https://github.com/elastic/eui/pull/6629))

## [`76.0.0`](https://github.com/elastic/eui/tree/v76.0.0)

- Added `pivot` glyph to `EuiIcon`
([#6605](https://github.com/elastic/eui/pull/6605))
- Added the `displayHeaderCellProps` API to `EuiDataGrid`'s columns,
which allows passing custom props directly to column header cells
([#6609](https://github.com/elastic/eui/pull/6609))
- Added the new `headerCellProps`/`footerCellProps` APIs to
`EuiDataGrid`'s control columns, which allows passing custom props
directly to control column header or footer cells
([#6609](https://github.com/elastic/eui/pull/6609))
- Added a new `footerCellRender` API to `EuiDataGrid`'s control columns,
which allows completely customizing control column rendering (previously
rendered an empty cell)
([#6609](https://github.com/elastic/eui/pull/6609))
- Updated the styling of nested ordered lists in `EuiText` to align with
GitHub's list style, which is a popular format used in Markdown or MDX
formatting ([#6615](https://github.com/elastic/eui/pull/6615))
- Added a margin-bottom property exclusively to the direct child `ul`
and `ol` elements of the `EuiText` component
([#6615](https://github.com/elastic/eui/pull/6615))
- Fix issue with badges appearing within an `EuiBadgeGroup`, where the
CSS rule to override the `margin-inline-start` was not being applied
correctly due to the order of appearance in the CSS rules
([#6618](https://github.com/elastic/eui/pull/6618))

**Bug fixes**

- Fixed `EuiDataGrid` footer control columns rendering with cell
expansion popovers when they should not have been
([#6609](https://github.com/elastic/eui/pull/6609))
- Fixed an `EuiSkipLink` bug where main content loading in
progressively/dynamically after the skip link rendered was not being
correctly focused ([#6613](https://github.com/elastic/eui/pull/6613))

**Breaking changes**

- Renamed `EuiIcon`'s `alert` to `warning`
([#6608](https://github.com/elastic/eui/pull/6608))
- Removed `EuiIcon`'s `crossInACircleFilled` in favor of `error`
([#6608](https://github.com/elastic/eui/pull/6608))

---------

Co-authored-by: Davey Holler <daveyholler@hey.com>
Co-authored-by: Constance Chen <constance.chen@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jon <jon@elastic.co>
2023-03-14 14:27:40 -05:00
Garrett Spong
15f1f64ace
[RAM] Adds auto-incrementing revision field to rules (#147398)
## Summary

Resolves https://github.com/elastic/kibana/issues/137164. 

This PR adds a new `revision` field (number) to Alerting Rules that
auto-increments when relevant content changes have been made via the
`Rules Client`. _Relevant content changes_ are defined as any content
change that the user may either want to be notified about, or have the
option to later revert to. This will include most all changes, except
the enabling/disabling of the rule, or updates to metadata fields like
`executionStatus` or `monitoring`. This `revision` field is not intended
to be user editable, and should be ignored if ever provided via the API.

See https://github.com/elastic/kibana/issues/136213 for additional
details. To be followed-up by
https://github.com/elastic/kibana/issues/137168, which will remove the
version bump logic from security solution.

## Details

### Migrations

Includes SO migration to default `revision` to `0` when upgrading a
cluster, or when importing `pre-8.8.0` rules via the SO Management UI.
For consistency, security rule import follows the same logic as SO
Management and will not reset the `revision` to `0` when overriding or
creating a new rule.

### Downstream Index Updates

* EventLog _has not_ been updated to include `revision` along with basic
rule fields currently being written. Should we?
* AAD Schema will be updated in
https://github.com/elastic/kibana/pull/151388 (as this one is getting
pretty big) to include `revision` so alerts written will include which
specific revision of the rule created the alert.

### Reference Fields

Any creation of or modification to `actions` will result in a revision
increment. More typical reference fields like `exception lists` on the
security side will only result in a revision increment when the list is
initially associated/deleted from the rule (as subsequent updates will
be done directly against the list).

### RuleClient Updates

The following methods within the RuleClient have been updated to support
incrementing revision when relevant field changes have been detected:

* `clone()` - resets to 0 currently (see open question)
* `update()` - increments `revision` so long a change has been made to
relevant fields (fields not in [ignore
list](https://github.com/elastic/kibana/pull/147398/files#diff-6736e143ede2dc06e825bddcdc23b4d088a6620805751db4eddc5900d586c4dfR69-R85))
* `bulkEdit()` - increments `revision` for relevant fields (all current
bulk edit fields minus api key/snooze/mute)

Mutation methods not updated to include revision log:
* `snooze()`
* `unsnooze()`
*  `clearExpiredSnoozes()`
*  `muteAll()`
*  `unmuteAll()`
*  `muteInstance()`
*  `unmuteInstance()`
* `updateApiKey()` - increments revision as rule functionality could be
impacted


## Open questions:
- [X] Should `clone()` in RulesClient reset revision to 0 as if it's a
new rule, or keep the current value? (see
[comment](https://github.com/elastic/kibana/pull/147398/files#r1106484105))
- [X] What about snooze/un-snooze, and mute/unmute? Should we update
revision on these field changes as well? (see
[comment](https://github.com/elastic/kibana/pull/147398/files#r1106431966))
- Discussed with @XavierM and determined to not update on
snooze/mute/API key changes as this actions could be plentiful and don't
necessarily represent a version of the rule a user would want to revert
to, thus polluting the revision history.
- [ ] Should we write `revision` to EventLog?


---

### Checklist

Delete any items that are not applicable to this PR.

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
  - [ ] To work with docs team 
- [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


### 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)
2023-03-10 15:12:22 -07:00
Milton Hultgren
3acff6faf8
[Monitoring] Add Version column to Cluster Listing table (#151638)
Fixes #151508 

<img width="1775" alt="Screenshot 2023-02-20 at 16 42 38"
src="https://user-images.githubusercontent.com/2564140/220149715-26097b5c-601e-498d-8523-9db7d9d43891.png">

Using the data already provided by the API, I've added a new column to
the cluster listing table to show the version there as well.
2023-02-20 21:14:50 +01:00
Thomas Watson
fbdeffb48f
Fix eslint rule for restricting certain lodash imports (#151023)
Fixes #110422

TL;DR: The `lodash.set` function is unsafe and shouldn't be called.

Cause of error: If you specify multiple `no-restricted-imports` paths
for the same module, only the last path is used. Instead you need to
combine them into a single path as I've done in this PR.

This regression was introduced in #100277
2023-02-16 08:35:09 -07:00
mohamedhamed-ahmed
108b4b512b
fix(bug): fixed sorting on cluster list table (#151372)
## Summary

Going to Stack Monitoring in Kibana will bring you to the cluster list.
Attempt to click one of the table headings to sort by that field.

Expected behavior: The table values are sorted by that field
Actual behavior: It changes the direction of the sort on Name

closes [#147273](https://github.com/elastic/kibana/issues/147273)

### Testing


https://user-images.githubusercontent.com/11225826/219131518-7a9b341a-3b6e-4a46-a680-a1d2a12b2bb1.mov
2023-02-16 09:23:27 +00:00
Rachel Shen
50a4fc4916
[Shared UX] Adoption of Shared UX Route component (#150357)
## Summary

This PR removes all imports of Route from react-router-dom and
'@kbn/kibana-react-plugin/public' and instead imports Route from
@kbn/shared-ux-router.

### Context
Based on
https://github.com/elastic/kibana/issues/132629#issue-1243243678 This PR
executes steps 2 - 4:

> 2. To make the transition easier, we want to re-export other
react-router-dom exports alongside the modified' Route'.
> 3. Solutions should start using that Route component in place of the
one from react-router-dom. I.e. replace all occurrences of import { ...
} from 'react-router-dom' with import { ... } from
'@kbn/shared-ux-router'.
> 4. All manual calls to useExecutionContext are not needed anymore and
should be removed.

### Future PR

Looks like this might be getting worked on in:
https://github.com/elastic/kibana/pull/145863 (thanks!)

> Introduce an ESlint rule that ensures that react-router-dom is not
used directly in Kibana and that imports go through the new
@kbn/shared-ux-router package.

This is tangentially accomplished through
https://github.com/elastic/kibana/pull/150340 but only addresses using
Route through @kbn/kibana-react-plugin/public'


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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
2023-02-14 19:25:04 +00:00
Spencer
1b85815402
[packages] migrate all plugins to packages (#148130)
Fixes https://github.com/elastic/kibana/issues/149344

This PR migrates all plugins to packages automatically. It does this
using `node scripts/lint_packages` to automatically migrate
`kibana.json` files to `kibana.jsonc` files. By doing this automatically
we can simplify many build and testing procedures to only support
packages, and not both "packages" and "synthetic packages" (basically
pointers to plugins).

The majority of changes are in operations related code, so we'll be
having operations review this before marking it ready for review. The
vast majority of the code owners are simply pinged because we deleted
all `kibana.json` files and replaced them with `kibana.jsonc` files, so
we plan on leaving the PR ready-for-review for about 24 hours before
merging (after feature freeze), assuming we don't have any blockers
(especially from @elastic/kibana-core since there are a few core
specific changes, though the majority were handled in #149370).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-02-08 21:06:50 -06:00
Carlos Crespo
eafbc47468
[Stack Monitoring] Use UI time range filter in logstash pipeline details query (#150032)
## Summary

closes #145226 

This PR changes SM Logstash pipeline related queries to use the UI time
range filter, instead of the pipeline version `firstSeen` and `lastSeen`
attributes.


![out](https://user-images.githubusercontent.com/2767137/216058047-0967610d-fe52-4936-8e1a-0c91427bf6e3.gif)

### How to test
- Setup your [local environment with
Logstash](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/dev_docs/how_to/local_setup.md#standalone-cluster)
- In Stack Monitoring, navigate to "Standalone Cluster" and click on
Logstash Pipeline tile

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-02-06 12:28:47 +01:00
Josh Dover
136171a63d
Add link to ingest pipeline dashboard from Stack Monitoring (#149721)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/kibana/issues/149386
2023-02-03 08:06:24 +01:00
Kevin Lacabane
870f79df8c
[Stack Monitoring] support entsearch package (#148668)
### Summary

Update stack monitoring to read from data streams created by the
[enterprisesearch
package](https://github.com/elastic/integrations/pull/4926)

### Testing
- build [enterprisesearch
package](https://github.com/elastic/integrations/pull/4926)
- start stack: `elastic-package stack up -v -d --version
8.7.0-SNAPSHOT`; make sure your image contains [this
change](https://github.com/elastic/elastic-agent/pull/2121)
- start enterprisesearch service: `elastic-package service up -v`
- install elasticsearch integration with variables
- `hosts: http://host.docker.internal:9201; username: elastic; password:
changeme`
- install enterprisesearch integration with variables
- `hosts: http://host.docker.internal:3002; username: elastic; password:
changeme`
- connect [local
kibana](2d893bf40b/x-pack/plugins/monitoring/dev_docs/how_to/work_with_packages.md (connecting-a-local-kibana))
- navigate to Stack Monitoring on the local kibana, enterprise search
section shows up with populated graphs

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-01-30 13:43:13 +01:00
Cee Chen
8a2ecc3b4f
Upgrade EUI to v74.0.1 (#149457)
## Summary

`eui@73.0.0`  `eui@74.0.1`

---

## [`74.0.1`](https://github.com/elastic/eui/tree/v74.0.1)

**Bug fixes**

- Fixed `EuiModalHeaderTitle` type errors when passed `EuiTitle` props
([#6547](https://github.com/elastic/eui/pull/6547))

## [`74.0.0`](https://github.com/elastic/eui/tree/v74.0.0)

- Added the `component` prop to `EuiModalHeaderTitle`, which allows
overriding the default `h1` tag
([#6530](https://github.com/elastic/eui/pull/6530))
- Added the `titleProps` prop to `EuiConfirmModal`, which allows
overriding the default `h1` tag
([#6530](https://github.com/elastic/eui/pull/6530))

**Bug fixes**

- Fixed slight row height jumping in `EuiBasicTable`s when actions with
tooltips became disabled
([#6538](https://github.com/elastic/eui/pull/6538))

**Breaking changes**

- `EuiModalHeaderTitle` now **always** wraps its children in a `h1` tag
(previously attempted to conditionally detect whether its children were
raw strings or not). To change this tag type to, e.g. a more generic
`div`, use the new `component` prop.
([#6530](https://github.com/elastic/eui/pull/6530))
- `EuiLink` now applies `rel="noreferrer"` to all domains, including
`elastic.co` ([#6535](https://github.com/elastic/eui/pull/6535))
- `EuiBasicTable` no longer blocks mouse/keyboard interactions while
`loading` ([#6543](https://github.com/elastic/eui/pull/6543))

**CSS-in-JS conversions**

- Converted `EuiBasicTable` to Emotion
([#6539](https://github.com/elastic/eui/pull/6539))
- Added a new `RenderWithEuiTheme` render prop utility
([#6539](https://github.com/elastic/eui/pull/6539))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-01-27 13:03:56 -06:00
Kevin Lacabane
de7eb48f91
[Stack Monitoring] working with packages doc (#149067)
## Summary

Added howto work with packages documentation
2023-01-26 13:15:22 +01:00
Carlos Crespo
252d81c46a
[Infrastructure UI] Add lens charts to hosts view (#148906)
## Summary

closes https://github.com/elastic/obs-infraobs-team/issues/921

This PR introduces a series of lens charts to hosts view page.

![out](https://user-images.githubusercontent.com/2767137/214100703-1847586a-fa87-4c2c-9eb0-af5271667702.gif)

The Lens embeddable component is fully integrated, allowing the filters
to react to clicks on the charts as well as accessing Lens directly from
the chart

The charts will show metrics for:
- Load
- CPU Usage
- RX
- TX
- Memory 
- Disk Read
- Disk Write


### How to test
- Using metricbeat
  - Enable system metric in metricbeat
  - Start your local ES

- Using oblt
  - configure kibana.dev.yml with your oblt-cluster

- Using slingshot
- Clone https://github.com/elastic/slingshot and run slingshot yarn
slingshot load --config ./configs/hosts.json

- Start your local ES
- Start kibana
- Navigate to Infrastructure > Hosts

### Notes
- I've renamed a few things that started to become confusing after this
change.
- The structure created for the lens vis is similar to the
inventory_model, but here is only used in `public` and I've placed them
as a common functionality, since this might also be used in other pages
in the future.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-25 10:17:52 +01:00
jennypavlova
066ee1c9e8
[Stack Monitoring] Collect metrics errors in health api (#148750)
Closes https://github.com/elastic/kibana/issues/140358

## Summary
This PR adds integration package errors to the `_health` endpoint. The
response should look similar to the metricbeat one we already have. The
difference will be that the package will use `data_stream.dataset`
instead of `metricset.name`

## Testing

1. Setup an integration
- Follow this
[guide](0e924730cc/docs/infra-obs-ui/stack-monitoring_integration-packages.md)
to install the package. ~~⚠️ Note that you need to have `metricset.name`
mapping to see the errors added in this
[PR](https://github.com/elastic/integrations/pull/4973)~~ - No need
anymore as we use `data_stream.dataset` for packages
2. Installing the package: 
- In this case, we want to enable metrics and set the Agent policy to
Elastic-Agent (elastic-package). To see an error I used the wrong host
URL (inside `Change Defaults`) when I was configuring the elasticsearch
integration:
 
<img width="1313" alt="image"
src="https://user-images.githubusercontent.com/14139027/212313537-f1f6f5b1-6e4d-40f2-8f78-9f0e5f48c434.png">

3. To see the package errors run `curl --user elastic:changeme
http://localhost:5602/ftw/api/monitoring/v1/_health` or open
http://localhost:5602/ftw/api/monitoring/v1/_health in a browser where
you are logged in in your kibana. (The port of the kibana is 5602 as
mentioned in the
[guide](0e924730cc/docs/infra-obs-ui/stack-monitoring_integration-packages.md (connecting-a-local-kibana))
this will be your local kibana running - I recommend to add the package
to the elastic package kibana running on 5601 and to run your local
kibana after the setup is complete)
 
Example response:
```
{
    "metricbeatErrors": {
        ...
    },
    "packageErrors": {
        "products": {
            "elasticsearch": {
                "elasticsearch.stack_monitoring.node": [
                    {
                        "message": "error making http request: Get \"http://localhost:9200/_nodes/_local\": dial tcp 127.0.0.1:9200: connect: connection refused",
                        "lastSeen": "2023-01-12T17:27:01.862Z"
                    }
                ],
                "elasticsearch.stack_monitoring.node_stats": [
                    {
                        "message": "error making http request: Get \"http://localhost:9200/_nodes/_local/stats\": dial tcp [::1]:9200: connect: cannot assign requested address",
                        "lastSeen": "2023-01-12T17:26:31.883Z"
                    }
                ],
                .....
            },
            "execution": {
                "timedOut": false,
                "errors": []
            }
        }
    }
}
```
2023-01-17 14:01:18 +01:00
Zacqary Adam Xeper
ff6024defc
[Alert Summaries] [FE] Move “Notify When” and throttle from rule to action (#145637)
## Summary

Closes #143369 (~blocked by
https://github.com/elastic/kibana/issues/143376~)

This PR updates the Stack Management UI and Observability UI to show
Notify When and Throttle parameters at the **action level** instead of
the **rule level**.

The rule-level Check Every dropdown is moved to the end of the rule,
right above the actions form

The Security Solution UX remains unchanged, as it has a unique way of
displaying action notification frequencies at the rule level. Instead,
the API request has changed so that the selected action frequency will
now be stored in each action's `frequency` param instead of at the rule
level.

In all three UIs, existing rules that have legacy rule-level
`notifyWhen` and `frequency` params will have these parameters
seamlessly migrated to the action level when the user edits a rule.

The Rule Details page is also updated to show Notify frequencies in the
Actions column instead of in the first, rule-level column.

### Rule Details Page update
<img width="781" alt="Screen Shot 2022-11-17 at 4 23 02 PM"
src="https://user-images.githubusercontent.com/1445834/202573067-bc55630d-f767-4a93-8d7c-752748da25c2.png">

### Rule Form update
<img width="605" alt="Screen Shot 2022-11-17 at 4 23 10 PM"
src="https://user-images.githubusercontent.com/1445834/202573057-5d50e573-1453-4b63-8e1e-6505fa0261c6.png">
<img width="605" alt="Screen Shot 2022-12-27 at 1 18 12 PM"
src="https://user-images.githubusercontent.com/1445834/209712784-34c2384b-bcc8-4db9-a42d-052d81099a40.png">

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

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Xavier Mouligneau <xavier.mouligneau@elastic.co>
2023-01-10 14:01:44 -06:00
Marco Antonio Ghiani
296025b1e7
[Stack Monitoring] Filter CCR list by currently viewed cluster (#148018)
## 📓 Summary

Closes #147224 

The issue was caused by the missing usage of the `clusterUuid` parameter
in the query used to retrieve the cluster followers and stats.

Adding a `term` condition for the cluster_uuid now retrieves only the
followers related to the interested cluster. In case a cluster has no
followers, an empty list will be returned by the endpoint.

This PR also adds stronger typing against the data returned by the
endpoint and adds some minor improvements.

## 🧪 Testing
Testing locally this PR requires some effort since is necessary to
create a multi-cluster locally.
Following [this
guide](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/dev_docs/how_to/running_components_from_source.md#multi-cluster-tests-for-ccrccs-or-listing)
is possible to locally setup the 2 cluster and make one of them follow
the other.
Also, the new issue
[oblt#3279](https://github.com/elastic/observability-test-environments/issues/3279)
has been opened to have an easier way to access a multi-cluster setup
with oblt clusters.

### Before bugfix


https://user-images.githubusercontent.com/34506779/209954682-b519fcd3-888b-472a-8a1d-acf57ff5de05.mov

### After bugfix


https://user-images.githubusercontent.com/34506779/209954718-5045c49e-f113-42e5-aabf-81d2c5f53556.mov

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-04 08:16:28 +01:00
Mike Côté
0c8c4d7d0a
[Actions] Remove duplicated ActionResult type from common folder (#148001)
Resolves https://github.com/elastic/kibana/issues/132412.

In this PR, I'm removing `ActionResult` type from the `/common` folder
as it is an old copy of the `ActionResult` used and provided by the
`/server` folder.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-01-03 08:45:37 -07:00
Milton Hultgren
0b83a2a61a
[Monitoring] Read expiryDateMS from the right path in License rule (#148129)
The license details have been placed under the `meta` property but the
context messages were not updated to read correctly from that path, this
PR fixes that little issue.
2022-12-29 18:28:13 +01:00
Marco Antonio Ghiani
57934183eb
[Logs UI] Migrate usages of defineInternalSourceConfiguration to defineInternalLogView with new LogViewService (#147673)
## 📝  Summary

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

With the introduction of the "log view" concept in
https://github.com/elastic/kibana/pull/125014, this PR migrates all
usages of the previous `defineInternalSourceConfiguration` function in
the infra plugin's setup() contract to the new
`logViews.defineInternalLogView` function on the contract.

This affects `enterprise_search`, `monitoring` and `upgrade_assistant`
plugins.

**N.B.** As these usages were not following the same restrictive
configuration for the attributes we have now defined in the
`.defineInternalLogView` method, I made the `logViewAttributes` passed
to `logViews.defineInternalLogView` merge with the
`defaultLogViewAttributes`.

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-29 09:02:11 +01:00
Spencer
afb09ccf8a
Transpile packages on demand, validate all TS projects (#146212)
## Dearest Reviewers 👋 

I've been working on this branch with @mistic and @tylersmalley and
we're really confident in these changes. Additionally, this changes code
in nearly every package in the repo so we don't plan to wait for reviews
to get in before merging this. If you'd like to have a concern
addressed, please feel free to leave a review, but assuming that nobody
raises a blocker in the next 24 hours we plan to merge this EOD pacific
tomorrow, 12/22.

We'll be paying close attention to any issues this causes after merging
and work on getting those fixed ASAP. 🚀

---

The operations team is not confident that we'll have the time to achieve
what we originally set out to accomplish by moving to Bazel with the
time and resources we have available. We have also bought ourselves some
headroom with improvements to babel-register, optimizer caching, and
typescript project structure.

In order to make sure we deliver packages as quickly as possible (many
teams really want them), with a usable and familiar developer
experience, this PR removes Bazel for building packages in favor of
using the same JIT transpilation we use for plugins.

Additionally, packages now use `kbn_references` (again, just copying the
dx from plugins to packages).

Because of the complex relationships between packages/plugins and in
order to prepare ourselves for automatic dependency detection tools we
plan to use in the future, this PR also introduces a "TS Project Linter"
which will validate that every tsconfig.json file meets a few
requirements:

1. the chain of base config files extended by each config includes
`tsconfig.base.json` and not `tsconfig.json`
1. the `include` config is used, and not `files`
2. the `exclude` config includes `target/**/*`
3. the `outDir` compiler option is specified as `target/types`
1. none of these compiler options are specified: `declaration`,
`declarationMap`, `emitDeclarationOnly`, `skipLibCheck`, `target`,
`paths`

4. all references to other packages/plugins use their pkg id, ie:
	
	```js
    // valid
    {
      "kbn_references": ["@kbn/core"]
    }
    // not valid
    {
      "kbn_references": [{ "path": "../../../src/core/tsconfig.json" }]
    }
    ```

5. only packages/plugins which are imported somewhere in the ts code are
listed in `kbn_references`

This linter is not only validating all of the tsconfig.json files, but
it also will fix these config files to deal with just about any
violation that can be produced. Just run `node scripts/ts_project_linter
--fix` locally to apply these fixes, or let CI take care of
automatically fixing things and pushing the changes to your PR.

> **Example:** [`64e93e5`
(#146212)](64e93e5806)
When I merged main into my PR it included a change which removed the
`@kbn/core-injected-metadata-browser` package. After resolving the
conflicts I missed a few tsconfig files which included references to the
now removed package. The TS Project Linter identified that these
references were removed from the code and pushed a change to the PR to
remove them from the tsconfig.json files.

## No bazel? Does that mean no packages??
Nope! We're still doing packages but we're pretty sure now that we won't
be using Bazel to accomplish the 'distributed caching' and 'change-based
tasks' portions of the packages project.

This PR actually makes packages much easier to work with and will be
followed up with the bundling benefits described by the original
packages RFC. Then we'll work on documentation and advocacy for using
packages for any and all new code.

We're pretty confident that implementing distributed caching and
change-based tasks will be necessary in the future, but because of
recent improvements in the repo we think we can live without them for
**at least** a year.

## Wait, there are still BUILD.bazel files in the repo
Yes, there are still three webpack bundles which are built by Bazel: the
`@kbn/ui-shared-deps-npm` DLL, `@kbn/ui-shared-deps-src` externals, and
the `@kbn/monaco` workers. These three webpack bundles are still created
during bootstrap and remotely cached using bazel. The next phase of this
project is to figure out how to get the package bundling features
described in the RFC with the current optimizer, and we expect these
bundles to go away then. Until then any package that is used in those
three bundles still needs to have a BUILD.bazel file so that they can be
referenced by the remaining webpack builds.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 19:00:29 -06:00
Pierre Gayvallet
69272653b3
Remove InjectedMetadata browser-side public contract (#147840)
## Summary

Fix https://github.com/elastic/kibana/issues/147721

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-21 01:03:57 -07:00
Kevin Lacabane
10c4989a19
[Stack Monitoring] Add support for beats datastream patterns (#146184)
## Summary
Closes https://github.com/elastic/kibana/issues/146686

Update apm and beats queries to read from the Beat package data streams
created in https://github.com/elastic/integrations/pull/4708. Also
updates health API to fetch from the data streams.

API tests follow up in https://github.com/elastic/kibana/pull/147755

### Testing
That's a fairly heavy workflow. I'm investigating ways to make that
easier

- build `beat` package with `elastic-package build`. The package is not
published yet so you'll need to pull
https://github.com/elastic/integrations/pull/4708 locally
- start a stack `elastic-package stack up -v -d --version
8.7.0-SNAPSHOT`. Make sure you do this within `integrations` repo so it
picks up the previously built package
- start a beat service with `elastic-package service up -v --variant
metricbeat_8.7.0`
- install both elasticsearch and beat packages from the kibana started
by the stack command (`https://localhost:5601`). Nothing shows up in SM
if we don't have elasticsearch data.
- both packages are prerelease versions and we need to explicitly tell
Integrations plugin to show them up[1]
- elasticsearch hosts is `https://elasticsearch:9200` and beat _should
be_ `http://elastic-package-service_beat_1:5066` but it may differ
depending on your docker version
- start a Kibana with this branch connected to the elasticsearch
instance from the `stack up` command. [see
howto](https://github.com/elastic/observability-dev/blob/main/docs/infra-obs-ui/stack-monitoring_integration-packages.md#connecting-a-local-kibana)
- navigate to Stack Monitoring and verify the metricbeat is properly
monitored
- start an apm server with `elastic-package service up -v --variant
apm_8.7.0`
- navigate to Stack Monitoring and verify apm-server is properly
monitored


[1]
<img width="853" alt="Screenshot 2022-12-01 at 00 20 20"
src="https://user-images.githubusercontent.com/5239883/204929352-c7656679-f88c-4013-b1f8-cf7c67d4c830.png">

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-19 15:04:55 +01:00
Carlos Crespo
4a3af9c97b
[Infrastructure UI] Add parameter Snapshot API to not query using histogram (#146573)
## Summary

closes #146517 

This PR expands the current `includeTimeseries` parameter behaviour, by
not using the `date_histogram` in the `composite` aggregation when it is
set to `false`.

This way, not only the API won't return a `timeseries` object, but the
query will calculate the aggregations on ES side as opposed to when
`includeTimeseries` is true, that does an extra `avg` and `max`
calculation on TS side using the histogram buckets.

The main motivation behind this change is to run the snapshot query
without the need of returning buckets, to avoid the max bucket error.

### How to test
- Enable the system module on metricbeat
- Start a local Kibana 
- Start metricbeat
- Explore `Infrastructure > Metrics`, `Infrastructure > Inventory` and
`Infrastructure > Hosts` and play with the filters

#### cURL

##### Run a query with Composite aggregation
###### With timeseries
```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"memory"}],"groupBy":[],"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":true}' \
  -u elastic:changeme
```

###### Without timeseries
```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"memory"}],"groupBy":[],"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":false}' \
  -u elastic:changeme
```

##### Run a query with just Date Histogram
###### With timeseries
```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"memory"}],"groupBy":null,"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":true}' \
  -u elastic:changeme
```
##### Without timeseries
```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"memory"}],"groupBy":null,"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":false}' \
  -u elastic:changeme
```

### For maintainers
The `logRate` metric type <b>doesn't</b> work without being in a date
histogram, because it uses [cumulative
sum](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-cumulative-sum-aggregation.html).
Therefore `includeTimeseries` false in a `composite` aggregation will
return a 400 error. I haven't found anywhere that would make a request
like below.

#### 400 error

```bash
curl -XPOST -f 'http://0.0.0.0:5601/ftw/api/metrics/snapshot'  \
  -H 'kbn-xsrf:localhost' \
  -H 'Content-Type: application/json'  \
  --data-raw '{"filterQuery":"{\"bool\":{\"must\":[],\"filter\":[],\"should\":[],\"must_not\":[]}}","metrics":[{"type":"logRate"}],"groupBy":[],"nodeType":"host","sourceId":"default","accountId":"","region":"","timerange":{"from":1670859470896,"to":1670861030896,"interval":"1m","ignoreLookback":true},"includeTimeseries":false}' \
  -u elastic:changeme
```

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-16 14:34:29 +01:00
Chris Cowan
747704544f
Adding duration configuration to Stack Monitoring Cluster Health rule (#147565)
## Summary

This PR fixes #145843 by adding the ability to configure `duration` for
the Stack Monitoring "Legacy Rules" along with a set of default rule
parameters and custom validation; which can be configured per rule.
There are three new attributes added the the LEGACY_RULE_DETAILS object:

- `defaults` – The default values for parameters (so we can set the
default duration to `2m` for Cluster Health)
- `expressionConfig` – Configuration for turning on/off UI elements
(like duration)
- `validate` – A custom validate function (so we can ensure `duration`
is provided)

This will also allow us control over which of the legacy rules gets
duration and which ones we want to keep "as is". It also makes room for
adding additional UI features in the future.

<img width="618" alt="image"
src="https://user-images.githubusercontent.com/41702/207685736-d8dc3023-66d0-4e40-a564-830f290ec1e1.png">

### 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
2022-12-15 12:23:21 -07:00
Kevin Lacabane
a3a90f3dd2
[Stack Monitoring] health api note (#147210)
## Summary

Added note about the health API in runbooks
2022-12-12 15:41:32 +01:00
Carlos Crespo
a59ecbc31a
[Stack Monitoring] Enable allowjs on tsconfig (#145719)
## Summary

Closes #144289

PR resolves TS errors after enabling allowJs in tsconfig file.

There are still ~40 files that unnecessarily use the @ts-gnore
annotation and those can now be removed, but to avoid creating a
gigantic PR, I've decided to open this one focusing only on the bare
minimum to enable the allowJs parameter.

### How to test

- Start local Kibana
- Go to stack monitoring and try to access all the pages there.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Kevin Lacabane <kevin.lacabane@elastic.co>
2022-11-30 13:55:20 +01:00
Carlos Crespo
f7b846467f
[Stack Monitoring] Remove ts-ignore annotation (#145759)
## Summary

Closes #144289

This PR just removes ts-ignore annotation where it's not needed anymore.

### How to test

- Start local Kibana
- Go to stack monitoring and try to access all the pages there.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-11-30 10:52:27 +01:00
Milton Hultgren
5c13741663
[Stack Monitoring] Remove visible semicolon from LoadingPage (#146500)
Fixes #146342

There was a semicolon added to the JSX markup which would show on slower
devices where loading takes longer.
Please refer to the issue for a screenshot of that.
2022-11-29 02:17:29 -07:00
Kevin Lacabane
5cf0d0f248
[Stack Monitoring] api tests for cluster and elasticsearch (#145138)
### Summary
Part of https://github.com/elastic/kibana/issues/119658

Add api integration tests for cluster and elasticsearch routes to
validate behavior when reading data ingested by elastic-agent.

We currently have a testing suite for legacy and another one for
metricbeat. Since metricbeat and agent documents only differ in their
metadata, for example agent will populate a `data_stream.*` property to
identify the document types while metricbeat uses `metricset.*`, the
tests assertion validating _business_ data should pass regardless of the
documents source. With this in mind the metricbeat tests were updated to
run the tests twice, one time with metricbeat data and a second time
with package data.

To generate the archives the `metrics-*` mappings were extracted with
esArchiver from an elasticsearch with the package installed, and the
documents were transformed from the metricbeat documents with [this
script](https://gist.github.com/klacabane/654497ff86053c60af6df15fa6f6f657).

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-11-22 14:02:50 +01:00
Constance
c408cebb12
Upgrade EUI to v70.2.4 (#144845)
## Summary
`eui@67.1.8`  `eui@70.2.2`

⚠️ Note: This upgrade contains breaking changes to `EuiFlexGroup` and
`EuiFlexGrid`, primarily around switching margins and negative margins
to `gap`. Please do a quick QA pass of your app to scan for any issues.
We're happy to help resolve minor fixes, or potentially follow up after
PR merges. You can find us over in #eui!

## [`70.2.4`](https://github.com/elastic/eui/tree/v70.2.4)

**Bug fixes**

- Fixed visual bug in nested `EuiFlexGroup`s, where the parent
`EuiFlexGroup` is responsive but a child `EuiFlexGroup` is not
([#6381](https://github.com/elastic/eui/pull/6381))

## [`70.2.3`](https://github.com/elastic/eui/tree/v70.2.3)

**Bug fixes**

- Fixed incorrect margins in `EuiSuperDatePicker` caused by `EuiFlex`
CSS gap change ([#6380](https://github.com/elastic/eui/pull/6380))

## [`70.2.2`](https://github.com/elastic/eui/tree/v70.2.2)

- `EuiButton` now accepts `minWidth={false}`
([#6373](https://github.com/elastic/eui/pull/6373))

**Bug fixes**

- `EuiButton` no longer outputs unnecessary inline styles for
`minWidth={0}` or `minWidth={false}`
([#6373](https://github.com/elastic/eui/pull/6373))
- `EuiFacetButton` no longer reports type issues when passing props
accepted by `EuiButton`
([#6373](https://github.com/elastic/eui/pull/6373))
- Fixed the shadow sizes of `.eui-yScrollWithShadows` and
`.eui-xScrollWithShadows`
([#6374](https://github.com/elastic/eui/pull/6374))


## [`70.2.1`](https://github.com/elastic/eui/tree/v70.2.1)

**Bug fixes**

- Re-fixed `EuiPageSection` not correctly merging `contentProps.css`
([#6365](https://github.com/elastic/eui/pull/6365))
- Fixed `EuiTab` not defaulting to size `m`
([#6366](https://github.com/elastic/eui/pull/6366))

## [`70.2.0`](https://github.com/elastic/eui/tree/v70.2.0)

- Added a keyboard shortcuts popover to `EuiDataGrid`'s toolbar. This
can be visually hidden via `toolbarVisibility.showKeyboardShortcuts`,
but will always remain accessible to keyboard and screen reader users.
([#6036](https://github.com/elastic/eui/pull/6036))
- `EuiScreenReaderOnly`'s `showOnFocus` prop now also shows on focus
within its children ([#6036](https://github.com/elastic/eui/pull/6036))
- Added `onFocus` prop callback to `EuiSuperDatePicker`
([#6320](https://github.com/elastic/eui/pull/6320))

**Bug fixes**

- Fixed `EuiSelectable` to ensure the full options list is re-displayed
when the search bar is controlled and cleared using `searchProps.value`
([#6317](https://github.com/elastic/eui/pull/6317))
- Fixed incorrect padding on `xl`-sized `EuiTabs`
([#6336](https://github.com/elastic/eui/pull/6336))
- Fixed `EuiCard` not correctly merging `css` on its child `icon`s
([#6341](https://github.com/elastic/eui/pull/6341))
- Fixed `EuiCheckableCard` not setting `css` on the correct DOM node
([#6341](https://github.com/elastic/eui/pull/6341))
- Fixed a webkit rendering issue with `EuiModal`s containing
`EuiBasicTable`s tall enough to scroll
([#6343](https://github.com/elastic/eui/pull/6343))
- Fixed bug in `to_initials` that truncates custom initials
([#6346](https://github.com/elastic/eui/pull/6346))
- Fix bug in `EuiCard` where layout breaks when `horizontal` and
`selectable` are both passed
([#6348](https://github.com/elastic/eui/pull/6348))

## [`70.1.0`](https://github.com/elastic/eui/tree/v70.1.0)

- Added the `hint` prop to the `<EuiSearchBar />`. This prop lets the
consumer render a hint below the search bar that will be displayed on
focus. ([#6319](https://github.com/elastic/eui/pull/6319))
- Added the `hasDragDrop` prop to `EuiPopover`. Use this prop if your
popover contains `EuiDragDropContext`.
([#6329](https://github.com/elastic/eui/pull/6329))

**Bug fixes**

- Fixed `EuiButton`'s cursor style when the button is disabled
([#6323](https://github.com/elastic/eui/pull/6323))
- Fixed `EuiPageTemplate` not recognizing child
`EuiPageSidebar`s/`EuiPageTemplate.Sidebar`s with `css` props
([#6324](https://github.com/elastic/eui/pull/6324))
- Fixed `EuiBetaBadge` to always respect its `anchorProps` values,
including when there is no tooltip content
([#6326](https://github.com/elastic/eui/pull/6326))
- Temporarily patched `EuiModal` to not cause scroll-jumping issues on
modal open ([#6327](https://github.com/elastic/eui/pull/6327))
- Fixed buggy drag & drop behavior within `EuiDataGrid`'s columns &
sorting toolbar popovers
([#6329](https://github.com/elastic/eui/pull/6329))
- Fixed `EuiButton` not correctly passing `textProps` for children
inside fragments or i18n components
([#6332](https://github.com/elastic/eui/pull/6332))
- Fixed `EuiButton` not correctly respecting `minWidth={0}`
([#6332](https://github.com/elastic/eui/pull/6332))

**CSS-in-JS conversions**

- Converted `EuiTabs` to Emotion
([#6311](https://github.com/elastic/eui/pull/6311))

## [`70.0.0`](https://github.com/elastic/eui/tree/v70.0.0)

- Added the `enabled` option to the `<EuiInMemoryTable />`
`executeQueryOptions` prop. This option prevents the Query from being
executed when controlled by the consumer.
([#6284](https://github.com/elastic/eui/pull/6284))

**Bug fixes**

- Fixed `EuiOverlayMask` to set a
`[data-relative-to-header=above|below]` attribute to replace the
`--aboveHeader` and `--belowHeader` classNames removed in its Emotion
conversion ([#6289](https://github.com/elastic/eui/pull/6289))
- Fixed `EuiHeader` CSS using removed `EuiOverlayMask` class modifiers
([#6293](https://github.com/elastic/eui/pull/6293))
- Fixed `EuiToolTip` not respecting reduced motion preferences
([#6295](https://github.com/elastic/eui/pull/6295))
- Fixed a bug with `EuiTour` where passing any `panelProps` would cause
the beacon to disappear
([#6298](https://github.com/elastic/eui/pull/6298))

**Breaking changes**

- `@emotion/css` is now a required peer dependency, alongside
`@emotion/react` ([#6288](https://github.com/elastic/eui/pull/6288))
- `@emotion/cache` is no longer required peer dependency, although your
project must still use it if setting custom cache/injection locations
([#6288](https://github.com/elastic/eui/pull/6288))

**CSS-in-JS conversions**

- Converted `EuiCode` and `EuiCodeBlock` to Emotion; Removed
`euiCodeSyntaxTokens` Sass mixin and `$euiCodeBlockPaddingModifiers`;
([#6263](https://github.com/elastic/eui/pull/6263))
- Converted `EuiResizableContainer` and `EuiResizablePanel` to Emotion
([#6287](https://github.com/elastic/eui/pull/6287))

## [`69.0.0`](https://github.com/elastic/eui/tree/v69.0.0)

- Added support for `fullWidth` prop on EuiForm, which will be the
default for all rows/controls within
([#6229](https://github.com/elastic/eui/pull/6229))
- Added support for `onResizeStart` and `onResizeEnd` callbacks to
`EuiResizableContainer`
([#6236](https://github.com/elastic/eui/pull/6236))
- Added optional case sensitive option matching to `EuiComboBox` with
the `isCaseSensitive` prop
([#6268](https://github.com/elastic/eui/pull/6268))
- `EuiFlexItem` now supports `grow={0}`
([#6270](https://github.com/elastic/eui/pull/6270))
- Added the `alignItems` prop to `EuiFlexGrid`
([#6281](https://github.com/elastic/eui/pull/6281))
- Added `filter`, `filterExclude`, `filterIgnore`, `filterInclude`,
`indexTemporary`, `infinity`, `sortAscending`, and `sortDescending`
glyphs to `EuiIcon` ([#6282](https://github.com/elastic/eui/pull/6282))

**Bug fixes**

- Fixed `EuiTextProps` to show the `color` type option `inherit` as
default ([#6267](https://github.com/elastic/eui/pull/6267))
- `EuiFlexGroup` now correctly respects `gutterSize` when responsive
([#6270](https://github.com/elastic/eui/pull/6270))
- Fixed the last breadcrumb in `EuiBreadcrumbs`'s `breadcrumbs` array
not respecting `truncate` overrides
([#6280](https://github.com/elastic/eui/pull/6280))

**Breaking changes**

- `EuiFlexGrid` no longer supports `columns={0}`. Use `EuiFlexGroup`
instead for normal flex display
([#6270](https://github.com/elastic/eui/pull/6270))
- `EuiFlexGrid` now uses modern `display: grid` CSS
([#6270](https://github.com/elastic/eui/pull/6270))
- `EuiFlexGroup`, `EuiFlexGrid`, and `EuiFlexItem` now use modern `gap`
CSS instead of margins and negative margins
([#6270](https://github.com/elastic/eui/pull/6270))
- `EuiFlexGroup` no longer applies responsive styles to `column` or
`columnReverse` directions
([#6270](https://github.com/elastic/eui/pull/6270))

**CSS-in-JS conversions**

- Converted `EuiFlexGroup`, `EuiFlexGrid`, and `EuiFlexItem` to Emotion
([#6270](https://github.com/elastic/eui/pull/6270))

## [`68.0.0`](https://github.com/elastic/eui/tree/v68.0.0)

- Added `beta` glyph to `EuiIcon`
([#6250](https://github.com/elastic/eui/pull/6250))
- Added `launch` and `spaces` glyphs to `EuiIcon`
([#6260](https://github.com/elastic/eui/pull/6260))
- Added the `fallbackDestination` prop to `EuiSkipLink`, which accepts a
string of query selectors to fall back to if the `destinationId` does
not have a valid target. Defaults to `main`
([#6261](https://github.com/elastic/eui/pull/6261))
- `EuiSkipLink` is now always an `a` tag to ensure that it is always
placed within screen reader link menus.
([#6261](https://github.com/elastic/eui/pull/6261))

**Bug fixes**

- Fixed `EuiSuperDatePicker` not correctly merging passed `className`s
([#6253](https://github.com/elastic/eui/pull/6253))
- Fixed `EuiColorStops` not correctly merging in passed
`data-test-subj`s, `style`s, or `...rest`
([#6255](https://github.com/elastic/eui/pull/6255))
- Fixed `EuiResizablePanel` incorrectly passing `style` to the wrapper
instead of the panel. Use `wrapperProps.style` to pass styles to the
wrapper. ([#6255](https://github.com/elastic/eui/pull/6255))
- Fixed custom `onClick`s passed to `EuiSkipLink` overriding
`overrideLinkBehavior`
([#6261](https://github.com/elastic/eui/pull/6261))

**Breaking changes**

- Removed `inherit` and `ghost` color from `EuiListGroupItem`
([#6207](https://github.com/elastic/eui/pull/6207))
- Changed default color to `text` instead of `inherit`
([#6207](https://github.com/elastic/eui/pull/6207))

**CSS-in-JS conversions**

- Converted `EuiListGroup` and `EuiListGroupItem` to Emotion; Removed
`$euiListGroupGutterTypes`, `$euiListGroupItemColorTypes` and
`$euiListGroupItemSizeTypes`;
([#6207](https://github.com/elastic/eui/pull/6207))
- Converted `EuiBadgeGroup` to Emotion
([#6258](https://github.com/elastic/eui/pull/6258))
- Converted `EuiBetaBadge` to Emotion
([#6258](https://github.com/elastic/eui/pull/6258))
- Converted `EuiNotificationBadge` to Emotion
([#6258](https://github.com/elastic/eui/pull/6258))

Co-authored-by: Elizabet Oliveira <elizabet.oliveira@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-11-18 14:21:28 -06:00
Jonathan Budzenski
2ac7ebe3bf
Upgrade to Jest 29 (#143319)
https://jestjs.io/blog/2022/04/25/jest-28
https://jestjs.io/blog/2022/08/25/jest-29

- jest.useFakeTimers('legacy') -> jest.useFakeTimers({ legacyFakeTimers:
true });
- jest.useFakeTimers('modern'); -> jest.useFakeTimers();
- tests can either use promises or callbacks, but not both
- test runner jasmine is no longer included, switch all suites to
jest-circus

Co-authored-by: Andrew Tate <andrew.tate@elastic.co>
2022-11-18 09:40:16 -06:00
Milton Hultgren
b7debc839f
[Stack Monitoring] Use doc ID to deduplicate shard allocations (#143963)
## Summary

This PR depends on Metricbeat changes introduced in this PR
https://github.com/elastic/beats/pull/33457 or the Internal collection
changes introduced in
https://github.com/elastic/elasticsearch/pull/91153.

The above PR fixes a bug that makes Metricbeat properly report on all
the shards in an index, but our shard legend had the same kind of bug,
it only displayed the first replica because it didn't account for the
replica "id" in the function that tries to deduplicate the results.

Since the above PR ensures we report each shard with a unique document
ID, we change the Kibana code to use the document ID instead of trying
to regenerate a unique ID.

### How to test
Get the changes: `git fetch git@github.com:miltonhultgren/kibana.git
sm-shard-allocations:sm-shard-allocations && git switch
sm-shard-allocations`

Start Elasticsearch, create an index like this:
```
PUT /some-index
{
  "settings": {
    "index": {
      "number_of_shards": 3,  
      "number_of_replicas": 3
    }
  }
}
```

Run Metricbeat with `xpack.enabled: true`. 

Visit the Index details page for `some-index` in the Stack Monitoring
app and verify that on a single node cluster you have 12 shards, 9 of
which are unassigned.

<img width="753" alt="Screenshot 2022-10-25 at 17 19 25"
src="https://user-images.githubusercontent.com/2564140/197819368-8ea45e1c-7472-4e15-9267-3b5d73378f2a.png">

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-11-17 10:44:58 +01:00
Dmitry Tomashevich
a9162f7481
[Discover] Enable esQuery alert for adhoc data views (#140885)
## Summary

Closes #142514 #142389

This PR does the following: 
- Enables to create `esQuery` (in KQL or Lucene mode) using adhoc data
views from discover and management pages
- Adds `explore matching indices` button to data view picker in alert
flyout
- Adding adhoc data views from alert flyout should propage them to a
main discover picker


### 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] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))
- [x] 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)
- [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))

Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
2022-11-09 18:55:34 +03:00
Bree Hall
4e9f1c0d04
Bumping EUI to version 67.1.8 (#141279)
* Updated EUI to version 67.1.2. Updated instaces of ButtonColor from EUI to EuiButtonColor.

* Updated to EuiCard instances that utilize the betaBadgeProps object to return an empty string instead of undefined when the label is unavailable

* Removed two instances of the deprecated internetExplorerOnly() mixin

* Updated two instances of the ButtonColor import to EuiButtonColor as is was renamed in PR #6150

* Updated snapshots in Jest Test Suite #1 to account for EuiButton and EuiCard Emotion conversions. Updated snapshots for EuiTooltip as it now contains the new EuiToolTipAnchor component that replaced the tooltip anchor styles

* Updated snapshots in Jest Test Suite #2 to account forEuiButton, EuiDescriptionList, EuiButtonIcon, and EuiBadge Emotion conversions.

* Updated snapshots in Jest Test Suite #3 to account for EuiDescriptionList, EuiButton, and EuiBadge Emotion conversions. Updated snapshots for EuiTooltip as if now contains the new EuiTooltipAnchor component that replaced the tooltop anchor styles

* Updated snapshots in Jest Test Suite #4 to account for EuiButton Emotion conversion.

* Updated snapshots in Jest Test Suite #5 to account for EuiButton Emotion conversion.

* Updated snapshots in Jest Test Suite #8 to account for EuiButtonIcon and EuiButton Emotion conversions. Updated snapshots for EuiTooltip as it now contains the new EuiTooltipAnchor component that replaced the tooltip anchor styles.

* Updated snapshots in Jest Test Suite #9 to account for EuiFlyout and EuiButton Emotion conversions.

* Updated snapshots in Jest Test Suite #10 to account for EuiButton, EuiBadge, EuiButtonIcon, and EuiCard Emotion conversions. Updated snapshots for EuiToolTtip as it now contains the new EuiTooltipAnchor component that replaced the tooltip anchor styles

* Updated instances of EuiButtonIconColor to use EuiButtonIconProps['color'] as it was removed in PR #6150

* Updated tests that target EuiButton to simulate click events to target a generic button to prevent undefined click event errors

* Updated snapshots in Jest Test Suite #1 to account for EuiButton and EuiCard Emotion conversions

* Added the EuiFlyout mixins and variables to Lens Sass file as EuiFlyout has been converted to Emotion and the Sass styles are no longer available in EUI

* Added the EuiCallOutTypes variable to Step Progress Sass file as EuiCallOut has been converted to Emotion and the Sass styles are no longer available in EUI

* Updated snapshots in Jest Test Suite #2 to account for recent Emotion conversions.
Updated snapshots in server_status.test.tsx to render EuiBadge before checking the snapshots to reduce the snapshot churn caused by Emotion.
Updated tests that target EuiButton to simulate click events to target a generic button to prevent undefined click event errors

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Added imports for the added flyout mixin. Removed references to EuiCallOut mixin as the component has been converted to Emotion and is no longer available for use.

* Updated unit tests and snapshots in Jest Test Suite #10.
Updated snaphshots to account for EuiBadge, EuiDescriptionList, EuiFlyout, and EuiCard Emotion conversions. Updated snapshots for EuiTooltip as it now contains the new EuiTooltipAnchor component that replaced the tooltip anchor styles.
Updated tests that target EuiButton to simulate click events to target a generic button element to prevent undefined click event errors

* Updated unit tests in Jest Test Suite #11 that target EuiButton to simulate click events to target a generic button to prevent undefined click event errors

* Updated unit tests in Jest Test Suite #12 by updating tests that target EuiButton to simulate click events. Instead, these tests now target a generic button element to prevent undefined click event errors

* Updated unit tests in Jest Test Suite #1 by updating tests that target EuiButton to simulate click events. Instead, these tests now target a generic button element to prevent undefined click event errors

* Updated unit tests in Jest Test Suite #2 by updating tests that use EuiButton to simulate click events. Instead, these test have been updated to target a button element to prevent undefined click event errors.

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Updated reference to mixins Sass file.
Updated snapshots for Jest Test Suite #5 to account for EuiButton Emotion conversion. Updated unit tests that target EuiButton to simulate click events. These tests have been updated to target a button element to prevent undefined click event errors

* Updated unit tests in Jest Test Suites 3, 7, 8, 13, and 14.
Updated snapshot to account for EuiButton Emotion conversion.
Updated tests that target EuiButton to simulate click events. These tests now target a generic button element to prevent undefined click event errors.
Updated a few snapshots by adding .render() before checking the snapshot. This will prevent large snapshots coming from recent Emotion conversions

* Updated snapshots in Jest Test Suite #10 to account for the recent EuiButton Emotion conversion

* Updated unit tests in Jest Test Suite #2 by editing tests that target EuiButton to simulate click events. These tests now target a button element in order to prevent undefinde click event errors

* Updated snapshots in Jest Test Suite #10 to account for EuiButton and EuiDescriptionList Emotion conversions

* Updated test cases in Jest Test Suites 3, 7, and 8. Updated snapshots to account for EuiButton and EuiPagination Emotion conversions.
Updated tests that target EuiButton to simulate click events. These tests now target a button element to prevent undefined click errors

* Updated test cases in Jest Test Suite 14. Updated snapshots to account for EuiButton Emotion conversion. Opted to use .render() when updating a few snapshots to reduce the large length of snapshots caused by Emotion

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Revised a change to betaBadgeProps to ensure that the label is available. If not, the value for the badge with be set to undefined.

* Resolved two linting errors

* Resolved two linting errors

* Updated Jest unit tests in various suites.
Updated snapshots to account for EuiButton Emotion conversion. Updated snapshots for EuiTooltip as it now contains the new EuiTooltipAnchor component that replaced the tooltip anchor styles.

* Updated EuiFlyout in query_flyout.tsx to remove the onClick function from maskProps as it is no longer available. Updated this flyout to use ownFocus and not to close when the overlay mask is clicked.

* Removed the use of EuiButtonIconColor in favor of EuiButtonIconProps['color']

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Updated Cypress test looking for strict equality on EuiPaginationButton class names to match a substring of the Emotion generated class name

* Removed unneeded debugging code. Updated snapshots for various test suites to account for the recent EuiButton Emotion conversion

* Updated a few EuiButton, EuiButtonEmpty, and EuiText components that set the color as ghost. The ghost color mode has been deprecated as of PR #6150. These components now are wrapped in EuiThemeProvider with a dark colorMode to create the previous ghost color.

* Resolved  TS error with EuiCard betaBadgeProps

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Remove references to now-removed EuiFlyout CSS classes/vars

* Remove now-removed euiBadge className references

- Convert directly to EuiBadge instead of using CSS

- Remove confusing and now-possibly-irrelevant CSS badge overrides - left/right icons are now set via JSX and not via flex-direction

* Pre-emptively fix various euiOverlayMask CSS overrides

- this data attr isn't technically in yet but will be once https://github.com/elastic/eui/pull/6289 merges

- at the very least this isn't breaking any more than it currently already is!

* Update to v67.1.3

* v67.1.4

* Resolved test failing test case in Security/Manage/Blocklist. The test did not remove focus from the last combo box in the form, which didn't allow the disbaled attribute to be removed from the flyout submit button. I've updated the mock file for Blocklist to return focus to the first form element in the flyout to allow the disabled attribute to be removed.

* Updated snapshots to account for the recent EuiText Emotion conversion

* Fix Log's custom tooltips relying on EuiTooltip classNames that no longer exist

* Fix Vega vis custom tooltips relying on EuiTooltip classNames that no longer exist

- this one is trickier than Log's as it's not using React, so we need to use Emotion's Global to set a static className

* Convert remaining vega_vis.scss to Emotion

- as an example of how other global + non global styles could be handled in the future

* Fix references to removed `euiPaginationButton-isActive` className

- use aria-current attribute instead

* Added missing EuiFlyoutAnimation keyframes for EuiFlyout. This resolved test that failed because they used onAnimationEnd because the FlyoutAnimation could not be found.

* Reolved Jest Tests in suites 1 and 5. Updated snapshots to account for the recent EuiButton Emotion conversion. Updated snapshots for EuiToolTip as it now contains the new EuiToolTipAnchor component that replaced the tooltip anchor styles.

* iterate on rules_list.test.tsx

* bump eui to v67.1.5

* Updatde snapshots for jest test suites to account for the recent EuiButton, EuiOverlayMask, EuiTooltip, and EuiBadge Emotion conversions

* Resolved failing security test by updating the target element for CONNECTOR_TITLE. EuiCard has recently been converted to Emotion and the card title is no longer wrapper in a span.

* Resolved failing test case in Runtime Fields. The modify runtime field test was failing because the combobox responsbible for adding and updating scripts was not appearing. The textbox did not appear because the shared setFieldScript function targets and toggles the script textbox when opening the flyout. When a runtime field is being modified, the toggle is already active and using the shared function will trigger the toggle again (losing access to the script textbox).
Also resolved an issue that prevented the warning EuiCallout to appear when changing the type of a runtime field from its original type. Resolved this by adding an enter keypress at the end of setFieldType function to confirm the type selection, thus triggering the EuiCallout

* Resolved two tests that were failing in Lens. These test were failing because they were checking for equality in class names that no longer exist within EuiButtonGroup as it was recently converted to Emotion. These tests were updated to check for a substring of the new and longer class name

* Quick fix in test case failing because of misspelling in data-test-sub

* Updated snapshot for Jest test case as EuiButton as recently been converted to Emotion

* Removed console.log statement. Oops!

* Resolved a failing test case in Lens. They were failing because they were checking for equality in class names that no longer exist within EuiButtonGroup as it was recently converted to Emotion. These tests were updated to check for a substring of the new and longer class name.
Updated a Security test case by giving a target button the data-test-subj attribute for easier querying

* Removed reference to EuiFlyout mixin as it has been converted to Emotion. Updated the reference to an interal copy of EuiFlyout styles

* Corrected spelling error in EuiFlyout animation in Lens app

* Update EUI with latest backport

* Update button snapshots

* fix another button snapshot

* More snapshot fixes

* [EuiButton][Security] Fix button relying on now-removed `euiButton__text` CSS

- replace removed CSS with `eui-textTruncate` util instead

- combine/DRY out unnecessary span - was affecting min-width of truncation util

+ increase screenshot diff limit - this was smaller than updating the actual baseline screenshots for whatever reason (likely render diff between local and CI)

* Fix remaining Jest tests affected by Emotion conversions

- because Emotion creates its own wrapper, `.first()` can no longer be used - prefer `.last()` instead

* Fix Jest test affected by EuiButton Emotion conversion + removed modifier class

- targeting the native DOM node + filtering by disabled true/false gets us back to the 'correct' lengths

* Fix + improve flyout test

- `.last()` changes to account for EuiButton Emotion conversion is needed, but the last onClose assertion still fails due to us having modified inputs, and the confirm modal being displayed

- split test into two separate tests - one testing the onClose call, and the other testing the confirm modal

* derpin

* Skip rules_list Jest suite

* Update new EuiButton snapshot

* Upgraded EUI version to 67.1.7

* [EuiCard] Update snapshots

* [EuiPopover] Update snapshots

* [QA] Fix missing Vega warn/error message colors

;_;

* [CI] Auto-commit changed files from 'node scripts/generate codeowners'

* Fix Lens kbnToolbarButton regressions

- Caused by flattening of EUI button CSS specificity

- background-color was previously relying on isDisabled CSS specificity to override its #fff color

- `text` color modifier & `!important` is no longer needed and overrides Emotion CSS flatly

- isDisabled class is no longer needed - euiButton no longer sets `pointer-events: none` on disabled buttons (fixes tooltip bug in webkit as well)

* Backport EUI 67.1.8 fixes

* Update EuiCard snapshots

* Fix EuiModal form wrapper causing overflow issues

- see https://elastic.github.io/eui/#/layout/modal#forms-in-a-modal

* Workaround for `.kbnOverlayMountWrapper` mount point causing overflow issues

- not sure what all is using this modal service to be honest, but the wrapper is causing issues with the modal layout, this fixes overflow issues but will not fix any mask-image issues as a result

* more snapshot updates

* EuiButton - added textProps to EuiButton to prevent very long button names from spilling over outside of the container

* EuiButton - Update EuiButton related snapshots. Updated tests that target EuiButton directly to use a data-telementary-id for more specific element querying required by Emotion

* QA - Removed unnecessary comment in code

* Temporary fix for EuiCard[selectable][layout=horizontal] instances on security solutions' rule page

* Temporary fix for EuiCard[selectable][layout=horizontal] instances on osquery live query and canvas's datasource selector

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Fix CSS specificity, where canvas's solutionToolbarButton's background-color now takes precedence over EuiButton's primary styles

* Removed update to search_marker_tooltip that removed the euiTooltip styles and replaced then with Emotion styling. Added EuiTooltip Sass styles for the component to rely on to test for a styling bug that is causing the tooltip and the tooltip arrow to be out of sync with each other.

* Lint Sass file

* Lint Sass file

* Removed overflow:hidden style from .vgaVis_view as it was causing euiScrollStyles not to present the scroll bars in Vega Vis

* Remove typo from EuiButton textProps object. 'className' should not have been included in the actual class name

* Revert tooltip Sass

This reverts commit 20e6ead571, a5cd2de901, and c605cbd7b9

* Fix Emotion tooltip arrows

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance Chen <constance.chen@elastic.co>
Co-authored-by: Chandler Prall <chandler.prall@elastic.co>
2022-11-07 21:45:50 +00:00
Spencer
7d77d39e1f
[ts] set allowJs to true by default (#144281)
* [ts] set allowJs to true by default

* fix scripts/check_ts_projects, original implementation is now wildly inefficient

* produce stats in check_ts_projects to make sure it's actually working

* fix imports
2022-11-01 15:26:44 -07:00
Alex Horvath
fd6047bb22
Correct wrong multiplier for byte conversion (#143751)
* Correct wrong multiplier for byte conversion

Bug: shard size alert comes earlier than expected.

* add test for threshold limit

use shard sizes close to the limit, gbMultiplier has to be correct

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Smaller than the threshold

Shard size not <= but < as threshold

* eliminate ts-expect-error

* code readability

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Fix estypes import

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Carlos Crespo <carloshenrique.leonelcrespo@elastic.co>
2022-11-01 09:10:22 +01:00
spalger
52f2b33a07
[auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
Jonathan Budzenski
be432c0d89
Upgrade to Jest 27 (#139335)
* Upgrade to Jest 27

* fix test
2022-10-25 14:38:38 -05:00
Pierre Gayvallet
e9ae5700af
Bump elastic/elasticsearch to 8.4.0-canary.1 (#142816)
* Bump `elastic/elasticsearch` to `8.4.0-canary.1`

* fixing package violations

* some xpack violations

* remove more unused ts-expect-error

* started muting errors

* start adapting watcher

* fix more usages

* fix more usages

* fixing more usages

* just one more

* more usages

* infra usages

* moar types

* fix unit test

* adapt more usages

* fixes in FTR tests

* try to fix kbn/es-types

* last fixes?
2022-10-19 02:37:51 -07:00
Mat Schaffer
4549c4e2f9
A tiny note on adding cpu quotas for logstash (#143494) 2022-10-18 16:21:17 +09:00