Commit graph

3236 commits

Author SHA1 Message Date
Kevin Delemme
7fa8094cf0
feat(slo): slo edit form improvements (#148419) 2023-01-13 15:21:28 -05:00
Dmitrii Shevchenko
47d1a0e50f
Increase the maximum number of saved objects that could be installed with a Fleet package (#148441)
**Resolves: https://github.com/elastic/kibana/issues/148175**
2023-01-13 14:56:46 +01:00
Spencer
ffeb61a75f
[presUtils/fleet] stop importing test helpers in bundles (#148825)
This PR stops importing:
- `functionWrapper` and `fontStyle` test helpers in
`@kbn/presentation-util-plugin/common`
 - `createFleetAuthzMock` test helper in `@kbn/fleet-plugin/common`

These are instead imported from a `*/mocks` or `*/test_helpers` import
target and the related `eslint-disable` comments were removed.

While working through some changes to the package system I fixed a bug
in the source classifier which made these issues clear and made a fix
required. The changes have been broken out of my massive PR to make
review simpler.
2023-01-12 15:11:30 -07:00
Spencer
c8f83ed2eb
Move real plugins out of 'fixtures' dirs (#148756)
The location of plugins was previously somewhat irrelevant, but as we
move into packages it's more important that we can find all plugins in
the repository, and we would like to be able to do that without needing
to maintain a manifest somewhere to accomplish this. In order to make
this possible we plan to find any plugin/package by spotting all
kibana.json files which are not "fixtures". This allows plugin-like code
(but not actual plugin code) to exist for testing purposes, but it must
be within some form of "fixtures" directory, and any plugin that isn't
in a fixtures directory will be automatically pulled into the system
(though test plugins, examples, etc. will still only be loaded when the
plugin's path is passed via `--plugin-path`, the system will know about
them and use that knowledge for other things).

Since this is just a rename Operations will review and merge by EOD Jan
12th unless someone has a blocking concern.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-12 12:38:49 -07:00
Spencer
91c05796ce
[packages] prevent and remove basename collisions for js/ts code (#148835)
It seems like these files were unintentionally committed, or left
behind, so I have added a package linter rule which will verify that we
don't have any JS/TS files with exactly the same path, but different
extensions.
2023-01-12 12:29:30 -07:00
spalger
8e12174d32
Revert "[packages] prevent and remove basename collisions for js/ts code"
This reverts commit bba406b9b0.
2023-01-12 10:49:59 -07:00
spalger
bba406b9b0
[packages] prevent and remove basename collisions for js/ts code 2023-01-12 10:42:24 -07:00
Dzmitry Lemechko
bc2cb5dc61
[code coverage] removing instrumentation & plugin for functional tests (#148748)
## Summary

Quite awhile ago we decided to stop collecting code coverage for our
functional (e2e, api integration) FTR tests.
This is a cleanup PR to remove the code we no longer 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
- [ ] 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)
2023-01-12 16:44:48 +01:00
István Zoltán Szabó
a82e62f0cd
Removes perlGuide from doc link service (#148803) 2023-01-12 16:13:14 +01:00
Katerina Patticha
61b8ef4363
[APM] Introduce mobile top metrics (#148330)
## Summary

closes: #146854 




https://user-images.githubusercontent.com/3369346/211276601-92fb9d6e-60fd-4ca3-be37-66daac08d7ac.mov

![Screenshot 2023-01-10 at 16 20
59](https://user-images.githubusercontent.com/3369346/211756906-b3ded4dd-6fb3-489d-8165-e5fc1239e369.png)
![Screenshot 2023-01-10 at 16 17
58](https://user-images.githubusercontent.com/3369346/211756916-e8c57859-b8a6-4f9a-87d4-a72e27711485.png)



References for mobile fields (WIP)
- events
69a52f23d5/specs/agents/mobile/events.md (crashes)
- metrics
69a52f23d5/specs/agents/mobile/metrics.md

### Notes
Comparison is not included in this PR. Thus the color remains is the
default one.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-12 09:37:35 +01:00
Spencer
b8334e2020
[tsProjects] auto-rebuild tsconfig-paths.json cache (#148743)
Updates the TsProject loading logic to automatically rebuild the
tsconfig-paths.json cache of tsconfig file locations which was
previously only updated by bootstrap. This means that people will no
longer be stopped when they are running tasks which didn't used to
strictly require a bootstrap, and told to bootstrap the repo. This is
specifically usable in this context because we are only populating the
cache in bootstrap because we are already scanning all the files in the
repo at that point. It's a quick operation (though one we ideally
wouldn't be executing constantly), so adding it here too just provides a
better DX.

Additionally, this PR adds a check to the start of the precommit hook
which will bootstrap the repo if the user just finished resolving a
merge. This puts the repo in a more correct state before running code to
validate code via eslint, etc.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-11 16:09:11 -07:00
Maja Grubic
4522e04287
[SharedUX] Custom branding service (#148273)
## Summary

This PR adds a new `CustomBranding` service and exposes it from core,
both on the server and client side. The purpose of the service is to
retrieve custom branding properties and propagate them to the
appropriate core service (`chrome` on the client-side and `rendering` on
the server-side). The client side receives server-side properties
through `injectedMetadata`.
Note that the service itself is not responsible for reading the
properties from `uiSettings`; this task is offloaded to `customBranding`
plugin.

I deployed one of the previous commits
[here]([ttps://majagrubic-pr-148273-custom-branding-service-server.kbndev.co/aiy/app/home#/](https://majagrubic-pr-148273-custom-branding-service-server.kbndev.co/aiy/app/home#/)),
so you can see a custom logo set (client-side) and page title set
(server-side).


### 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]
[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
~- [] 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>
2023-01-11 15:28:10 +01:00
Spencer
52d235ae49
[docs-utils] remove extra api_docs dir (#148658)
In order to avoid searching the `api_docs` directory at the root of the
repo in VSCode we have to exclude all api_docs dirs from search, so
instead of putting the source of the code that generates the api_docs in
a similarly named dir this just removes that wrapper.
2023-01-10 12:20:35 -07:00
spalger
72bd23b740
[sort-package-json] always ensure 2-space indent is used 2023-01-10 10:39:48 -07:00
Spencer
d6be4a4b06
Implement package linter (#148496)
This PR implements a linter like the TS Project linter, except for
packages in the repo. It does this by extracting the reusable bits from
the TS Project linter and reusing them for the project linter. The only
rule that exists for packages right now is that the "name" in the
package.json file matches the "id" in Kibana.jsonc. The goal is to use a
rule to migrate kibana.json files on the future.

Additionally, a new rule for validating the indentation of tsconfig.json
files was added.

Validating and fixing violations is what has triggered review by so many
teams, but we plan to treat those review requests as notifications of
the changes and not as blockers for merging.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-09 16:49:29 -07:00
Vadim Kibana
c65b2a620b
<FilePicker> file delete icon (#148471)
## Summary

Adds delete icon to top-right corner of thumbnails in file picker.

<img width="58" alt="image"
src="https://user-images.githubusercontent.com/82822460/210840710-4c2da19d-1aa1-43bf-a4af-3bc7c5d1ff49.png">

- Allows to specify a *predicate* function, which controls if the delete
button is shown for a file.
- Implements the predicate function inside the `image_embeddable`
plugin, such as to show the button only for files that user themselves
uploaded.

Closes https://github.com/elastic/kibana/issues/144695
Closes https://github.com/elastic/kibana/pull/144980

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-09 23:07:31 +01:00
Dzmitry Lemechko
5f31ebf1ce
Benchmark single apis (#146297)
## Summary

This PR adds capability to run capacity testing for single apis #143066

Currently in main we have to 2 types of performance tests:
- single user performance journey that simulates single end-user
experience in browser
- scalability journey that uses APM traces from single user performance
journey to simulate multiple end-users experience

This new type of performance tests allow to better understand how each
single server api scale under the similar load.

How to run locally:
make sure to clone the latest main branch of
[elastic/kibana-load-testing](https://github.com/elastic/kibana-load-testing)
in Kibana repo run:
`node scripts/run_scalability.js --journey-path
x-pack/test/scalability/apis/api.core.capabilities.json`

How it works:
FTR is used to start Kibana/ES and run Gatling simulation with json file
as input. After run the latest report matching journey name is parsed to
get perf metrics and report using EBT to the Telemetry cluster.

How will it run after merge:
I plan to run pipeline every 3 hours on bare metal machine and report
metrics to Telemetry staging cluster.
<img width="2023" alt="image"
src="https://user-images.githubusercontent.com/10977896/208771628-f4f5dbcb-cb73-40c6-9aa1-4ec3fbf5285b.png">


APM traces are collected and reported to Kibana stats cluster:
<img width="1520" alt="image"
src="https://user-images.githubusercontent.com/10977896/208771323-4cca531a-eeea-4941-8b01-50b890f932b1.png">


What metrics are collected:

1. warmupAvgResponseTime - average response time during warmup phase
2. rpsAtWarmup - average requests per second during warmup phase
3. warmupDuration
4. responseTimeMetric (default: 85%) Gatling has response time
25/50/75/80/85/90/95/99 percentiles, as well as min/max values
5. threshold1ResponseTime (default 3000 ms)
6. rpsAtThreshold1 requests per second when `responseTimeMetric` first
reach threshold1ResponseTime
7. threshold2ResponseTime
8. rpsAtThreshold2 (default 9000 ms)
9.  threshold3ResponseTime
10. rpsAtThreshold3 (default 15000 ms)

As long as we agree on metrics I will update indexer for telemetry.

Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-09 16:38:30 +01:00
Jonathan Budzenski
dcb020cc63
[kbn/es] Add dev docs for snapshot promotion pipeline (#148350)
There was recent discussion on tracking down a possible ES regression,
and the best way to find the snapshot build schedule. This updates our
dev docs to include links to the snapshot update pipelines.
2023-01-05 12:45:34 -06:00
Maxim Palenov
4a93da0ba3
[Security Solution] Global query string functionality improvements (#147218)
Addresses: https://github.com/elastic/kibana/issues/140263

This PR was inspired by https://github.com/elastic/kibana/pull/146649 and while working on persistent rules table state https://github.com/elastic/kibana/pull/145111.

## Summary

It includes improvements for url search parameters manipulation functionality. In particular `useGetInitialUrlParamValue` and `useReplaceUrlParams` hooks.

The main idea is to isolate the encoding layer ([rison](https://github.com/Nanonid/rison)) as an implementation detail so `useGetInitialUrlParamValue` and `useReplaceUrlParams` consumers can just provide types they wish and the hooks serialize/desirealize the data into appropriate format under the hood.

On top of that after `@kbn/rison` was added in https://github.com/elastic/kibana/pull/146649 it's possible to use this package directly to encode and decode parameters whenever necessary.

The improvements include
- store unserialized url parameters state in the redux store
- encode and decode data by using functions from `@kbn/rison` directly
- let `useReplaceUrlParams` accept an updater object

### 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
2023-01-05 18:02:12 +01:00
Tomasz Ciecierski
ed0e6b2acb
[Osquery] Substitute Event Data in place of {{parameter}} in Osquery run from Alerts (#146598) 2023-01-05 15:49:40 +01:00
Kevin Delemme
2f973afd1c
feat(slo): use sync delay for burn rate alerting (#148223) 2023-01-04 15:46:02 -05:00
Spencer
ecf18dbc06
[@kbn/babel-register] ensure that source maps are included inline (#148407)
In https://github.com/elastic/kibana/pull/146212 the default
`sourceMaps` config for babel register changed from `both` to `true`,
which creates the source maps but does not embed them in the compiled
output so that dev-tools are able to inspect them even though they are
not on the filesystem.

cc @vitaliidm
2023-01-04 12:30:49 -07:00
nastasha-solomon
a89f5cd0b4
[DOCS] Refreshed URL to value list docs (#146634)
Refreshes the URL to the value list docs so that it matches changes made
in https://github.com/elastic/security-docs/pull/2748.

Related to https://github.com/elastic/kibana/pull/146602.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-01-04 09:54:39 -05:00
Dario Gieselaar
c3d5b0279d
[APM] Refactor synthtrace (#147036)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-04 13:47:37 +01:00
Mike Côté
750e5e0e95
Use docLinks plugin to generate server side URL (#147940)
Resolves: https://github.com/elastic/kibana/issues/109937

In this PR, I'm fixing the `Task Manager detected a degradation in
performance` log message to provide the proper versioned link to the
task manager health monitoring docs. Prior to this PR, it would always
point to main / master docs.

## To verify

1. Turn on debug logging in your kibana.yml file
```
logging:
  loggers:
    - name: plugins.taskManager
      level: debug
```
2. Move this code line outside of the `if (logLevel..` statement =>
4c7ce9d249/x-pack/plugins/task_manager/server/lib/log_health_metrics.ts (L99)
3. Startup Kibana
4. Notice the `Task Manager detected a degradation in performance...`
logged
5. Test the URL provided by the log message

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-01-03 12:38:27 -08:00
Alexey Antonov
5cf614b246
[Step 2][ESQL] Autocomplete part (#148307)
## Summary

Autocomplete support for ESQL lang. Initially target branch for that PR
was
[elastic:feature-esql](https://github.com/elastic/kibana/tree/feature-esql)
but then we decided to merge it separately. This PR is as copy of
#148006

## Notes: 
Important: please do `yarn kbn clean & yarn kbn bootstrap` before
testing.

## How to update syntax. 

`antlr` syntax was copied from `ES` and was slightly modified. In case
if you need to update it please follow next steps:
- modify `esql_parser.g4 `and/or `esql_lexer.g4` files
- go to `kbn-monaco` package and execute `bazel clean & npm run
build:antlr4ts:painless`
- go to /painless_parser.ts file and revert the following change: 

<img width="478" alt="image"
src="https://user-images.githubusercontent.com/20072247/209540586-bb77cad1-a6f0-42fa-9875-025bd4afbace.png">

- do `yarn kbn bootstrap`
2023-01-03 22:35:55 +03:00
Coen Warmer
c2c9cabfb7
[SLO] Create SLO Edit Form - Custom KQL (#147843)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/kibana/issues/147753
2023-01-03 11:48:29 -07:00
Thom Heymann
ee6170be7a
Include client IP address in audit log (#148055)
Follow up to #147526 which had to be reverted.

Resolves #127481

## Release notes

Include IP address in audit log

## Testing

1. Start Elasticsearch with trial license: `yarn es snapshot --license
trial`
2. Update `kibana.dev.yaml`:

```yaml
xpack.security.audit.enabled: true
xpack.security.audit.appender:
  type: console
  layout:
    type: json
```

3. Observe audit logs in console when interacting with Kibana:

```json
{
  "@timestamp": "2022-12-13T15:50:42.236+00:00",
  "message": "User is requesting [/dev/internal/security/me] endpoint",
  "client": {
    "ip": "127.0.0.1"
  },
  "http": {
    "request": {
      "headers": {
        "x-forwarded-for": "1.1.1.1, 127.0.0.1"
      }
    }
  }
}
```

Note: You will see the `x-forwarded-for` field populated when running
Kibana in development mode (`yarn start`) since Kibana runs behind a
development proxy.

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-03 10:17:33 -07:00
renovate[bot]
5f2c0b3c8a
Update dependency core-js to ^3.27.0 (main) (#148259)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [core-js](https://togithub.com/zloirock/core-js) | [`^3.26.1` ->
`^3.27.0`](https://renovatebot.com/diffs/npm/core-js/3.26.1/3.27.0) |
[![age](https://badges.renovateapi.com/packages/npm/core-js/3.27.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/core-js/3.27.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/core-js/3.27.0/compatibility-slim/3.26.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/core-js/3.27.0/confidence-slim/3.26.1)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because
other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/elastic/kibana).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4zMi4wIiwidXBkYXRlZEluVmVyIjoiMzQuMzIuMCJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jonathan Budzenski <jon@elastic.co>
2023-01-03 09:35:06 -06:00
Kevin Delemme
410f6d5e67
chore(slo): Use types in FE from shared schema (#148209) 2022-12-29 17:25:55 -05:00
Spencer
5eba1df3de
When counting eslint directives, only check files checked into the repo (#148208)
We're seeing many extra eslint-disabled counts on PRs right now because
new .gitignore'd files are being written to plugins/packages. This fixes
the logic to stop checking every file in a plugin/package directory, and
instead only check files that are committed to the repository.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-29 15:13:00 -07:00
Kevin Delemme
63101ba0e1
feat(slo): Handle NoData and Degrading status (#148076) 2022-12-28 12:38:11 -05:00
Kevin Delemme
b07f5fc3f8
feat(slo): convert to camelCase (#148113) 2022-12-27 13:45:32 -05:00
Christiane (Tina) Heiligers
5f9678143b
Removes deprecated <IHttpFetchError.res>, <IHttpFetchError.req> (#147727)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-27 10:55:21 -07:00
Thomas Neirynck
0b6d3baf9d
[Performance] Add saved object load performance metric (#147324)
Adds performance metric to track saved objects load time. Also add boilerplate search journey.

Partially address https://github.com/elastic/kibana/issues/145627
2022-12-27 12:33:49 -05:00
Kevin Delemme
4ec4acaaaf
chore(slo): Extract slo schema (#148034) 2022-12-27 09:52:32 -05:00
Jean-Louis Leysens
bcb8a13e66
[Migrations] Only reindex indices if needed (#147371)
Fixes https://github.com/elastic/kibana/issues/124946

## Summary

Takes a step toward optimising our migration paths by only reindexing
(an expensive operation) when needed by checking whether the current SO
mappings have "changed".

By "changed" we mean that we have detected a new md5 checksum of any
registered saved object type relative to the hashes we have stored.

## How to test

These changes are constrained to the `model.ts`, a test was added for
correctly detecting that mappings are the same during the `INIT` phase
to send us down the correct migration path.

Additionally, we have a new Jest integration test `skip_reindex.test.ts`
that runs Kibana and inspects the logs for the expected model
transitions.

Everything else should remain the same.

## Happy path for skipping reindex

```
RUN INIT

IF !versionMigrationIsComplete AND
   !kibana indexBelongsToLaterVersion AND
   !waitForMigrationCompletion AND
   mappingsAreUnchanged
THEN
  the migration operations must target the existing .kibana_x.y.z_001 index

RUN PREPARE_COMPATIBLE_MIGRATION (new state)
    we remove old version aliases (prevent old reads/writes), and set the current version alias (prevent old migrations)

SKIP LEGACY_SET_WRITE_BLOCK
SKIP ...
SKIP SET_SOURCE_WRITE_BLOCK 
SKIP ...
SKIP REFRESH_TARGET

RUN OUTDATED_DOCUMENTS_SEARCH_OPEN_PIT
...
RUN MARK_VERSION_INDEX_READY
DONE
```

## Notes

* This optimisation will only be triggered when there are no mappings
changes AND we are upgrading to a new version. This does not cover all
cases. In future we will make this more sophisticated by checking for
incompatible changes to mappings and only reindexing when those occur.

## Related

* https://github.com/elastic/kibana/pull/147503

### 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>
Co-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>
2022-12-23 12:19:27 -07: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
Thomas Watson
0d2e8156bf
[@kbn/handlebars] Refactor internal context handling (#148029) 2022-12-22 16:23:43 -05:00
Cee Chen
251bdcec6c
Upgrade EUI to v72.0.0 (#147888)
## Summary

`eui@71.0.0`  `eui@72.0.0`

---

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

- Added the `customQuickSelectRender` render prop to
`EuiSuperDatePicker`, which allows customizing the Quick Select popover
([#6382](https://github.com/elastic/eui/pull/6382))
- `EuiFilePicker` styles have been updated to look more like an
interactive element. ([#6479](https://github.com/elastic/eui/pull/6479))
- Added a third argument to `EuiSelectable`'s `onChange` callback. The
single `option` object that triggered the `onChange` event is now also
passed to consumers with its most recent `checked` state
([#6487](https://github.com/elastic/eui/pull/6487))

**Bug fixes**

- `EuiTabs` now passes `size` and `expand` to all children using a React
context provider. ([#6478](https://github.com/elastic/eui/pull/6478))
- Fixed security warnings caused by `trim@0.0.1` sub-dependency
([#6482](https://github.com/elastic/eui/pull/6482))

**Breaking changes**

- Removed `size` and `expand` props from `EuiTab`
([#6478](https://github.com/elastic/eui/pull/6478))

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

**Deprecations**

- Renamed `EuiPageSideBarProps` to `EuiPageSideBarProps_Deprecated`, to
reduce usage/confusion with `EuiPageSidebar`
([#6468](https://github.com/elastic/eui/pull/6468))

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 14:41:18 -06:00
Pierre Gayvallet
a4674f65b6
Allow creating CoreKibanaRequest using fake raw requests (#147919)
## Summary

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

(See issue for more context) 

Given we don't want to spend much effort in user impersonation right
now, the compromise would be to make sure that our system is resilient
to creating 'stubbed' requests. The best way to do that is to offer an
official, proper way to instantiate `CoreKibanaRequest` without having a
proper `HAPI.Request` instance.

This PR is introducing the `FakeRawRequest` type, and changing the
signature of `CoreKibanaRequest.create` to accept this new type.


d2eb3e1801/packages/core/http/core-http-server/src/router/raw_request.ts (L14-L36)

The PR also adapts the existing, non-test usages of
`CoreKibanaRequest.from(someUglyStub as unknown as Request)` to use the
new `FakeRawRequest` type instead.
2022-12-22 10:50:29 -07:00
Thomas Watson
41fd68b719
[@kbn/handlebars] Improve types (#147800) 2022-12-22 18:27:56 +01:00
Katerina Patticha
549ab35c6d
[APM] Mobile filters are part of mobile template (#147804)
## Summary

part of: #146870

This PR will make it easier to add mobile filters to other pages

- Rename `useFiltersForMobileCharts` to `useFiltersForEmbeddableCharts` 
- Add mobile filters in the mobile template 
- Passing `showMobileFilters=true` will render the component to the page



https://user-images.githubusercontent.com/3369346/209121227-aa923836-335d-4ffb-a604-d82c2b0d34ae.mov
2022-12-22 05:22:08 -07:00
Gerard Soldevila
57dad8fc07
Prevent future convertToMultiNamespaceType migrations (#147369)
Addresses https://github.com/elastic/kibana/issues/147344
2022-12-21 18:12:54 +01:00
Thom Heymann
b184f0615e
Include Cross-Origin-Opener-Policy in default response headers (#147874)
Part of #141780 

## Release notes

Include Cross-Origin-Opener-Policy in default response headers

## Testing

Load Kibana; you should see Kibana respond with
`Cross-Origin-Opener-Policy: same-origin` header for page loads and API
requests.
2022-12-21 15:27:15 +00: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
Sébastien Loix
05d220ca04
[Table list view] Component integration tests for URL state (#145618) 2022-12-20 21:52:17 +01:00
Sébastien Loix
2b40b3c848
[TableListView] Fix url state when Router context missing (#147841) 2022-12-20 11:40:23 +00:00
Karl Godard
0b19cfafa3
Custom fleet policy UX for new integration (cloud defend v1) (#147300)
## Summary

New Kibana plugin created for an integration called "Cloud defend for
containers" which will have a corresponding agent service which can
proactively block and alert on executable creation or modification in a
running container.

This plugin is purely in place to configure the fleet policy UX around
this new integration. For now we have added a yaml editor as a custom
input to our integration. The monaco-yaml libary was added to allow
support for JSON schema validation support for yaml.

Integration PR is up, and a work in progress: (waiting on some content
for the doc page)
https://github.com/elastic/integrations/pull/4680

### Screenshot


![image](https://user-images.githubusercontent.com/16198204/207160791-73e11e05-953b-42ba-b4dd-a4904bd95451.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
- [ ] 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))
- [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: Karl Godard <karlgodard@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-19 17:37:39 -07:00
Bree Hall
6bdfc48396
Bumping EUI to 71.0.0 (#147142)
eui@70.4.0  eui@71.0.0

---

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

- Implemented new `EuiRange` and `EuiDualRange` designs where the
`levels` are now on top of the tracks
([#6092](https://github.com/elastic/eui/pull/6092))
- Added `discuss` and `dotInCircle` glyphs to `EuiIcon`
([#6434](https://github.com/elastic/eui/pull/6434))
- Added `article` glyph to `EuiIcon`
([#6437](https://github.com/elastic/eui/pull/6437))
- Changed the `EuiProvider` usage warnings to not rely on development
mode. ([#6451](https://github.com/elastic/eui/pull/6451))

**Breaking changes**

- `EuiDualRange` now explicitly requires both `min` and `max` via props
types, to match `EuiRange`
([#6092](https://github.com/elastic/eui/pull/6092))
- `EuiRange` and `EuiDualRange`'s `compressed` size no longer impacts
track or level sizes, but continues to compress tick and input sizes.
([#6092](https://github.com/elastic/eui/pull/6092))
- Removed all variables for the following components from EUI's theme
JSON files: ([#6443](https://github.com/elastic/eui/pull/6443))
  - `euiCollapsibleNav*`
  - `euiColorPicker*`
  - `euiContextMenu*`
  - `euiControlBar*`
  - `euiDataGrid* `(except for z-indices and cell padding sizes)
  - `euiDatePicker*`
  - `euiSuperDatePicker*`
  - `euiDragAndDrop*`
  - `euiEuiEmptyPrompt*`
  - `euiFilePicker*`
  - `euiRange*`
  - `euiHeaderLinks*`
  - `euiKeyPad*`
  - `euiMarkdownEditor*`
  - `euiResizable*`
  - `euiSelectable*`
  - `euiSideNav*`
  - `euiStep*`
  - `euiSuggest*`
  - `euiTable*` (except for color variables)
  - `euiTooltip*`
- `euiButtonFontWeight`, `euiButtonDefaultTransparency`, and
`euiButtonMinWidth`
- If you were importing any of the above removed JSON variables, we
strongly recommend using generic color or sizing variables from
`useEuiTheme()` instead.
([#6443](https://github.com/elastic/eui/pull/6443))

**CSS-in-JS conversions**

- Converted `EuiRange` and `EuiDualRange` to Emotion; Removed
`$euiRangeThumbRadius`
([#6092](https://github.com/elastic/eui/pull/6092))
- Added a new `logicalStyles` utility that automatically converts all
non-logical properties in a `style` object to their corresponding
logical properties ([#6426](https://github.com/elastic/eui/pull/6426))
- Added a new `logicalShorthandCSS` utility that automatically converts
`margin`, `padding`, and other 4-sided shorthands to their corresponding
logical properties ([#6429](https://github.com/elastic/eui/pull/6429))
- Added a new `logicalBorderRadiusCSS` utility that automatically
converts `border-radius` to corresponding logical properties
([#6429](https://github.com/elastic/eui/pull/6429))

Co-authored-by: Constance Chen <constance.chen@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2022-12-19 15:14:10 -06:00