diff --git a/.ci/Dockerfile b/.ci/Dockerfile
new file mode 100644
index 0000000000000..d90d9f4710b5b
--- /dev/null
+++ b/.ci/Dockerfile
@@ -0,0 +1,38 @@
+# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
+# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts
+
+ARG NODE_VERSION=10.21.0
+
+FROM node:${NODE_VERSION} AS base
+
+RUN apt-get update && \
+ apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
+ libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
+ libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
+ libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
+ libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget openjdk-8-jre && \
+ rm -rf /var/lib/apt/lists/*
+
+RUN curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
+ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
+ && apt-get update \
+ && apt-get install -y rsync jq bsdtar google-chrome-stable \
+ --no-install-recommends \
+ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+
+RUN LATEST_VAULT_RELEASE=$(curl -s https://api.github.com/repos/hashicorp/vault/tags | jq --raw-output .[0].name[1:]) \
+ && curl -L https://releases.hashicorp.com/vault/${LATEST_VAULT_RELEASE}/vault_${LATEST_VAULT_RELEASE}_linux_amd64.zip -o vault.zip \
+ && unzip vault.zip \
+ && rm vault.zip \
+ && chmod +x vault \
+ && mv vault /usr/local/bin/vault
+
+RUN groupadd -r kibana && useradd -r -g kibana kibana && mkdir /home/kibana && chown kibana:kibana /home/kibana
+
+COPY ./bash_standard_lib.sh /usr/local/bin/bash_standard_lib.sh
+RUN chmod +x /usr/local/bin/bash_standard_lib.sh
+
+COPY ./runbld /usr/local/bin/runbld
+RUN chmod +x /usr/local/bin/runbld
+
+USER kibana
diff --git a/.ci/Jenkinsfile_baseline_capture b/.ci/Jenkinsfile_baseline_capture
index b0d3591821642..9a49c19b94df2 100644
--- a/.ci/Jenkinsfile_baseline_capture
+++ b/.ci/Jenkinsfile_baseline_capture
@@ -7,18 +7,22 @@ kibanaPipeline(timeoutMinutes: 120) {
githubCommitStatus.trackBuild(params.commit, 'kibana-ci-baseline') {
ciStats.trackBuild {
catchError {
- parallel([
- 'oss-visualRegression': {
- workers.ci(name: 'oss-visualRegression', size: 's-highmem', ramDisk: true) {
- kibanaPipeline.functionalTestProcess('oss-visualRegression', './test/scripts/jenkins_visual_regression.sh')(1)
- }
- },
- 'xpack-visualRegression': {
- workers.ci(name: 'xpack-visualRegression', size: 's-highmem', ramDisk: true) {
- kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh')(1)
- }
- },
- ])
+ withEnv([
+ 'CI_PARALLEL_PROCESS_NUMBER=1'
+ ]) {
+ parallel([
+ 'oss-visualRegression': {
+ workers.ci(name: 'oss-visualRegression', size: 's-highmem', ramDisk: true) {
+ kibanaPipeline.functionalTestProcess('oss-visualRegression', './test/scripts/jenkins_visual_regression.sh')()
+ }
+ },
+ 'xpack-visualRegression': {
+ workers.ci(name: 'xpack-visualRegression', size: 's-highmem', ramDisk: true) {
+ kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh')()
+ }
+ },
+ ])
+ }
}
kibanaPipeline.sendMail()
diff --git a/.ci/runbld_no_junit.yml b/.ci/runbld_no_junit.yml
index 67b5002c1c437..1bcb7e22a2648 100644
--- a/.ci/runbld_no_junit.yml
+++ b/.ci/runbld_no_junit.yml
@@ -3,4 +3,4 @@
profiles:
- ".*": # Match any job
tests:
- junit-filename-pattern: "8d8bd494-d909-4e67-a052-7e8b5aaeb5e4" # A bogus path that should never exist
+ junit-filename-pattern: false
diff --git a/.gitignore b/.gitignore
index dfd02de7b1186..1d12ef2a9cff3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,8 @@ npm-debug.log*
.tern-project
.nyc_output
.ci/pipeline-library/build/
+.ci/runbld
+.ci/bash_standard_lib.sh
.gradle
# apm plugin
diff --git a/Jenkinsfile b/Jenkinsfile
index ad1d244c78874..3b68cde206573 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -9,49 +9,7 @@ kibanaPipeline(timeoutMinutes: 155, checkPrChanges: true, setCommitStatus: true)
ciStats.trackBuild {
catchError {
retryable.enable()
- parallel([
- 'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
- 'x-pack-intake-agent': workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh'),
- 'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
- 'oss-firefoxSmoke': kibanaPipeline.functionalTestProcess('kibana-firefoxSmoke', './test/scripts/jenkins_firefox_smoke.sh'),
- 'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
- 'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
- 'oss-ciGroup3': kibanaPipeline.ossCiGroupProcess(3),
- 'oss-ciGroup4': kibanaPipeline.ossCiGroupProcess(4),
- 'oss-ciGroup5': kibanaPipeline.ossCiGroupProcess(5),
- 'oss-ciGroup6': kibanaPipeline.ossCiGroupProcess(6),
- 'oss-ciGroup7': kibanaPipeline.ossCiGroupProcess(7),
- 'oss-ciGroup8': kibanaPipeline.ossCiGroupProcess(8),
- 'oss-ciGroup9': kibanaPipeline.ossCiGroupProcess(9),
- 'oss-ciGroup10': kibanaPipeline.ossCiGroupProcess(10),
- 'oss-ciGroup11': kibanaPipeline.ossCiGroupProcess(11),
- 'oss-ciGroup12': kibanaPipeline.ossCiGroupProcess(12),
- 'oss-accessibility': kibanaPipeline.functionalTestProcess('kibana-accessibility', './test/scripts/jenkins_accessibility.sh'),
- // 'oss-visualRegression': kibanaPipeline.functionalTestProcess('visualRegression', './test/scripts/jenkins_visual_regression.sh'),
- ]),
- 'kibana-xpack-agent': workers.functional('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
- 'xpack-firefoxSmoke': kibanaPipeline.functionalTestProcess('xpack-firefoxSmoke', './test/scripts/jenkins_xpack_firefox_smoke.sh'),
- 'xpack-ciGroup1': kibanaPipeline.xpackCiGroupProcess(1),
- 'xpack-ciGroup2': kibanaPipeline.xpackCiGroupProcess(2),
- 'xpack-ciGroup3': kibanaPipeline.xpackCiGroupProcess(3),
- 'xpack-ciGroup4': kibanaPipeline.xpackCiGroupProcess(4),
- 'xpack-ciGroup5': kibanaPipeline.xpackCiGroupProcess(5),
- 'xpack-ciGroup6': kibanaPipeline.xpackCiGroupProcess(6),
- 'xpack-ciGroup7': kibanaPipeline.xpackCiGroupProcess(7),
- 'xpack-ciGroup8': kibanaPipeline.xpackCiGroupProcess(8),
- 'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
- 'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
- 'xpack-accessibility': kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh'),
- 'xpack-savedObjectsFieldMetrics': kibanaPipeline.functionalTestProcess('xpack-savedObjectsFieldMetrics', './test/scripts/jenkins_xpack_saved_objects_field_metrics.sh'),
- 'xpack-securitySolutionCypress': { processNumber ->
- whenChanged(['x-pack/plugins/security_solution/', 'x-pack/test/security_solution_cypress/', 'x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/', 'x-pack/plugins/triggers_actions_ui/public/application/context/actions_connectors_context.tsx']) {
- kibanaPipeline.functionalTestProcess('xpack-securitySolutionCypress', './test/scripts/jenkins_security_solution_cypress.sh')(processNumber)
- }
- },
-
- // 'xpack-visualRegression': kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh'),
- ]),
- ])
+ kibanaPipeline.allCiTasks()
}
}
}
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md
index 4d2fac0287035..30e980b5ffc54 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.md
@@ -35,7 +35,7 @@ export declare class SearchInterceptor
| Method | Modifiers | Description |
| --- | --- | --- |
-| [runSearch(request, combinedSignal)](./kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md) | | |
+| [runSearch(request, signal)](./kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md) | | |
| [search(request, options)](./kibana-plugin-plugins-data-public.searchinterceptor.search.md) | | Searches using the given search
method. Overrides the AbortSignal
with one that will abort either when cancelPending
is called, when the request times out, or when the original AbortSignal
is aborted. Updates the pendingCount
when the request is started/finalized. |
| [setupTimers(options)](./kibana-plugin-plugins-data-public.searchinterceptor.setuptimers.md) | | |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md
index 385d4f6a238d4..3601a00c48cf3 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchinterceptor.runsearch.md
@@ -7,7 +7,7 @@
Signature:
```typescript
-protected runSearch(request: IEsSearchRequest, combinedSignal: AbortSignal): Observable;
+protected runSearch(request: IEsSearchRequest, signal: AbortSignal): Observable;
```
## Parameters
@@ -15,7 +15,7 @@ protected runSearch(request: IEsSearchRequest, combinedSignal: AbortSignal): Obs
| Parameter | Type | Description |
| --- | --- | --- |
| request | IEsSearchRequest
| |
-| combinedSignal | AbortSignal
| |
+| signal | AbortSignal
| |
Returns:
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.usage.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.usage.md
index 85abd9d9dba98..1a94a709cc214 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.usage.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.usage.md
@@ -9,5 +9,5 @@ Used internally for telemetry
Signature:
```typescript
-usage: SearchUsage;
+usage?: SearchUsage;
```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
index 6bf481841f334..1bcd575803f88 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
@@ -27,6 +27,7 @@
| [parseInterval(interval)](./kibana-plugin-plugins-data-server.parseinterval.md) | |
| [plugin(initializerContext)](./kibana-plugin-plugins-data-server.plugin.md) | Static code to be shared externally |
| [shouldReadFieldFromDocValues(aggregatable, esType)](./kibana-plugin-plugins-data-server.shouldreadfieldfromdocvalues.md) | |
+| [usageProvider(core)](./kibana-plugin-plugins-data-server.usageprovider.md) | |
## Interfaces
@@ -49,6 +50,7 @@
| [PluginStart](./kibana-plugin-plugins-data-server.pluginstart.md) | |
| [Query](./kibana-plugin-plugins-data-server.query.md) | |
| [RefreshInterval](./kibana-plugin-plugins-data-server.refreshinterval.md) | |
+| [SearchUsage](./kibana-plugin-plugins-data-server.searchusage.md) | |
| [TimeRange](./kibana-plugin-plugins-data-server.timerange.md) | |
## Variables
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.searchusage.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.searchusage.md
new file mode 100644
index 0000000000000..d867509e915b6
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.searchusage.md
@@ -0,0 +1,19 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [SearchUsage](./kibana-plugin-plugins-data-server.searchusage.md)
+
+## SearchUsage interface
+
+Signature:
+
+```typescript
+export interface SearchUsage
+```
+
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [trackError()](./kibana-plugin-plugins-data-server.searchusage.trackerror.md) | |
+| [trackSuccess(duration)](./kibana-plugin-plugins-data-server.searchusage.tracksuccess.md) | |
+
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.searchusage.trackerror.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.searchusage.trackerror.md
new file mode 100644
index 0000000000000..212133588f62d
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.searchusage.trackerror.md
@@ -0,0 +1,15 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [SearchUsage](./kibana-plugin-plugins-data-server.searchusage.md) > [trackError](./kibana-plugin-plugins-data-server.searchusage.trackerror.md)
+
+## SearchUsage.trackError() method
+
+Signature:
+
+```typescript
+trackError(): Promise;
+```
+Returns:
+
+`Promise`
+
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.searchusage.tracksuccess.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.searchusage.tracksuccess.md
new file mode 100644
index 0000000000000..b58f440c7dccf
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.searchusage.tracksuccess.md
@@ -0,0 +1,22 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [SearchUsage](./kibana-plugin-plugins-data-server.searchusage.md) > [trackSuccess](./kibana-plugin-plugins-data-server.searchusage.tracksuccess.md)
+
+## SearchUsage.trackSuccess() method
+
+Signature:
+
+```typescript
+trackSuccess(duration: number): Promise;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| duration | number
| |
+
+Returns:
+
+`Promise`
+
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.usageprovider.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.usageprovider.md
new file mode 100644
index 0000000000000..ad5c61b5c85a1
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.usageprovider.md
@@ -0,0 +1,22 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [usageProvider](./kibana-plugin-plugins-data-server.usageprovider.md)
+
+## usageProvider() function
+
+Signature:
+
+```typescript
+export declare function usageProvider(core: CoreSetup): SearchUsage;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| core | CoreSetup
| |
+
+Returns:
+
+`SearchUsage`
+
diff --git a/docs/management/index-lifecycle-policies/example-index-lifecycle-policy.asciidoc b/docs/management/index-lifecycle-policies/example-index-lifecycle-policy.asciidoc
deleted file mode 100644
index 0097bf8c648f0..0000000000000
--- a/docs/management/index-lifecycle-policies/example-index-lifecycle-policy.asciidoc
+++ /dev/null
@@ -1,179 +0,0 @@
-[role="xpack"]
-
-[[example-using-index-lifecycle-policy]]
-=== Tutorial: Use {ilm-init} to manage {filebeat} time-based indices
-
-With {ilm} ({ilm-init}), you can create policies that perform actions automatically
-on indices as they age and grow. {ilm-init} policies help you to manage
-performance, resilience, and retention of your data during its lifecycle. This tutorial shows
-you how to use {kib}’s *Index Lifecycle Policies* to modify and create {ilm-init}
-policies. You can learn more about all of the actions, benefits, and lifecycle
-phases in the {ref}/overview-index-lifecycle-management.html[{ilm-init} overview].
-
-
-[discrete]
-[[example-using-index-lifecycle-policy-scenario]]
-==== Scenario
-
-You’re tasked with sending syslog files to an {es} cluster. This
-log data has the following data retention guidelines:
-
-* Keep logs on hot data nodes for 30 days
-* Roll over to a new index if the size reaches 50GB
-* After 30 days:
-** Move the logs to warm data nodes
-** Set {ref}/glossary.html#glossary-replica-shard[replica shards] to 1
-** {ref}/indices-forcemerge.html[Force merge] multiple index segments to free up the space used by deleted documents
-* Delete logs after 90 days
-
-
-[discrete]
-[[example-using-index-lifecycle-policy-prerequisites]]
-==== Prerequisites
-
-To complete this tutorial, you'll need:
-
-* An {es} cluster with hot and warm nodes configured for shard allocation
-awareness. If you’re using {cloud}/ec-getting-started-templates-hot-warm.html[{ess}],
-choose the hot-warm architecture deployment template.
-
-+
-For a self-managed cluster, add node attributes as described for {ref}/shard-allocation-filtering.html[shard allocation filtering]
-to label data nodes as hot or warm. This step is required to migrate shards between
-nodes configured with specific hardware for the hot or warm phases.
-+
-For example, you can set this in your `elasticsearch.yml` for each data node:
-+
-[source,yaml]
---------------------------------------------------------------------------------
-node.attr.data: "warm"
---------------------------------------------------------------------------------
-
-* A server with {filebeat} installed and configured to send logs to the `elasticsearch`
-output as described in {filebeat-ref}/filebeat-getting-started.html[Getting Started with {filebeat}].
-
-[discrete]
-[[example-using-index-lifecycle-policy-view-fb-ilm-policy]]
-==== View the {filebeat} {ilm-init} policy
-
-{filebeat} includes a default {ilm-init} policy that enables rollover. {ilm-init}
-is enabled automatically if you’re using the default `filebeat.yml` and index template.
-
-To view the default policy in {kib}, open the menu, go to *Stack Management > Data > Index Lifecycle Policies*,
-search for _filebeat_, and choose the _filebeat-version_ policy.
-
-This policy initiates the rollover action when the index size reaches 50GB or
-becomes 30 days old.
-
-[role="screenshot"]
-image::images/tutorial-ilm-hotphaserollover-default.png["Default policy"]
-
-
-[float]
-==== Modify the policy
-
-The default policy is enough to prevent the creation of many tiny daily indices.
-You can modify the policy to meet more complex requirements.
-
-. Activate the warm phase.
-
-+
-. Set either of the following options to control when the index moves to the warm phase:
-
-** Provide a value for *Timing for warm phase*. Setting this to *15* keeps the
-indices on hot nodes for a range of 15-45 days, depending on when the initial
-rollover occurred.
-
-** Enable *Move to warm phase on rollover*. The index might move to the warm phase
-more quickly than intended if it reaches the *Maximum index size* before the
-the *Maximum age*.
-
-. In the *Select a node attribute to control shard allocation* dropdown, select
-*data:warm(2)* to migrate shards to warm data nodes.
-
-. Change *Number of replicas* to *1*.
-
-. Enable *Force merge data* and set *Number of segments* to *1*.
-+
-NOTE: When rollover is enabled in the hot phase, action timing in the other phases
-is based on the rollover date.
-
-+
-[role="screenshot"]
-image::images/tutorial-ilm-modify-default-warm-phase-rollover.png["Modify to add warm phase"]
-
-. Activate the delete phase and set *Timing for delete phase* to *90* days.
-+
-[role="screenshot"]
-image::images/tutorial-ilm-delete-rollover.png["Add a delete phase"]
-
-[float]
-==== Create a custom policy
-
-If meeting a specific retention time period is most important, you can create a
-custom policy. For this option, you will use {filebeat} daily indices without
-rollover.
-
-. To create a custom policy, open the menu, go to *Stack Management > Data > Index Lifecycle Policies*, then click
-*Create policy*.
-
-. Activate the warm phase and configure it as follows:
-+
-|===
-|*Setting* |*Value*
-
-|Timing for warm phase
-|30 days from index creation
-
-|Node attribute
-|`data:warm`
-
-|Number of replicas
-|1
-
-|Force merge data
-|enable
-
-|Number of segments
-|1
-|===
-
-+
-[role="screenshot"]
-image::images/tutorial-ilm-custom-policy.png["Modify the custom policy to add a warm phase"]
-
-
-+
-. Activate the delete phase and set the timing.
-+
-|===
-|*Setting* |*Value*
-|Timing for delete phase
-|90
-|===
-
-+
-[role="screenshot"]
-image::images/tutorial-ilm-delete-phase-creation.png["Delete phase"]
-
-. To configure the index to use the new policy, open the menu, then go to *Stack Management > Data > Index Lifecycle
-Policies*.
-
-.. Find your {ilm-init} policy.
-.. Click the *Actions* link next to your policy name.
-.. Choose *Add policy to index template*.
-.. Select your {filebeat} index template name from the *Index template* list. For example, `filebeat-7.5.x`.
-.. Click *Add Policy* to save the changes.
-
-+
-NOTE: If you initially used the default {filebeat} {ilm-init} policy, you will
-see a notice that the template already has a policy associated with it. Confirm
-that you want to overwrite that configuration.
-
-+
-+
-TIP: When you change the policy associated with the index template, the active
-index will continue to use the policy it was associated with at index creation
-unless you manually update it. The next new index will use the updated policy.
-For more reasons that your {ilm-init} policy changes might be delayed, see
-{ref}/update-lifecycle-policy.html#update-lifecycle-policy[Update Lifecycle Policy].
diff --git a/docs/observability/images/observability-overview.png b/docs/observability/images/observability-overview.png
new file mode 100644
index 0000000000000..b7d3d09139a89
Binary files /dev/null and b/docs/observability/images/observability-overview.png differ
diff --git a/docs/observability/index.asciidoc b/docs/observability/index.asciidoc
new file mode 100644
index 0000000000000..d63402e8df2fb
--- /dev/null
+++ b/docs/observability/index.asciidoc
@@ -0,0 +1,24 @@
+[chapter]
+[role="xpack"]
+[[observability]]
+= Observability
+
+Observability enables you to add and monitor your logs, system
+metrics, uptime data, and application traces, as a single stack.
+
+With *Observability*, you have:
+
+* A central place to add and configure your data sources.
+* A variety of charts displaying analytics relating to each data source.
+* *View in app* options to drill down and analyze data in the Logs, Metrics, Uptime, and APM apps.
+* An alerts chart to keep you informed of any issues that you may need to resolve quickly.
+
+[role="screenshot"]
+image::observability/images/observability-overview.png[Observability Overview in {kib}]
+
+[float]
+== Get started
+
+{kib} provides step-by-step instructions to help you add and configure your data
+sources. The {observability-guide}/index.html[Observability Guide] is a good source for more detailed information
+and instructions.
diff --git a/docs/user/index.asciidoc b/docs/user/index.asciidoc
index 01be8c2e264c5..abbdbeb68d9cb 100644
--- a/docs/user/index.asciidoc
+++ b/docs/user/index.asciidoc
@@ -27,6 +27,8 @@ include::graph/index.asciidoc[]
include::visualize.asciidoc[]
+include::{kib-repo-dir}/observability/index.asciidoc[]
+
include::{kib-repo-dir}/logs/index.asciidoc[]
include::{kib-repo-dir}/infrastructure/index.asciidoc[]
diff --git a/docs/user/management.asciidoc b/docs/user/management.asciidoc
index 1704a80847652..bc96463f6efba 100644
--- a/docs/user/management.asciidoc
+++ b/docs/user/management.asciidoc
@@ -190,8 +190,6 @@ include::{kib-repo-dir}/management/index-lifecycle-policies/manage-policy.asciid
include::{kib-repo-dir}/management/index-lifecycle-policies/add-policy-to-index.asciidoc[]
-include::{kib-repo-dir}/management/index-lifecycle-policies/example-index-lifecycle-policy.asciidoc[]
-
include::{kib-repo-dir}/management/managing-indices.asciidoc[]
include::{kib-repo-dir}/management/ingest-pipelines/ingest-pipelines.asciidoc[]
diff --git a/packages/kbn-dev-utils/src/run/help.test.ts b/packages/kbn-dev-utils/src/run/help.test.ts
index 27be7ad28b81a..300f1cba7eb7d 100644
--- a/packages/kbn-dev-utils/src/run/help.test.ts
+++ b/packages/kbn-dev-utils/src/run/help.test.ts
@@ -57,7 +57,7 @@ const barCommand: Command = {
usage: 'bar [...names]',
};
-describe('getHelp()', () => {
+describe.skip('getHelp()', () => {
it('returns the expected output', () => {
expect(
getHelp({
@@ -95,7 +95,7 @@ describe('getHelp()', () => {
});
});
-describe('getCommandLevelHelp()', () => {
+describe.skip('getCommandLevelHelp()', () => {
it('returns the expected output', () => {
expect(
getCommandLevelHelp({
@@ -141,7 +141,7 @@ describe('getCommandLevelHelp()', () => {
});
});
-describe('getHelpForAllCommands()', () => {
+describe.skip('getHelpForAllCommands()', () => {
it('returns the expected output', () => {
expect(
getHelpForAllCommands({
diff --git a/packages/kbn-dev-utils/src/serializers/absolute_path_serializer.ts b/packages/kbn-dev-utils/src/serializers/absolute_path_serializer.ts
index 884614c8b9551..4008cf852c3a8 100644
--- a/packages/kbn-dev-utils/src/serializers/absolute_path_serializer.ts
+++ b/packages/kbn-dev-utils/src/serializers/absolute_path_serializer.ts
@@ -19,9 +19,12 @@
import { REPO_ROOT } from '../repo_root';
-export function createAbsolutePathSerializer(rootPath: string = REPO_ROOT) {
+export function createAbsolutePathSerializer(
+ rootPath: string = REPO_ROOT,
+ replacement = ''
+) {
return {
test: (value: any) => typeof value === 'string' && value.startsWith(rootPath),
- serialize: (value: string) => value.replace(rootPath, '').replace(/\\/g, '/'),
+ serialize: (value: string) => value.replace(rootPath, replacement).replace(/\\/g, '/'),
};
}
diff --git a/packages/kbn-optimizer/package.json b/packages/kbn-optimizer/package.json
index 4fbbc920c4447..e6eb5de31abd8 100644
--- a/packages/kbn-optimizer/package.json
+++ b/packages/kbn-optimizer/package.json
@@ -15,12 +15,9 @@
"@kbn/dev-utils": "1.0.0",
"@kbn/ui-shared-deps": "1.0.0",
"@types/compression-webpack-plugin": "^2.0.2",
- "@types/estree": "^0.0.44",
"@types/loader-utils": "^1.1.3",
"@types/watchpack": "^1.1.5",
"@types/webpack": "^4.41.3",
- "acorn": "^7.1.1",
- "acorn-walk": "^7.1.1",
"autoprefixer": "^9.7.4",
"babel-loader": "^8.0.6",
"clean-webpack-plugin": "^3.0.0",
diff --git a/packages/kbn-optimizer/src/common/bundle_cache.ts b/packages/kbn-optimizer/src/common/bundle_cache.ts
index 7607e270b5b4f..578108fce51fa 100644
--- a/packages/kbn-optimizer/src/common/bundle_cache.ts
+++ b/packages/kbn-optimizer/src/common/bundle_cache.ts
@@ -104,4 +104,18 @@ export class BundleCache {
public getOptimizerCacheKey() {
return this.get().optimizerCacheKey;
}
+
+ public clear() {
+ this.state = undefined;
+
+ if (this.path) {
+ try {
+ Fs.unlinkSync(this.path);
+ } catch (error) {
+ if (error.code !== 'ENOENT') {
+ throw error;
+ }
+ }
+ }
+ }
}
diff --git a/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/disallowed_syntax.ts b/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/disallowed_syntax.ts
deleted file mode 100644
index aba4451622dcd..0000000000000
--- a/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/disallowed_syntax.ts
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import estree from 'estree';
-
-export interface DisallowedSyntaxCheck {
- name: string;
- nodeType: estree.Node['type'] | Array;
- test?: (n: any) => boolean | void;
-}
-
-export const checks: DisallowedSyntaxCheck[] = [
- /**
- * es2015
- */
- // https://github.com/estree/estree/blob/master/es2015.md#functions
- {
- name: '[es2015] generator function',
- nodeType: ['FunctionDeclaration', 'FunctionExpression'],
- test: (n: estree.FunctionDeclaration | estree.FunctionExpression) => !!n.generator,
- },
- // https://github.com/estree/estree/blob/master/es2015.md#forofstatement
- {
- name: '[es2015] for-of statement',
- nodeType: 'ForOfStatement',
- },
- // https://github.com/estree/estree/blob/master/es2015.md#variabledeclaration
- {
- name: '[es2015] let/const variable declaration',
- nodeType: 'VariableDeclaration',
- test: (n: estree.VariableDeclaration) => n.kind === 'let' || n.kind === 'const',
- },
- // https://github.com/estree/estree/blob/master/es2015.md#expressions
- {
- name: '[es2015] `super`',
- nodeType: 'Super',
- },
- // https://github.com/estree/estree/blob/master/es2015.md#expressions
- {
- name: '[es2015] ...spread',
- nodeType: 'SpreadElement',
- },
- // https://github.com/estree/estree/blob/master/es2015.md#arrowfunctionexpression
- {
- name: '[es2015] arrow function expression',
- nodeType: 'ArrowFunctionExpression',
- },
- // https://github.com/estree/estree/blob/master/es2015.md#yieldexpression
- {
- name: '[es2015] `yield` expression',
- nodeType: 'YieldExpression',
- },
- // https://github.com/estree/estree/blob/master/es2015.md#templateliteral
- {
- name: '[es2015] template literal',
- nodeType: 'TemplateLiteral',
- },
- // https://github.com/estree/estree/blob/master/es2015.md#patterns
- {
- name: '[es2015] destructuring',
- nodeType: ['ObjectPattern', 'ArrayPattern', 'AssignmentPattern'],
- },
- // https://github.com/estree/estree/blob/master/es2015.md#classes
- {
- name: '[es2015] class',
- nodeType: [
- 'ClassDeclaration',
- 'ClassExpression',
- 'ClassBody',
- 'MethodDefinition',
- 'MetaProperty',
- ],
- },
-
- /**
- * es2016
- */
- {
- name: '[es2016] exponent operator',
- nodeType: 'BinaryExpression',
- test: (n: estree.BinaryExpression) => n.operator === '**',
- },
- {
- name: '[es2016] exponent assignment',
- nodeType: 'AssignmentExpression',
- test: (n: estree.AssignmentExpression) => n.operator === '**=',
- },
-
- /**
- * es2017
- */
- // https://github.com/estree/estree/blob/master/es2017.md#function
- {
- name: '[es2017] async function',
- nodeType: ['FunctionDeclaration', 'FunctionExpression'],
- test: (n: estree.FunctionDeclaration | estree.FunctionExpression) => n.async,
- },
- // https://github.com/estree/estree/blob/master/es2017.md#awaitexpression
- {
- name: '[es2017] await expression',
- nodeType: 'AwaitExpression',
- },
-
- /**
- * es2018
- */
- // https://github.com/estree/estree/blob/master/es2018.md#statements
- {
- name: '[es2018] for-await-of statements',
- nodeType: 'ForOfStatement',
- test: (n: estree.ForOfStatement) => n.await,
- },
- // https://github.com/estree/estree/blob/master/es2018.md#expressions
- {
- name: '[es2018] object spread properties',
- nodeType: 'ObjectExpression',
- test: (n: estree.ObjectExpression) => n.properties.some((p) => p.type === 'SpreadElement'),
- },
- // https://github.com/estree/estree/blob/master/es2018.md#template-literals
- {
- name: '[es2018] tagged template literal with invalid escape',
- nodeType: 'TemplateElement',
- test: (n: estree.TemplateElement) => n.value.cooked === null,
- },
- // https://github.com/estree/estree/blob/master/es2018.md#patterns
- {
- name: '[es2018] rest properties',
- nodeType: 'ObjectPattern',
- test: (n: estree.ObjectPattern) => n.properties.some((p) => p.type === 'RestElement'),
- },
-
- /**
- * es2019
- */
- // https://github.com/estree/estree/blob/master/es2019.md#catchclause
- {
- name: '[es2019] catch clause without a binding',
- nodeType: 'CatchClause',
- test: (n: estree.CatchClause) => !n.param,
- },
-
- /**
- * es2020
- */
- // https://github.com/estree/estree/blob/master/es2020.md#bigintliteral
- {
- name: '[es2020] bigint literal',
- nodeType: 'Literal',
- test: (n: estree.Literal) => typeof n.value === 'bigint',
- },
-
- /**
- * webpack transforms import/export in order to support tree shaking and async imports
- *
- * // https://github.com/estree/estree/blob/master/es2020.md#importexpression
- * {
- * name: '[es2020] import expression',
- * nodeType: 'ImportExpression',
- * },
- * // https://github.com/estree/estree/blob/master/es2020.md#exportalldeclaration
- * {
- * name: '[es2020] export all declaration',
- * nodeType: 'ExportAllDeclaration',
- * },
- *
- */
-];
-
-export const checksByNodeType = new Map();
-for (const check of checks) {
- const nodeTypes = Array.isArray(check.nodeType) ? check.nodeType : [check.nodeType];
- for (const nodeType of nodeTypes) {
- if (!checksByNodeType.has(nodeType)) {
- checksByNodeType.set(nodeType, []);
- }
- checksByNodeType.get(nodeType)!.push(check);
- }
-}
diff --git a/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/disallowed_syntax_plugin.ts b/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/disallowed_syntax_plugin.ts
deleted file mode 100644
index 8fb7559f3e22f..0000000000000
--- a/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/disallowed_syntax_plugin.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import webpack from 'webpack';
-import acorn from 'acorn';
-import * as AcornWalk from 'acorn-walk';
-
-import { checksByNodeType, DisallowedSyntaxCheck } from './disallowed_syntax';
-import { parseFilePath } from '../parse_path';
-
-export class DisallowedSyntaxPlugin {
- apply(compiler: webpack.Compiler) {
- compiler.hooks.normalModuleFactory.tap(DisallowedSyntaxPlugin.name, (factory) => {
- factory.hooks.parser.for('javascript/auto').tap(DisallowedSyntaxPlugin.name, (parser) => {
- parser.hooks.program.tap(DisallowedSyntaxPlugin.name, (program: acorn.Node) => {
- const module = parser.state?.current;
- if (!module || !module.resource) {
- return;
- }
-
- const resource: string = module.resource;
- const { dirs } = parseFilePath(resource);
-
- if (!dirs.includes('node_modules')) {
- return;
- }
-
- const failedChecks = new Set();
-
- AcornWalk.full(program, (node) => {
- const checks = checksByNodeType.get(node.type as any);
- if (!checks) {
- return;
- }
-
- for (const check of checks) {
- if (!check.test || check.test(node)) {
- failedChecks.add(check);
- }
- }
- });
-
- if (!failedChecks.size) {
- return;
- }
-
- // throw an error to trigger a parse failure, causing this module to be reported as invalid
- throw new Error(
- `disallowed syntax found in file ${resource}:\n - ${Array.from(failedChecks)
- .map((c) => c.name)
- .join('\n - ')}`
- );
- });
- });
- });
- }
-}
diff --git a/packages/kbn-optimizer/src/common/index.ts b/packages/kbn-optimizer/src/common/index.ts
index 89cde2c1cd064..5f17a9b38f9fb 100644
--- a/packages/kbn-optimizer/src/common/index.ts
+++ b/packages/kbn-optimizer/src/common/index.ts
@@ -27,6 +27,5 @@ export * from './ts_helpers';
export * from './rxjs_helpers';
export * from './array_helpers';
export * from './event_stream_helpers';
-export * from './disallowed_syntax_plugin';
export * from './parse_path';
export * from './theme_tags';
diff --git a/packages/kbn-optimizer/src/index.ts b/packages/kbn-optimizer/src/index.ts
index 29922944e8817..39cf2120baf0a 100644
--- a/packages/kbn-optimizer/src/index.ts
+++ b/packages/kbn-optimizer/src/index.ts
@@ -20,5 +20,4 @@
export { OptimizerConfig } from './optimizer';
export * from './run_optimizer';
export * from './log_optimizer_state';
-export * from './common/disallowed_syntax_plugin';
export * from './report_optimizer_stats';
diff --git a/packages/kbn-optimizer/src/optimizer/get_plugin_bundles.test.ts b/packages/kbn-optimizer/src/optimizer/get_plugin_bundles.test.ts
index a823f66cf767b..702ad16144e7b 100644
--- a/packages/kbn-optimizer/src/optimizer/get_plugin_bundles.test.ts
+++ b/packages/kbn-optimizer/src/optimizer/get_plugin_bundles.test.ts
@@ -21,7 +21,9 @@ import { createAbsolutePathSerializer } from '@kbn/dev-utils';
import { getPluginBundles } from './get_plugin_bundles';
-expect.addSnapshotSerializer(createAbsolutePathSerializer('/repo'));
+expect.addSnapshotSerializer(createAbsolutePathSerializer('/repo', ''));
+expect.addSnapshotSerializer(createAbsolutePathSerializer('/output', ''));
+expect.addSnapshotSerializer(createAbsolutePathSerializer('/outside/of/repo', ''));
it('returns a bundle for core and each plugin', () => {
expect(
@@ -56,46 +58,47 @@ it('returns a bundle for core and each plugin', () => {
manifestPath: '/repo/x-pack/plugins/box/kibana.json',
},
],
- '/repo'
+ '/repo',
+ '/output'
).map((b) => b.toSpec())
).toMatchInlineSnapshot(`
Array [
Object {
"banner": undefined,
- "contextDir": /plugins/foo,
+ "contextDir": /plugins/foo,
"id": "foo",
- "manifestPath": /plugins/foo/kibana.json,
- "outputDir": /plugins/foo/target/public,
+ "manifestPath": /plugins/foo/kibana.json,
+ "outputDir": /plugins/foo/target/public,
"publicDirNames": Array [
"public",
],
- "sourceRoot": ,
+ "sourceRoot": ,
"type": "plugin",
},
Object {
"banner": undefined,
- "contextDir": "/outside/of/repo/plugins/baz",
+ "contextDir": /plugins/baz,
"id": "baz",
- "manifestPath": "/outside/of/repo/plugins/baz/kibana.json",
- "outputDir": "/outside/of/repo/plugins/baz/target/public",
+ "manifestPath": /plugins/baz/kibana.json,
+ "outputDir": /plugins/baz/target/public,
"publicDirNames": Array [
"public",
],
- "sourceRoot": ,
+ "sourceRoot": ,
"type": "plugin",
},
Object {
"banner": "/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements.
* Licensed under the Elastic License; you may not use this file except in compliance with the Elastic License. */
",
- "contextDir": /x-pack/plugins/box,
+ "contextDir": /x-pack/plugins/box,
"id": "box",
- "manifestPath": /x-pack/plugins/box/kibana.json,
- "outputDir": /x-pack/plugins/box/target/public,
+ "manifestPath": /x-pack/plugins/box/kibana.json,
+ "outputDir": /x-pack/plugins/box/target/public,
"publicDirNames": Array [
"public",
],
- "sourceRoot": ,
+ "sourceRoot": ,
"type": "plugin",
},
]
diff --git a/packages/kbn-optimizer/src/optimizer/get_plugin_bundles.ts b/packages/kbn-optimizer/src/optimizer/get_plugin_bundles.ts
index 9350b9464242a..d2d19dcd87cca 100644
--- a/packages/kbn-optimizer/src/optimizer/get_plugin_bundles.ts
+++ b/packages/kbn-optimizer/src/optimizer/get_plugin_bundles.ts
@@ -23,7 +23,11 @@ import { Bundle } from '../common';
import { KibanaPlatformPlugin } from './kibana_platform_plugins';
-export function getPluginBundles(plugins: KibanaPlatformPlugin[], repoRoot: string) {
+export function getPluginBundles(
+ plugins: KibanaPlatformPlugin[],
+ repoRoot: string,
+ outputRoot: string
+) {
const xpackDirSlash = Path.resolve(repoRoot, 'x-pack') + Path.sep;
return plugins
@@ -36,7 +40,11 @@ export function getPluginBundles(plugins: KibanaPlatformPlugin[], repoRoot: stri
publicDirNames: ['public', ...p.extraPublicDirs],
sourceRoot: repoRoot,
contextDir: p.directory,
- outputDir: Path.resolve(p.directory, 'target/public'),
+ outputDir: Path.resolve(
+ outputRoot,
+ Path.relative(repoRoot, p.directory),
+ 'target/public'
+ ),
manifestPath: p.manifestPath,
banner: p.directory.startsWith(xpackDirSlash)
? `/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements.\n` +
diff --git a/packages/kbn-optimizer/src/optimizer/optimizer_config.test.ts b/packages/kbn-optimizer/src/optimizer/optimizer_config.test.ts
index f97646e2bbbd3..afc2dc8952c87 100644
--- a/packages/kbn-optimizer/src/optimizer/optimizer_config.test.ts
+++ b/packages/kbn-optimizer/src/optimizer/optimizer_config.test.ts
@@ -23,16 +23,20 @@ jest.mock('./get_plugin_bundles.ts');
jest.mock('../common/theme_tags.ts');
jest.mock('./filter_by_id.ts');
-import Path from 'path';
-import Os from 'os';
+jest.mock('os', () => {
+ const realOs = jest.requireActual('os');
+ jest.spyOn(realOs, 'cpus').mockImplementation(() => {
+ return ['foo'] as any;
+ });
+ return realOs;
+});
+import Path from 'path';
import { REPO_ROOT, createAbsolutePathSerializer } from '@kbn/dev-utils';
-import { OptimizerConfig } from './optimizer_config';
+import { OptimizerConfig, ParsedOptions } from './optimizer_config';
import { parseThemeTags } from '../common';
-jest.spyOn(Os, 'cpus').mockReturnValue(['foo'] as any);
-
expect.addSnapshotSerializer(createAbsolutePathSerializer());
beforeEach(() => {
@@ -118,6 +122,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [
/src/plugins,
@@ -145,6 +150,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [
/src/plugins,
@@ -172,6 +178,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [
/src/plugins,
@@ -201,6 +208,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [
/src/plugins,
@@ -227,6 +235,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 2,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [
/x/y/z,
@@ -253,6 +262,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 100,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [],
"profileWebpack": false,
@@ -276,6 +286,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 100,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [],
"profileWebpack": false,
@@ -299,6 +310,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 100,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [],
"profileWebpack": false,
@@ -323,6 +335,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 100,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [],
"profileWebpack": false,
@@ -347,6 +360,7 @@ describe('OptimizerConfig::parseOptions()', () => {
"includeCoreBundle": false,
"inspectWorkers": false,
"maxWorkerCount": 100,
+ "outputRoot": ,
"pluginPaths": Array [],
"pluginScanDirs": Array [],
"profileWebpack": false,
@@ -384,18 +398,22 @@ describe('OptimizerConfig::create()', () => {
getPluginBundles.mockReturnValue([Symbol('bundle1'), Symbol('bundle2')]);
filterById.mockReturnValue(Symbol('filtered bundles'));
- jest.spyOn(OptimizerConfig, 'parseOptions').mockImplementation((): any => ({
+ jest.spyOn(OptimizerConfig, 'parseOptions').mockImplementation((): {
+ [key in keyof ParsedOptions]: any;
+ } => ({
cache: Symbol('parsed cache'),
dist: Symbol('parsed dist'),
maxWorkerCount: Symbol('parsed max worker count'),
pluginPaths: Symbol('parsed plugin paths'),
pluginScanDirs: Symbol('parsed plugin scan dirs'),
repoRoot: Symbol('parsed repo root'),
+ outputRoot: Symbol('parsed output root'),
watch: Symbol('parsed watch'),
themeTags: Symbol('theme tags'),
inspectWorkers: Symbol('parsed inspect workers'),
profileWebpack: Symbol('parsed profile webpack'),
filters: [],
+ includeCoreBundle: false,
}));
});
@@ -474,6 +492,7 @@ describe('OptimizerConfig::create()', () => {
Array [
Symbol(new platform plugins),
Symbol(parsed repo root),
+ Symbol(parsed output root),
],
],
"instances": Array [
diff --git a/packages/kbn-optimizer/src/optimizer/optimizer_config.ts b/packages/kbn-optimizer/src/optimizer/optimizer_config.ts
index 0e588ab36238b..45598ff8831b0 100644
--- a/packages/kbn-optimizer/src/optimizer/optimizer_config.ts
+++ b/packages/kbn-optimizer/src/optimizer/optimizer_config.ts
@@ -55,6 +55,13 @@ function omit(obj: T, keys: K[]): Omit {
interface Options {
/** absolute path to root of the repo/build */
repoRoot: string;
+ /**
+ * absolute path to the root directory where output should be written to. This
+ * defaults to the repoRoot but can be customized to write output somewhere else.
+ *
+ * This is how we write output to the build directory in the Kibana build tasks.
+ */
+ outputRoot?: string;
/** enable to run the optimizer in watch mode */
watch?: boolean;
/** the maximum number of workers that will be created */
@@ -107,8 +114,9 @@ interface Options {
themes?: ThemeTag | '*' | ThemeTag[];
}
-interface ParsedOptions {
+export interface ParsedOptions {
repoRoot: string;
+ outputRoot: string;
watch: boolean;
maxWorkerCount: number;
profileWebpack: boolean;
@@ -139,6 +147,11 @@ export class OptimizerConfig {
throw new TypeError('repoRoot must be an absolute path');
}
+ const outputRoot = options.outputRoot ?? repoRoot;
+ if (!Path.isAbsolute(outputRoot)) {
+ throw new TypeError('outputRoot must be an absolute path');
+ }
+
/**
* BEWARE: this needs to stay roughly synchronized with
* `src/core/server/config/env.ts` which determines which paths
@@ -182,6 +195,7 @@ export class OptimizerConfig {
watch,
dist,
repoRoot,
+ outputRoot,
maxWorkerCount,
profileWebpack,
cache,
@@ -206,11 +220,11 @@ export class OptimizerConfig {
publicDirNames: ['public', 'public/utils'],
sourceRoot: options.repoRoot,
contextDir: Path.resolve(options.repoRoot, 'src/core'),
- outputDir: Path.resolve(options.repoRoot, 'src/core/target/public'),
+ outputDir: Path.resolve(options.outputRoot, 'src/core/target/public'),
}),
]
: []),
- ...getPluginBundles(plugins, options.repoRoot),
+ ...getPluginBundles(plugins, options.repoRoot, options.outputRoot),
];
return new OptimizerConfig(
diff --git a/packages/kbn-optimizer/src/worker/webpack.config.ts b/packages/kbn-optimizer/src/worker/webpack.config.ts
index ae5d2b5fb3292..820b13629697d 100644
--- a/packages/kbn-optimizer/src/worker/webpack.config.ts
+++ b/packages/kbn-optimizer/src/worker/webpack.config.ts
@@ -29,7 +29,7 @@ import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import CompressionPlugin from 'compression-webpack-plugin';
import * as UiSharedDeps from '@kbn/ui-shared-deps';
-import { Bundle, BundleRefs, WorkerConfig, parseDirPath, DisallowedSyntaxPlugin } from '../common';
+import { Bundle, BundleRefs, WorkerConfig, parseDirPath } from '../common';
import { BundleRefsPlugin } from './bundle_refs_plugin';
const IS_CODE_COVERAGE = !!process.env.CODE_COVERAGE;
@@ -70,7 +70,6 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
plugins: [
new CleanWebpackPlugin(),
- new DisallowedSyntaxPlugin(),
new BundleRefsPlugin(bundle, bundleRefs),
...(bundle.banner ? [new webpack.BannerPlugin({ banner: bundle.banner, raw: true })] : []),
],
diff --git a/packages/kbn-storybook/storybook_config/webpack.config.js b/packages/kbn-storybook/storybook_config/webpack.config.js
index 0a9977463aee8..7b43d106417b2 100644
--- a/packages/kbn-storybook/storybook_config/webpack.config.js
+++ b/packages/kbn-storybook/storybook_config/webpack.config.js
@@ -19,6 +19,7 @@
const { parse, resolve } = require('path');
const webpack = require('webpack');
+const webpackMerge = require('webpack-merge');
const { stringifyRequest } = require('loader-utils');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { REPO_ROOT, DLL_DIST_DIR } = require('../lib/constants');
@@ -26,145 +27,137 @@ const { REPO_ROOT, DLL_DIST_DIR } = require('../lib/constants');
const { currentConfig } = require('../../../built_assets/storybook/current.config');
// Extend the Storybook Webpack config with some customizations
-module.exports = async ({ config }) => {
- // Find and alter the CSS rule to replace the Kibana public path string with a path
- // to the route we've added in middleware.js
- const cssRule = config.module.rules.find((rule) => rule.test.source.includes('.css$'));
- cssRule.use.push({
- loader: 'string-replace-loader',
- options: {
- search: '__REPLACE_WITH_PUBLIC_PATH__',
- replace: '/',
- flags: 'g',
- },
- });
-
- // Include the React preset from Kibana for Storybook JS files.
- config.module.rules.push({
- test: /\.js$/,
- exclude: /node_modules/,
- loaders: 'babel-loader',
- options: {
- presets: [require.resolve('@kbn/babel-preset/webpack_preset')],
- },
- });
-
- config.module.rules.push({
- test: /\.(html|md|txt|tmpl)$/,
- use: {
- loader: 'raw-loader',
- },
- });
-
- // Handle Typescript files
- config.module.rules.push({
- test: /\.tsx?$/,
- use: [
- {
- loader: 'babel-loader',
- options: {
- presets: [require.resolve('@kbn/babel-preset/webpack_preset')],
+module.exports = async ({ config: storybookConfig }) => {
+ let config = {
+ module: {
+ rules: [
+ // Include the React preset from Kibana for JS(X) and TS(X)
+ {
+ test: /\.(j|t)sx?$/,
+ exclude: /node_modules/,
+ loaders: 'babel-loader',
+ options: {
+ presets: [require.resolve('@kbn/babel-preset/webpack_preset')],
+ },
},
- },
- ],
- });
-
- // Parse props data for .tsx files
- config.module.rules.push({
- test: /\.tsx$/,
- // Exclude example files, as we don't display props info for them
- exclude: /\.examples.tsx$/,
- use: [
- // Parse TS comments to create Props tables in the UI
- require.resolve('react-docgen-typescript-loader'),
- ],
- });
-
- // Enable SASS
- config.module.rules.push({
- test: /\.scss$/,
- exclude: /\.module.(s(a|c)ss)$/,
- use: [
- { loader: 'style-loader' },
- { loader: 'css-loader', options: { importLoaders: 2 } },
- {
- loader: 'postcss-loader',
- options: {
- config: {
- path: require.resolve('@kbn/optimizer/postcss.config.js'),
+ {
+ test: /\.(html|md|txt|tmpl)$/,
+ use: {
+ loader: 'raw-loader',
},
},
- },
- {
- loader: 'resolve-url-loader',
- options: {
- // If you don't have arguments (_, __) to the join function, the
- // resolve-url-loader fails with a loader misconfiguration error.
- //
- // eslint-disable-next-line no-unused-vars
- join: (_, __) => (uri, base) => {
- if (!base || !parse(base).dir.includes('legacy')) {
- return null;
- }
+ // Parse props data for .tsx files
+ // This is notoriously slow, and is making Storybook unusable. Disabling for now.
+ // See: https://github.com/storybookjs/storybook/issues/7998
+ //
+ // {
+ // test: /\.tsx$/,
+ // // Exclude example files, as we don't display props info for them
+ // exclude: /\.stories.tsx$/,
+ // use: [
+ // // Parse TS comments to create Props tables in the UI
+ // require.resolve('react-docgen-typescript-loader'),
+ // ],
+ // },
+ {
+ test: /\.scss$/,
+ exclude: /\.module.(s(a|c)ss)$/,
+ use: [
+ { loader: 'style-loader' },
+ { loader: 'css-loader', options: { importLoaders: 2 } },
+ {
+ loader: 'postcss-loader',
+ options: {
+ config: {
+ path: require.resolve('@kbn/optimizer/postcss.config.js'),
+ },
+ },
+ },
+ {
+ loader: 'resolve-url-loader',
+ options: {
+ // If you don't have arguments (_, __) to the join function, the
+ // resolve-url-loader fails with a loader misconfiguration error.
+ //
+ // eslint-disable-next-line no-unused-vars
+ join: (_, __) => (uri, base) => {
+ if (!base || !parse(base).dir.includes('legacy')) {
+ return null;
+ }
- // URIs on mixins in src/legacy/public/styles need to be resolved.
- if (uri.startsWith('ui/assets')) {
- return resolve(REPO_ROOT, 'src/core/server/core_app/', uri.replace('ui/', ''));
- }
+ // URIs on mixins in src/legacy/public/styles need to be resolved.
+ if (uri.startsWith('ui/assets')) {
+ return resolve(REPO_ROOT, 'src/core/server/core_app/', uri.replace('ui/', ''));
+ }
- return null;
- },
+ return null;
+ },
+ },
+ },
+ {
+ loader: 'sass-loader',
+ options: {
+ prependData(loaderContext) {
+ return `@import ${stringifyRequest(
+ loaderContext,
+ resolve(REPO_ROOT, 'src/legacy/ui/public/styles/_globals_v7light.scss')
+ )};\n`;
+ },
+ sassOptions: {
+ includePaths: [resolve(REPO_ROOT, 'node_modules')],
+ },
+ },
+ },
+ ],
},
- },
- {
- loader: 'sass-loader',
- options: {
- prependData(loaderContext) {
- return `@import ${stringifyRequest(
- loaderContext,
- resolve(REPO_ROOT, 'src/legacy/ui/public/styles/_globals_v7light.scss')
- )};\n`;
+ ],
+ },
+ plugins: [
+ // Reference the built DLL file of static(ish) dependencies, which are removed
+ // during kbn:bootstrap and rebuilt if missing.
+ new webpack.DllReferencePlugin({
+ manifest: resolve(DLL_DIST_DIR, 'manifest.json'),
+ context: REPO_ROOT,
+ }),
+ // Copy the DLL files to the Webpack build for use in the Storybook UI
+
+ new CopyWebpackPlugin({
+ patterns: [
+ {
+ from: resolve(DLL_DIST_DIR, 'dll.js'),
+ to: 'dll.js',
},
- sassOptions: {
- includePaths: [resolve(REPO_ROOT, 'node_modules')],
+ {
+ from: resolve(DLL_DIST_DIR, 'dll.css'),
+ to: 'dll.css',
},
- },
- },
+ ],
+ }),
],
- });
-
- // Reference the built DLL file of static(ish) dependencies, which are removed
- // during kbn:bootstrap and rebuilt if missing.
- config.plugins.push(
- new webpack.DllReferencePlugin({
- manifest: resolve(DLL_DIST_DIR, 'manifest.json'),
- context: REPO_ROOT,
- })
- );
+ resolve: {
+ // Tell Webpack about the ts/x extensions
+ extensions: ['.ts', '.tsx', '.scss'],
+ },
+ };
- // Copy the DLL files to the Webpack build for use in the Storybook UI
- config.plugins.push(
- new CopyWebpackPlugin({
- patterns: [
- {
- from: resolve(DLL_DIST_DIR, 'dll.js'),
- to: 'dll.js',
- },
- {
- from: resolve(DLL_DIST_DIR, 'dll.css'),
- to: 'dll.css',
- },
- ],
- })
- );
+ // Find and alter the CSS rule to replace the Kibana public path string with a path
+ // to the route we've added in middleware.js
+ const cssRule = storybookConfig.module.rules.find((rule) => rule.test.source.includes('.css$'));
+ cssRule.use.push({
+ loader: 'string-replace-loader',
+ options: {
+ search: '__REPLACE_WITH_PUBLIC_PATH__',
+ replace: '/',
+ flags: 'g',
+ },
+ });
- // Tell Webpack about the ts/x extensions
- config.resolve.extensions.push('.ts', '.tsx', '.scss');
+ config = webpackMerge(storybookConfig, config);
// Load custom Webpack config specified by a plugin.
if (currentConfig.webpackHook) {
// eslint-disable-next-line import/no-dynamic-require
- config = await require(currentConfig.webpackHook)({ config });
+ return await require(currentConfig.webpackHook)({ config });
}
return config;
diff --git a/src/core/MIGRATION_EXAMPLES.md b/src/core/MIGRATION_EXAMPLES.md
index d630fec652a37..3f34742e44861 100644
--- a/src/core/MIGRATION_EXAMPLES.md
+++ b/src/core/MIGRATION_EXAMPLES.md
@@ -1082,7 +1082,7 @@ const { body } = await client.asInternalUser.get({ id: 'id' });
const { body } = await client.asInternalUser.get({ id: 'id' });
```
-- the returned error types changed
+- the returned error types changed
There are no longer specific errors for every HTTP status code (such as `BadRequest` or `NotFound`). A generic
`ResponseError` with the specific `statusCode` is thrown instead.
@@ -1097,6 +1097,7 @@ try {
if(e instanceof errors.NotFound) {
// do something
}
+ if(e.status === 401) {}
}
```
@@ -1115,6 +1116,7 @@ try {
if(e.name === 'ResponseError' && e.statusCode === 404) {
// do something
}
+ if(e.statusCode === 401) {...}
}
```
@@ -1178,6 +1180,30 @@ const request = client.asCurrentUser.ping({}, {
});
```
+- the new client doesn't provide exhaustive typings for the response object yet. You might have to copy
+response type definitions from the Legacy Elasticsearch library until https://github.com/elastic/elasticsearch-js/pull/970 merged.
+
+```ts
+// platform provides a few typings for internal purposes
+import { SearchResponse } from 'src/core/server';
+type SearchSource = {...};
+type SearchBody = SearchResponse;
+const { body } = await client.search(...);
+interface Info {...}
+const { body } = await client.info(...);
+```
+
+- Functional tests are subject to migration to the new client as well.
+before:
+```ts
+const client = getService('legacyEs');
+```
+
+after:
+```ts
+const client = getService('es');
+```
+
Please refer to the [Breaking changes list](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/breaking-changes.html)
for more information about the changes between the legacy and new client.
diff --git a/src/dev/build/tasks/build_kibana_platform_plugins.ts b/src/dev/build/tasks/build_kibana_platform_plugins.ts
index beb5ad40229df..48625078e9bd1 100644
--- a/src/dev/build/tasks/build_kibana_platform_plugins.ts
+++ b/src/dev/build/tasks/build_kibana_platform_plugins.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { CiStatsReporter } from '@kbn/dev-utils';
+import { CiStatsReporter, REPO_ROOT } from '@kbn/dev-utils';
import {
runOptimizer,
OptimizerConfig,
@@ -29,9 +29,10 @@ import { Task } from '../lib';
export const BuildKibanaPlatformPlugins: Task = {
description: 'Building distributable versions of Kibana platform plugins',
- async run(config, log, build) {
- const optimizerConfig = OptimizerConfig.create({
- repoRoot: build.resolvePath(),
+ async run(_, log, build) {
+ const config = OptimizerConfig.create({
+ repoRoot: REPO_ROOT,
+ outputRoot: build.resolvePath(),
cache: false,
oss: build.isOss(),
examples: false,
@@ -42,11 +43,10 @@ export const BuildKibanaPlatformPlugins: Task = {
const reporter = CiStatsReporter.fromEnv(log);
- await runOptimizer(optimizerConfig)
- .pipe(
- reportOptimizerStats(reporter, optimizerConfig, log),
- logOptimizerState(log, optimizerConfig)
- )
+ await runOptimizer(config)
+ .pipe(reportOptimizerStats(reporter, config, log), logOptimizerState(log, config))
.toPromise();
+
+ await Promise.all(config.bundles.map((b) => b.cache.clear()));
},
};
diff --git a/src/dev/build/tasks/copy_source_task.ts b/src/dev/build/tasks/copy_source_task.ts
index c8489673b83af..79279997671e5 100644
--- a/src/dev/build/tasks/copy_source_task.ts
+++ b/src/dev/build/tasks/copy_source_task.ts
@@ -30,7 +30,7 @@ export const CopySource: Task = {
'src/**',
'!src/**/*.{test,test.mocks,mock}.{js,ts,tsx}',
'!src/**/mocks.ts', // special file who imports .mock files
- '!src/**/{__tests__,__snapshots__,__mocks__}/**',
+ '!src/**/{target,__tests__,__snapshots__,__mocks__}/**',
'!src/test_utils/**',
'!src/fixtures/**',
'!src/legacy/core_plugins/console/public/tests/**',
diff --git a/src/dev/ci_setup/checkout_sibling_es.sh b/src/dev/ci_setup/checkout_sibling_es.sh
index 915759d4214f9..3832ec9b4076a 100755
--- a/src/dev/ci_setup/checkout_sibling_es.sh
+++ b/src/dev/ci_setup/checkout_sibling_es.sh
@@ -7,10 +7,11 @@ function checkout_sibling {
targetDir=$2
useExistingParamName=$3
useExisting="$(eval "echo "\$$useExistingParamName"")"
+ repoAddress="https://github.com/"
if [ -z ${useExisting:+x} ]; then
if [ -d "$targetDir" ]; then
- echo "I expected a clean workspace but an '${project}' sibling directory already exists in [$PARENT_DIR]!"
+ echo "I expected a clean workspace but an '${project}' sibling directory already exists in [$WORKSPACE]!"
echo
echo "Either define '${useExistingParamName}' or remove the existing '${project}' sibling."
exit 1
@@ -21,8 +22,9 @@ function checkout_sibling {
cloneBranch=""
function clone_target_is_valid {
+
echo " -> checking for '${cloneBranch}' branch at ${cloneAuthor}/${project}"
- if [[ -n "$(git ls-remote --heads "git@github.com:${cloneAuthor}/${project}.git" ${cloneBranch} 2>/dev/null)" ]]; then
+ if [[ -n "$(git ls-remote --heads "${repoAddress}${cloneAuthor}/${project}.git" ${cloneBranch} 2>/dev/null)" ]]; then
return 0
else
return 1
@@ -71,7 +73,7 @@ function checkout_sibling {
fi
echo " -> checking out '${cloneBranch}' branch from ${cloneAuthor}/${project}..."
- git clone -b "$cloneBranch" "git@github.com:${cloneAuthor}/${project}.git" "$targetDir" --depth=1
+ git clone -b "$cloneBranch" "${repoAddress}${cloneAuthor}/${project}.git" "$targetDir" --depth=1
echo " -> checked out ${project} revision: $(git -C "${targetDir}" rev-parse HEAD)"
echo
}
@@ -87,12 +89,12 @@ function checkout_sibling {
fi
}
-checkout_sibling "elasticsearch" "${PARENT_DIR}/elasticsearch" "USE_EXISTING_ES"
+checkout_sibling "elasticsearch" "${WORKSPACE}/elasticsearch" "USE_EXISTING_ES"
export TEST_ES_FROM=${TEST_ES_FROM:-snapshot}
# Set the JAVA_HOME based on the Java property file in the ES repo
# This assumes the naming convention used on CI (ex: ~/.java/java10)
-ES_DIR="$PARENT_DIR/elasticsearch"
+ES_DIR="$WORKSPACE/elasticsearch"
ES_JAVA_PROP_PATH=$ES_DIR/.ci/java-versions.properties
diff --git a/src/dev/ci_setup/setup_env.sh b/src/dev/ci_setup/setup_env.sh
index 86927b694679a..72ec73ad810e6 100644
--- a/src/dev/ci_setup/setup_env.sh
+++ b/src/dev/ci_setup/setup_env.sh
@@ -53,6 +53,8 @@ export PARENT_DIR="$parentDir"
kbnBranch="$(jq -r .branch "$KIBANA_DIR/package.json")"
export KIBANA_PKG_BRANCH="$kbnBranch"
+export WORKSPACE="${WORKSPACE:-$PARENT_DIR}"
+
###
### download node
###
@@ -162,7 +164,7 @@ export -f checks-reporter-with-killswitch
source "$KIBANA_DIR/src/dev/ci_setup/load_env_keys.sh"
-ES_DIR="$PARENT_DIR/elasticsearch"
+ES_DIR="$WORKSPACE/elasticsearch"
ES_JAVA_PROP_PATH=$ES_DIR/.ci/java-versions.properties
if [[ -d "$ES_DIR" && -f "$ES_JAVA_PROP_PATH" ]]; then
diff --git a/src/dev/notice/generate_notice_from_source.ts b/src/dev/notice/generate_notice_from_source.ts
index 37bbcce72e497..0bef5bc5f32d4 100644
--- a/src/dev/notice/generate_notice_from_source.ts
+++ b/src/dev/notice/generate_notice_from_source.ts
@@ -49,8 +49,10 @@ export async function generateNoticeFromSource({ productName, directory, log }:
ignore: [
'{node_modules,build,dist,data,built_assets}/**',
'packages/*/{node_modules,build,dist}/**',
+ 'src/plugins/*/{node_modules,build,dist}/**',
'x-pack/{node_modules,build,dist,data}/**',
'x-pack/packages/*/{node_modules,build,dist}/**',
+ 'x-pack/plugins/*/{node_modules,build,dist}/**',
'**/target/**',
],
};
diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js
index 404ad67174681..36d0ff8f51d88 100644
--- a/src/dev/precommit_hook/casing_check_config.js
+++ b/src/dev/precommit_hook/casing_check_config.js
@@ -177,12 +177,12 @@ export const TEMPORARILY_IGNORED_PATHS = [
'x-pack/plugins/monitoring/public/icons/health-green.svg',
'x-pack/plugins/monitoring/public/icons/health-red.svg',
'x-pack/plugins/monitoring/public/icons/health-yellow.svg',
- 'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Medium.ttf',
- 'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Regular.ttf',
- 'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/roboto/Roboto-Italic.ttf',
- 'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/roboto/Roboto-Medium.ttf',
- 'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/roboto/Roboto-Regular.ttf',
- 'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/img/logo-grey.png',
+ 'x-pack/plugins/reporting/server/export_types/common/assets/fonts/noto/NotoSansCJKtc-Medium.ttf',
+ 'x-pack/plugins/reporting/server/export_types/common/assets/fonts/noto/NotoSansCJKtc-Regular.ttf',
+ 'x-pack/plugins/reporting/server/export_types/common/assets/fonts/roboto/Roboto-Italic.ttf',
+ 'x-pack/plugins/reporting/server/export_types/common/assets/fonts/roboto/Roboto-Medium.ttf',
+ 'x-pack/plugins/reporting/server/export_types/common/assets/fonts/roboto/Roboto-Regular.ttf',
+ 'x-pack/plugins/reporting/server/export_types/common/assets/img/logo-grey.png',
'x-pack/test/functional/es_archives/monitoring/beats-with-restarted-instance/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/beats-with-restarted-instance/mappings.json',
'x-pack/test/functional/es_archives/monitoring/logstash-pipelines/data.json.gz',
diff --git a/src/legacy/core_plugins/kibana/common/utils/no_white_space.js b/src/legacy/core_plugins/kibana/common/utils/no_white_space.js
deleted file mode 100644
index 580418eb3423f..0000000000000
--- a/src/legacy/core_plugins/kibana/common/utils/no_white_space.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-const TAGS_WITH_WS = />\s+<');
-}
diff --git a/src/legacy/core_plugins/kibana/server/ui_setting_defaults.js b/src/legacy/core_plugins/kibana/server/ui_setting_defaults.js
index e1dadb0a24de1..625c2c02510db 100644
--- a/src/legacy/core_plugins/kibana/server/ui_setting_defaults.js
+++ b/src/legacy/core_plugins/kibana/server/ui_setting_defaults.js
@@ -258,20 +258,6 @@ export function getUiSettingDefaults() {
'The maximum height that a cell in a table should occupy. Set to 0 to disable truncation',
}),
},
- 'timepicker:timeDefaults': {
- name: i18n.translate('kbn.advancedSettings.timepicker.timeDefaultsTitle', {
- defaultMessage: 'Time filter defaults',
- }),
- value: `{
- "from": "now-15m",
- "to": "now"
-}`,
- type: 'json',
- description: i18n.translate('kbn.advancedSettings.timepicker.timeDefaultsText', {
- defaultMessage: 'The timefilter selection to use when Kibana is started without one',
- }),
- requiresPageReload: true,
- },
'theme:darkMode': {
name: i18n.translate('kbn.advancedSettings.darkModeTitle', {
defaultMessage: 'Dark mode',
diff --git a/src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx b/src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx
index e4a98ffac7a55..0000f63c48c2d 100644
--- a/src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx
+++ b/src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx
@@ -69,31 +69,33 @@ export class ReplacePanelFlyout extends React.Component {
};
public onReplacePanel = async (savedObjectId: string, type: string, name: string) => {
- const originalPanels = this.props.container.getInput().panels;
- const filteredPanels = { ...originalPanels };
+ const { panelToRemove, container } = this.props;
+ const { w, h, x, y } = (container.getInput().panels[
+ panelToRemove.id
+ ] as DashboardPanelState).gridData;
- const nnw = (filteredPanels[this.props.panelToRemove.id] as DashboardPanelState).gridData.w;
- const nnh = (filteredPanels[this.props.panelToRemove.id] as DashboardPanelState).gridData.h;
- const nnx = (filteredPanels[this.props.panelToRemove.id] as DashboardPanelState).gridData.x;
- const nny = (filteredPanels[this.props.panelToRemove.id] as DashboardPanelState).gridData.y;
-
- // add the new view
- const newObj = await this.props.container.addNewEmbeddable(type, {
+ const { id } = await container.addNewEmbeddable(type, {
savedObjectId,
});
- const finalPanels = _.cloneDeep(this.props.container.getInput().panels);
- (finalPanels[newObj.id] as DashboardPanelState).gridData.w = nnw;
- (finalPanels[newObj.id] as DashboardPanelState).gridData.h = nnh;
- (finalPanels[newObj.id] as DashboardPanelState).gridData.x = nnx;
- (finalPanels[newObj.id] as DashboardPanelState).gridData.y = nny;
-
- // delete the old view
- delete finalPanels[this.props.panelToRemove.id];
-
- // apply changes
- this.props.container.updateInput({ panels: finalPanels });
- this.props.container.reload();
+ const { [panelToRemove.id]: omit, ...panels } = container.getInput().panels;
+
+ container.updateInput({
+ panels: {
+ ...panels,
+ [id]: {
+ ...panels[id],
+ gridData: {
+ ...(panels[id] as DashboardPanelState).gridData,
+ w,
+ h,
+ x,
+ y,
+ },
+ } as DashboardPanelState,
+ },
+ });
+ container.reload();
this.showToast(name);
this.props.onClose();
diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md
index d6812a4aa4524..2cfdab80123ed 100644
--- a/src/plugins/data/public/public.api.md
+++ b/src/plugins/data/public/public.api.md
@@ -1661,7 +1661,7 @@ export class SearchInterceptor {
// (undocumented)
protected readonly requestTimeout?: number | undefined;
// (undocumented)
- protected runSearch(request: IEsSearchRequest, combinedSignal: AbortSignal): Observable;
+ protected runSearch(request: IEsSearchRequest, signal: AbortSignal): Observable;
search(request: IEsSearchRequest, options?: ISearchOptions): Observable;
// (undocumented)
protected setupTimers(options?: ISearchOptions): {
diff --git a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts
index 307d1fe1b2b0b..2053e0b94b21a 100644
--- a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts
+++ b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts
@@ -50,7 +50,7 @@ setupMock.uiSettings.get.mockImplementation((key: string) => {
return true;
case UI_SETTINGS.SEARCH_QUERY_LANGUAGE:
return 'kuery';
- case 'timepicker:timeDefaults':
+ case UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS:
return { from: 'now-15m', to: 'now' };
case UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS:
return { pause: false, value: 0 };
diff --git a/src/plugins/data/public/query/timefilter/timefilter_service.ts b/src/plugins/data/public/query/timefilter/timefilter_service.ts
index df2fbc8e5a8f3..35b46de5f21b2 100644
--- a/src/plugins/data/public/query/timefilter/timefilter_service.ts
+++ b/src/plugins/data/public/query/timefilter/timefilter_service.ts
@@ -35,7 +35,7 @@ export interface TimeFilterServiceDependencies {
export class TimefilterService {
public setup({ uiSettings, storage }: TimeFilterServiceDependencies): TimefilterSetup {
const timefilterConfig = {
- timeDefaults: uiSettings.get('timepicker:timeDefaults'),
+ timeDefaults: uiSettings.get(UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS),
refreshIntervalDefaults: uiSettings.get(UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS),
};
const history = new TimeHistory(storage);
diff --git a/src/plugins/data/public/search/collectors/create_usage_collector.test.ts b/src/plugins/data/public/search/collectors/create_usage_collector.test.ts
index a9ca9efb8b7e1..aaaac5ae6ff7c 100644
--- a/src/plugins/data/public/search/collectors/create_usage_collector.test.ts
+++ b/src/plugins/data/public/search/collectors/create_usage_collector.test.ts
@@ -90,18 +90,4 @@ describe('Search Usage Collector', () => {
SEARCH_EVENT_TYPE.LONG_QUERY_RUN_BEYOND_TIMEOUT
);
});
-
- test('tracks response errors', async () => {
- const duration = 10;
- await usageCollector.trackError(duration);
- expect(mockCoreSetup.http.post).toBeCalled();
- expect(mockCoreSetup.http.post.mock.calls[0][0]).toBe('/api/search/usage');
- });
-
- test('tracks response duration', async () => {
- const duration = 5;
- await usageCollector.trackSuccess(duration);
- expect(mockCoreSetup.http.post).toBeCalled();
- expect(mockCoreSetup.http.post.mock.calls[0][0]).toBe('/api/search/usage');
- });
});
diff --git a/src/plugins/data/public/search/collectors/create_usage_collector.ts b/src/plugins/data/public/search/collectors/create_usage_collector.ts
index cb1b2b65c17c8..7adb0c3caa675 100644
--- a/src/plugins/data/public/search/collectors/create_usage_collector.ts
+++ b/src/plugins/data/public/search/collectors/create_usage_collector.ts
@@ -72,21 +72,5 @@ export const createUsageCollector = (
SEARCH_EVENT_TYPE.LONG_QUERY_RUN_BEYOND_TIMEOUT
);
},
- trackError: async (duration: number) => {
- return core.http.post('/api/search/usage', {
- body: JSON.stringify({
- eventType: 'error',
- duration,
- }),
- });
- },
- trackSuccess: async (duration: number) => {
- return core.http.post('/api/search/usage', {
- body: JSON.stringify({
- eventType: 'success',
- duration,
- }),
- });
- },
};
};
diff --git a/src/plugins/data/public/search/collectors/types.ts b/src/plugins/data/public/search/collectors/types.ts
index bb85532fd3ab5..3e98f901eb0c3 100644
--- a/src/plugins/data/public/search/collectors/types.ts
+++ b/src/plugins/data/public/search/collectors/types.ts
@@ -31,6 +31,4 @@ export interface SearchUsageCollector {
trackLongQueryPopupShown: () => Promise;
trackLongQueryDialogDismissed: () => Promise;
trackLongQueryRunBeyondTimeout: () => Promise;
- trackError: (duration: number) => Promise;
- trackSuccess: (duration: number) => Promise;
}
diff --git a/src/plugins/data/public/search/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor.ts
index 84e24114a9e6c..e6eca16c5ca4b 100644
--- a/src/plugins/data/public/search/search_interceptor.ts
+++ b/src/plugins/data/public/search/search_interceptor.ts
@@ -18,7 +18,7 @@
*/
import { BehaviorSubject, throwError, timer, Subscription, defer, from, Observable } from 'rxjs';
-import { finalize, filter, tap } from 'rxjs/operators';
+import { finalize, filter } from 'rxjs/operators';
import { ApplicationStart, Toast, ToastsStart, CoreStart } from 'kibana/public';
import { getCombinedSignal, AbortError } from '../../common/utils';
import { IEsSearchRequest, IEsSearchResponse } from '../../common/search';
@@ -92,16 +92,14 @@ export class SearchInterceptor {
protected runSearch(
request: IEsSearchRequest,
- combinedSignal: AbortSignal
+ signal: AbortSignal
): Observable {
- return from(
- this.deps.http.fetch({
- path: `/internal/search/es`,
- method: 'POST',
- body: JSON.stringify(request),
- signal: combinedSignal,
- })
- );
+ const { id, ...searchRequest } = request;
+ const path = id != null ? `/internal/search/es/${id}` : '/internal/search/es';
+ const method = 'POST';
+ const body = JSON.stringify(id != null ? {} : searchRequest);
+ const response = this.deps.http.fetch({ path, method, body, signal });
+ return from(response);
}
/**
@@ -123,13 +121,6 @@ export class SearchInterceptor {
this.pendingCount$.next(++this.pendingCount);
return this.runSearch(request, combinedSignal).pipe(
- tap({
- next: (e) => {
- if (this.deps.usageCollector) {
- this.deps.usageCollector.trackSuccess(e.rawResponse.took);
- }
- },
- }),
finalize(() => {
this.pendingCount$.next(--this.pendingCount);
cleanup();
diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx
index 5f2d4c00cd6b6..879ff6708068e 100644
--- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx
+++ b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx
@@ -51,7 +51,7 @@ startMock.uiSettings.get.mockImplementation((key: string) => {
return 'MMM D, YYYY @ HH:mm:ss.SSS';
case UI_SETTINGS.HISTORY_LIMIT:
return 10;
- case 'timepicker:timeDefaults':
+ case UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS:
return {
from: 'now-15m',
to: 'now',
diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx
index 86bf30ba0e374..05249d46a1c50 100644
--- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx
+++ b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx
@@ -94,7 +94,7 @@ export function QueryBarTopRow(props: Props) {
}
function getDateRange() {
- const defaultTimeSetting = uiSettings!.get('timepicker:timeDefaults');
+ const defaultTimeSetting = uiSettings!.get(UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS);
return {
from: props.dateRangeFrom || defaultTimeSetting.from,
to: props.dateRangeTo || defaultTimeSetting.to,
diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts
index 461b21e1cc980..1f3d7fbcb9f0f 100644
--- a/src/plugins/data/server/index.ts
+++ b/src/plugins/data/server/index.ts
@@ -170,6 +170,8 @@ export {
ISearchStart,
getDefaultSearchParams,
getTotalLoaded,
+ usageProvider,
+ SearchUsage,
} from './search';
// Search namespace
diff --git a/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/index.ts b/src/plugins/data/server/search/collectors/index.ts
similarity index 93%
rename from packages/kbn-optimizer/src/common/disallowed_syntax_plugin/index.ts
rename to src/plugins/data/server/search/collectors/index.ts
index ca5ba1b90fe95..417dc1c2012d3 100644
--- a/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/index.ts
+++ b/src/plugins/data/server/search/collectors/index.ts
@@ -17,4 +17,4 @@
* under the License.
*/
-export * from './disallowed_syntax_plugin';
+export { usageProvider, SearchUsage } from './usage';
diff --git a/src/plugins/data/server/search/collectors/routes.ts b/src/plugins/data/server/search/collectors/routes.ts
deleted file mode 100644
index 38fb517e3c3f6..0000000000000
--- a/src/plugins/data/server/search/collectors/routes.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { schema } from '@kbn/config-schema';
-import { CoreSetup } from '../../../../../core/server';
-import { DataPluginStart } from '../../plugin';
-import { SearchUsage } from './usage';
-
-export function registerSearchUsageRoute(
- core: CoreSetup