diff --git a/src/plugins/dashboard/public/application/dashboard_empty_screen.tsx b/src/plugins/dashboard/public/application/dashboard_empty_screen.tsx
index 8bf205b8cb507..955d5244ce190 100644
--- a/src/plugins/dashboard/public/application/dashboard_empty_screen.tsx
+++ b/src/plugins/dashboard/public/application/dashboard_empty_screen.tsx
@@ -50,8 +50,8 @@ export function DashboardEmptyScreen({
}: DashboardEmptyScreenProps) {
const IS_DARK_THEME = uiSettings.get('theme:darkMode');
const emptyStateGraphicURL = IS_DARK_THEME
- ? '/plugins/kibana/home/assets/welcome_graphic_dark_2x.png'
- : '/plugins/kibana/home/assets/welcome_graphic_light_2x.png';
+ ? '/plugins/home/assets/welcome_graphic_dark_2x.png'
+ : '/plugins/home/assets/welcome_graphic_light_2x.png';
const linkToVisualizeParagraph = (
) => obj.get('title').toLowerCase() === title.toLowerCase()
);
}
-
-export function getRoutes() {
- return {
- edit: '/management/kibana/index_patterns/{{id}}',
- addField: '/management/kibana/index_patterns/{{id}}/create-field',
- indexedFields: '/management/kibana/index_patterns/{{id}}?_a=(tab:indexedFields)',
- scriptedFields: '/management/kibana/index_patterns/{{id}}?_a=(tab:scriptedFields)',
- sourceFilters: '/management/kibana/index_patterns/{{id}}?_a=(tab:sourceFilters)',
- };
-}
diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md
index cb1e1d2bd0efe..ee56ad60441f4 100644
--- a/src/plugins/data/public/public.api.md
+++ b/src/plugins/data/public/public.api.md
@@ -912,14 +912,6 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
removeScriptedField(field: IFieldType): Promise;
// (undocumented)
- get routes(): {
- edit: string;
- addField: string;
- indexedFields: string;
- scriptedFields: string;
- sourceFilters: string;
- };
- // (undocumented)
save(saveAttempts?: number): Promise;
// (undocumented)
timeFieldName: string | undefined;
@@ -1021,7 +1013,6 @@ export const indexPatterns: {
validate: typeof validateIndexPattern;
getFromSavedObject: typeof getFromSavedObject;
flattenHitWrapper: typeof flattenHitWrapper;
- getRoutes: typeof getRoutes;
formatHitProvider: typeof formatHitProvider;
};
@@ -1812,27 +1803,26 @@ export type TSearchStrategyProvider = (context: ISearc
// src/plugins/data/public/index.ts:179:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:179:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:179:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "getRoutes" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:379:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:380:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:391:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:395:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:403:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:237:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:374:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:374:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:374:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:374:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:376:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:377:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:386:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:387:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:392:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:393:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:397:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts
diff --git a/src/plugins/home/public/application/components/sample_data/index.tsx b/src/plugins/home/public/application/components/sample_data/index.tsx
index 381aa49c30d5a..2a51b48b08469 100644
--- a/src/plugins/home/public/application/components/sample_data/index.tsx
+++ b/src/plugins/home/public/application/components/sample_data/index.tsx
@@ -42,7 +42,7 @@ interface Props {
export function SampleDataCard({ urlBasePath, onDecline, onConfirm }: Props) {
return (
}
description={
diff --git a/src/legacy/core_plugins/kibana/public/home/assets/illustration_elastic_heart.png b/src/plugins/home/public/assets/illustration_elastic_heart.png
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/home/assets/illustration_elastic_heart.png
rename to src/plugins/home/public/assets/illustration_elastic_heart.png
diff --git a/src/legacy/core_plugins/kibana/public/home/sample_data_resources/ecommerce/dashboard.png b/src/plugins/home/public/assets/sample_data_resources/ecommerce/dashboard.png
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/home/sample_data_resources/ecommerce/dashboard.png
rename to src/plugins/home/public/assets/sample_data_resources/ecommerce/dashboard.png
diff --git a/src/legacy/core_plugins/kibana/public/home/sample_data_resources/ecommerce/dashboard_dark.png b/src/plugins/home/public/assets/sample_data_resources/ecommerce/dashboard_dark.png
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/home/sample_data_resources/ecommerce/dashboard_dark.png
rename to src/plugins/home/public/assets/sample_data_resources/ecommerce/dashboard_dark.png
diff --git a/src/legacy/core_plugins/kibana/public/home/sample_data_resources/flights/dashboard.png b/src/plugins/home/public/assets/sample_data_resources/flights/dashboard.png
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/home/sample_data_resources/flights/dashboard.png
rename to src/plugins/home/public/assets/sample_data_resources/flights/dashboard.png
diff --git a/src/legacy/core_plugins/kibana/public/home/sample_data_resources/flights/dashboard_dark.png b/src/plugins/home/public/assets/sample_data_resources/flights/dashboard_dark.png
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/home/sample_data_resources/flights/dashboard_dark.png
rename to src/plugins/home/public/assets/sample_data_resources/flights/dashboard_dark.png
diff --git a/src/legacy/core_plugins/kibana/public/home/sample_data_resources/logs/dashboard.png b/src/plugins/home/public/assets/sample_data_resources/logs/dashboard.png
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/home/sample_data_resources/logs/dashboard.png
rename to src/plugins/home/public/assets/sample_data_resources/logs/dashboard.png
diff --git a/src/legacy/core_plugins/kibana/public/home/sample_data_resources/logs/dashboard_dark.png b/src/plugins/home/public/assets/sample_data_resources/logs/dashboard_dark.png
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/home/sample_data_resources/logs/dashboard_dark.png
rename to src/plugins/home/public/assets/sample_data_resources/logs/dashboard_dark.png
diff --git a/src/legacy/core_plugins/kibana/public/home/assets/welcome_graphic_dark_2x.png b/src/plugins/home/public/assets/welcome_graphic_dark_2x.png
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/home/assets/welcome_graphic_dark_2x.png
rename to src/plugins/home/public/assets/welcome_graphic_dark_2x.png
diff --git a/src/legacy/core_plugins/kibana/public/home/assets/welcome_graphic_light_2x.png b/src/plugins/home/public/assets/welcome_graphic_light_2x.png
similarity index 100%
rename from src/legacy/core_plugins/kibana/public/home/assets/welcome_graphic_light_2x.png
rename to src/plugins/home/public/assets/welcome_graphic_light_2x.png
diff --git a/src/plugins/home/server/services/sample_data/data_sets/ecommerce/index.ts b/src/plugins/home/server/services/sample_data/data_sets/ecommerce/index.ts
index 3e16187c44343..b0cc2e2db3cc9 100644
--- a/src/plugins/home/server/services/sample_data/data_sets/ecommerce/index.ts
+++ b/src/plugins/home/server/services/sample_data/data_sets/ecommerce/index.ts
@@ -36,8 +36,8 @@ export const ecommerceSpecProvider = function(): SampleDatasetSchema {
id: 'ecommerce',
name: ecommerceName,
description: ecommerceDescription,
- previewImagePath: '/plugins/kibana/home/sample_data_resources/ecommerce/dashboard.png',
- darkPreviewImagePath: '/plugins/kibana/home/sample_data_resources/ecommerce/dashboard_dark.png',
+ previewImagePath: '/plugins/home/assets/sample_data_resources/ecommerce/dashboard.png',
+ darkPreviewImagePath: '/plugins/home/assets/sample_data_resources/ecommerce/dashboard_dark.png',
overviewDashboard: '722b74f0-b882-11e8-a6d9-e546fe2bba5f',
appLinks: initialAppLinks,
defaultIndex: 'ff959d40-b880-11e8-a6d9-e546fe2bba5f',
diff --git a/src/plugins/home/server/services/sample_data/data_sets/flights/index.ts b/src/plugins/home/server/services/sample_data/data_sets/flights/index.ts
index d63ea8f7fb493..fc3cb6094b5ea 100644
--- a/src/plugins/home/server/services/sample_data/data_sets/flights/index.ts
+++ b/src/plugins/home/server/services/sample_data/data_sets/flights/index.ts
@@ -36,8 +36,8 @@ export const flightsSpecProvider = function(): SampleDatasetSchema {
id: 'flights',
name: flightsName,
description: flightsDescription,
- previewImagePath: '/plugins/kibana/home/sample_data_resources/flights/dashboard.png',
- darkPreviewImagePath: '/plugins/kibana/home/sample_data_resources/flights/dashboard_dark.png',
+ previewImagePath: '/plugins/home/assets/sample_data_resources/flights/dashboard.png',
+ darkPreviewImagePath: '/plugins/home/assets/sample_data_resources/flights/dashboard_dark.png',
overviewDashboard: '7adfa750-4c81-11e8-b3d7-01146121b73d',
appLinks: initialAppLinks,
defaultIndex: 'd3d7af60-4c81-11e8-b3d7-01146121b73d',
diff --git a/src/plugins/home/server/services/sample_data/data_sets/logs/index.ts b/src/plugins/home/server/services/sample_data/data_sets/logs/index.ts
index bb6e2982f59a0..d8f205dff24e8 100644
--- a/src/plugins/home/server/services/sample_data/data_sets/logs/index.ts
+++ b/src/plugins/home/server/services/sample_data/data_sets/logs/index.ts
@@ -36,8 +36,8 @@ export const logsSpecProvider = function(): SampleDatasetSchema {
id: 'logs',
name: logsName,
description: logsDescription,
- previewImagePath: '/plugins/kibana/home/sample_data_resources/logs/dashboard.png',
- darkPreviewImagePath: '/plugins/kibana/home/sample_data_resources/logs/dashboard_dark.png',
+ previewImagePath: '/plugins/home/assets/sample_data_resources/logs/dashboard.png',
+ darkPreviewImagePath: '/plugins/home/assets/sample_data_resources/logs/dashboard_dark.png',
overviewDashboard: 'edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b',
appLinks: initialAppLinks,
defaultIndex: '90943e30-9a47-11e8-b64d-95841ca0b247',
diff --git a/src/plugins/maps_legacy/config.ts b/src/plugins/maps_legacy/config.ts
index 13a0ad6b393a3..67e46d2270583 100644
--- a/src/plugins/maps_legacy/config.ts
+++ b/src/plugins/maps_legacy/config.ts
@@ -19,31 +19,7 @@
import { schema, TypeOf } from '@kbn/config-schema';
import { configSchema as tilemapSchema } from '../tile_map/config';
-
-// TODO: Pull this portion from region_map
-export const regionmapSchema = schema.object({
- includeElasticMapsService: schema.boolean({ defaultValue: true }),
- layers: schema.arrayOf(
- schema.object({
- url: schema.string(),
- format: schema.object({
- type: schema.string({ defaultValue: 'geojson' }),
- }),
- meta: schema.object({
- feature_collection_path: schema.string({ defaultValue: 'data' }),
- }),
- attribution: schema.string(),
- name: schema.string(),
- fields: schema.arrayOf(
- schema.object({
- name: schema.string(),
- description: schema.string(),
- })
- ),
- }),
- { defaultValue: [] }
- ),
-});
+import { configSchema as regionmapSchema } from '../region_map/config';
export const configSchema = schema.object({
includeElasticMapsService: schema.boolean({ defaultValue: true }),
diff --git a/src/plugins/maps_legacy/public/index.ts b/src/plugins/maps_legacy/public/index.ts
index 3fe377fbdc41f..a7f5427909334 100644
--- a/src/plugins/maps_legacy/public/index.ts
+++ b/src/plugins/maps_legacy/public/index.ts
@@ -45,6 +45,7 @@ import {
import { mapTooltipProvider } from './tooltip_provider';
export interface MapsLegacyConfigType {
+ regionmap: any;
emsTileLayerId: string;
includeElasticMapsService: boolean;
proxyElasticMapsServiceInMaps: boolean;
diff --git a/src/legacy/core_plugins/region_map/public/legacy.ts b/src/plugins/region_map/config.ts
similarity index 51%
rename from src/legacy/core_plugins/region_map/public/legacy.ts
rename to src/plugins/region_map/config.ts
index 4bbd839331e56..a721a76ca0a82 100644
--- a/src/legacy/core_plugins/region_map/public/legacy.ts
+++ b/src/plugins/region_map/config.ts
@@ -17,19 +17,30 @@
* under the License.
*/
-import { PluginInitializerContext } from 'kibana/public';
-import { npSetup, npStart } from 'ui/new_platform';
+import { schema, TypeOf } from '@kbn/config-schema';
-import { RegionMapPluginSetupDependencies } from './plugin';
-import { plugin } from '.';
+export const configSchema = schema.object({
+ includeElasticMapsService: schema.boolean({ defaultValue: true }),
+ layers: schema.arrayOf(
+ schema.object({
+ url: schema.string(),
+ format: schema.object({
+ type: schema.string({ defaultValue: 'geojson' }),
+ }),
+ meta: schema.object({
+ feature_collection_path: schema.string({ defaultValue: 'data' }),
+ }),
+ attribution: schema.string(),
+ name: schema.string(),
+ fields: schema.arrayOf(
+ schema.object({
+ name: schema.string(),
+ description: schema.string(),
+ })
+ ),
+ }),
+ { defaultValue: [] }
+ ),
+});
-const plugins: Readonly = {
- expressions: npSetup.plugins.expressions,
- visualizations: npSetup.plugins.visualizations,
- mapsLegacy: npSetup.plugins.mapsLegacy,
-};
-
-const pluginInstance = plugin({} as PluginInitializerContext);
-
-export const setup = pluginInstance.setup(npSetup.core, plugins);
-export const start = pluginInstance.start(npStart.core);
+export type ConfigSchema = TypeOf;
diff --git a/src/plugins/region_map/kibana.json b/src/plugins/region_map/kibana.json
new file mode 100644
index 0000000000000..3a6f64e92bcba
--- /dev/null
+++ b/src/plugins/region_map/kibana.json
@@ -0,0 +1,14 @@
+{
+ "id": "regionMap",
+ "version": "8.0.0",
+ "kibanaVersion": "kibana",
+ "configPath": ["map", "regionmap"],
+ "ui": true,
+ "server": true,
+ "requiredPlugins": [
+ "visualizations",
+ "expressions",
+ "mapsLegacy",
+ "data"
+ ]
+}
diff --git a/src/legacy/core_plugins/region_map/package.json b/src/plugins/region_map/package.json
similarity index 100%
rename from src/legacy/core_plugins/region_map/package.json
rename to src/plugins/region_map/package.json
diff --git a/src/legacy/core_plugins/region_map/public/__snapshots__/region_map_fn.test.js.snap b/src/plugins/region_map/public/__snapshots__/region_map_fn.test.js.snap
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/__snapshots__/region_map_fn.test.js.snap
rename to src/plugins/region_map/public/__snapshots__/region_map_fn.test.js.snap
diff --git a/src/legacy/core_plugins/region_map/public/__tests__/aftercolorchange.png b/src/plugins/region_map/public/__tests__/aftercolorchange.png
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/__tests__/aftercolorchange.png
rename to src/plugins/region_map/public/__tests__/aftercolorchange.png
diff --git a/src/legacy/core_plugins/region_map/public/__tests__/afterdatachange.png b/src/plugins/region_map/public/__tests__/afterdatachange.png
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/__tests__/afterdatachange.png
rename to src/plugins/region_map/public/__tests__/afterdatachange.png
diff --git a/src/legacy/core_plugins/region_map/public/__tests__/afterdatachangeandresize.png b/src/plugins/region_map/public/__tests__/afterdatachangeandresize.png
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/__tests__/afterdatachangeandresize.png
rename to src/plugins/region_map/public/__tests__/afterdatachangeandresize.png
diff --git a/src/legacy/core_plugins/region_map/public/__tests__/afterresize.png b/src/plugins/region_map/public/__tests__/afterresize.png
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/__tests__/afterresize.png
rename to src/plugins/region_map/public/__tests__/afterresize.png
diff --git a/src/legacy/core_plugins/region_map/public/__tests__/changestartup.png b/src/plugins/region_map/public/__tests__/changestartup.png
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/__tests__/changestartup.png
rename to src/plugins/region_map/public/__tests__/changestartup.png
diff --git a/src/legacy/core_plugins/region_map/public/__tests__/initial.png b/src/plugins/region_map/public/__tests__/initial.png
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/__tests__/initial.png
rename to src/plugins/region_map/public/__tests__/initial.png
diff --git a/src/legacy/core_plugins/region_map/public/__tests__/region_map_visualization.js b/src/plugins/region_map/public/__tests__/region_map_visualization.js
similarity index 92%
rename from src/legacy/core_plugins/region_map/public/__tests__/region_map_visualization.js
rename to src/plugins/region_map/public/__tests__/region_map_visualization.js
index 7271f39debb39..cefef98fae814 100644
--- a/src/legacy/core_plugins/region_map/public/__tests__/region_map_visualization.js
+++ b/src/plugins/region_map/public/__tests__/region_map_visualization.js
@@ -25,17 +25,17 @@ import ChoroplethLayer from '../choropleth_layer';
import { ImageComparator } from 'test_utils/image_comparator';
import worldJson from './world.json';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import EMS_CATALOGUE from '../../../../../plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_manifest.json';
+import EMS_CATALOGUE from '../../../maps_legacy/public/__tests__/map/ems_mocks/sample_manifest.json';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import EMS_FILES from '../../../../../plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_files.json';
+import EMS_FILES from '../../../maps_legacy/public/__tests__/map/ems_mocks/sample_files.json';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import EMS_TILES from '../../../../../plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_tiles.json';
+import EMS_TILES from '../../../maps_legacy/public/__tests__/map/ems_mocks/sample_tiles.json';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import EMS_STYLE_ROAD_MAP_BRIGHT from '../../../../../plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_bright';
+import EMS_STYLE_ROAD_MAP_BRIGHT from '../../../maps_legacy/public/__tests__/map/ems_mocks/sample_style_bright';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import EMS_STYLE_ROAD_MAP_DESATURATED from '../../../../../plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_desaturated';
+import EMS_STYLE_ROAD_MAP_DESATURATED from '../../../maps_legacy/public/__tests__/map/ems_mocks/sample_style_desaturated';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import EMS_STYLE_DARK_MAP from '../../../../../plugins/maps_legacy/public/__tests__/map/ems_mocks/sample_style_dark';
+import EMS_STYLE_DARK_MAP from '../../../maps_legacy/public/__tests__/map/ems_mocks/sample_style_dark';
import initialPng from './initial.png';
import toiso3Png from './toiso3.png';
@@ -48,14 +48,14 @@ import changestartupPng from './changestartup.png';
import { createRegionMapVisualization } from '../region_map_visualization';
import { createRegionMapTypeDefinition } from '../region_map_type';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { ExprVis } from '../../../../../plugins/visualizations/public/expressions/vis';
+import { ExprVis } from '../../../visualizations/public/expressions/vis';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { BaseVisType } from '../../../../../plugins/visualizations/public/vis_types/base_vis_type';
+import { BaseVisType } from '../../../visualizations/public/vis_types/base_vis_type';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { setInjectedVarFunc } from '../../../../../plugins/maps_legacy/public/kibana_services';
+import { setInjectedVarFunc } from '../../../maps_legacy/public/kibana_services';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { ServiceSettings } from '../../../../../plugins/maps_legacy/public/map/service_settings';
-import { getBaseMapsVis } from '../../../../../plugins/maps_legacy/public';
+import { ServiceSettings } from '../../../maps_legacy/public/map/service_settings';
+import { getBaseMapsVis } from '../../../maps_legacy/public';
const THRESHOLD = 0.45;
const PIXEL_DIFF = 96;
diff --git a/src/legacy/core_plugins/region_map/public/__tests__/toiso3.png b/src/plugins/region_map/public/__tests__/toiso3.png
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/__tests__/toiso3.png
rename to src/plugins/region_map/public/__tests__/toiso3.png
diff --git a/src/legacy/core_plugins/region_map/public/__tests__/world.json b/src/plugins/region_map/public/__tests__/world.json
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/__tests__/world.json
rename to src/plugins/region_map/public/__tests__/world.json
diff --git a/src/legacy/core_plugins/region_map/public/choropleth_layer.js b/src/plugins/region_map/public/choropleth_layer.js
similarity index 98%
rename from src/legacy/core_plugins/region_map/public/choropleth_layer.js
rename to src/plugins/region_map/public/choropleth_layer.js
index f8c48958a1b9b..ddaf2db257fba 100644
--- a/src/legacy/core_plugins/region_map/public/choropleth_layer.js
+++ b/src/plugins/region_map/public/choropleth_layer.js
@@ -22,9 +22,9 @@ import _ from 'lodash';
import d3 from 'd3';
import { i18n } from '@kbn/i18n';
import * as topojson from 'topojson-client';
-import { toastNotifications } from 'ui/notify';
-import { colorUtil, KibanaMapLayer } from '../../../../plugins/maps_legacy/public';
-import { truncatedColorMaps } from '../../../../plugins/charts/public';
+import { getNotifications } from './kibana_services';
+import { colorUtil, KibanaMapLayer } from '../../maps_legacy/public';
+import { truncatedColorMaps } from '../../charts/public';
const EMPTY_STYLE = {
weight: 1,
@@ -182,7 +182,7 @@ CORS configuration of the server permits requests from the Kibana application on
);
}
- toastNotifications.addDanger({
+ getNotifications().toasts.addDanger({
title: i18n.translate(
'regionMap.choroplethLayer.downloadingVectorDataErrorMessageTitle',
{
diff --git a/src/legacy/core_plugins/region_map/public/components/region_map_options.tsx b/src/plugins/region_map/public/components/region_map_options.tsx
similarity index 95%
rename from src/legacy/core_plugins/region_map/public/components/region_map_options.tsx
rename to src/plugins/region_map/public/components/region_map_options.tsx
index 5604067433f13..9a6987b981539 100644
--- a/src/legacy/core_plugins/region_map/public/components/region_map_options.tsx
+++ b/src/plugins/region_map/public/components/region_map_options.tsx
@@ -22,17 +22,9 @@ import { EuiIcon, EuiLink, EuiPanel, EuiSpacer, EuiText, EuiTitle } from '@elast
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
-import {
- FileLayerField,
- VectorLayer,
- IServiceSettings,
-} from '../../../../../plugins/maps_legacy/public';
-import {
- NumberInputOption,
- SelectOption,
- SwitchOption,
-} from '../../../../../plugins/charts/public';
-import { RegionMapVisParams, WmsOptions } from '../../../../../plugins/maps_legacy/public';
+import { FileLayerField, VectorLayer, IServiceSettings } from '../../../maps_legacy/public';
+import { NumberInputOption, SelectOption, SwitchOption } from '../../../charts/public';
+import { RegionMapVisParams, WmsOptions } from '../../../maps_legacy/public';
const mapLayerForOption = ({ layerId, name }: VectorLayer) => ({
text: name,
diff --git a/src/legacy/core_plugins/region_map/public/index.ts b/src/plugins/region_map/public/index.ts
similarity index 86%
rename from src/legacy/core_plugins/region_map/public/index.ts
rename to src/plugins/region_map/public/index.ts
index a29f5aa247026..3f920ad16683a 100644
--- a/src/legacy/core_plugins/region_map/public/index.ts
+++ b/src/plugins/region_map/public/index.ts
@@ -17,9 +17,14 @@
* under the License.
*/
-import { PluginInitializerContext } from '../../../../core/public';
+import { PluginInitializerContext } from 'kibana/public';
import { RegionMapPlugin as Plugin } from './plugin';
+export interface RegionMapsConfigType {
+ includeElasticMapsService: boolean;
+ layers: any[];
+}
+
export function plugin(initializerContext: PluginInitializerContext) {
return new Plugin(initializerContext);
}
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/index.ts b/src/plugins/region_map/public/kibana_services.ts
similarity index 60%
rename from test/plugin_functional/plugins/kbn_tp_embeddable_explorer/index.ts
rename to src/plugins/region_map/public/kibana_services.ts
index 99f54277be5d2..1ef58c69c5bef 100644
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/index.ts
+++ b/src/plugins/region_map/public/kibana_services.ts
@@ -17,23 +17,14 @@
* under the License.
*/
-import { Legacy } from 'kibana';
+import { NotificationsStart } from 'kibana/public';
+import { createGetterSetter } from '../../kibana_utils/public';
+import { DataPublicPluginStart } from '../../data/public';
-// eslint-disable-next-line import/no-default-export
-export default function(kibana: any) {
- return new kibana.Plugin({
- require: ['kibana'],
- uiExports: {
- app: {
- title: 'Embeddable Explorer',
- order: 1,
- main: 'plugins/kbn_tp_embeddable_explorer/np_ready/public/legacy',
- },
- },
- init(server: Legacy.Server) {
- server.injectUiAppVars('kbn_tp_embeddable_explorer', async () =>
- server.getInjectedUiAppVars('kibana')
- );
- },
- });
-}
+export const [getFormatService, setFormatService] = createGetterSetter<
+ DataPublicPluginStart['fieldFormats']
+>('data.fieldFormats');
+
+export const [getNotifications, setNotifications] = createGetterSetter(
+ 'Notifications'
+);
diff --git a/src/legacy/core_plugins/region_map/public/plugin.ts b/src/plugins/region_map/public/plugin.ts
similarity index 56%
rename from src/legacy/core_plugins/region_map/public/plugin.ts
rename to src/plugins/region_map/public/plugin.ts
index 08a73517dc13b..09a13fbe9774e 100644
--- a/src/legacy/core_plugins/region_map/public/plugin.ts
+++ b/src/plugins/region_map/public/plugin.ts
@@ -22,18 +22,19 @@ import {
Plugin,
PluginInitializerContext,
IUiSettingsClient,
-} from '../../../../core/public';
-import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public';
-import { VisualizationsSetup } from '../../../../plugins/visualizations/public';
+ NotificationsStart,
+} from 'kibana/public';
+import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public';
+import { VisualizationsSetup } from '../../visualizations/public';
// @ts-ignore
import { createRegionMapFn } from './region_map_fn';
// @ts-ignore
import { createRegionMapTypeDefinition } from './region_map_type';
-import {
- getBaseMapsVis,
- IServiceSettings,
- MapsLegacyPluginSetup,
-} from '../../../../plugins/maps_legacy/public';
+import { getBaseMapsVis, IServiceSettings, MapsLegacyPluginSetup } from '../../maps_legacy/public';
+import { setFormatService, setNotifications } from './kibana_services';
+import { DataPublicPluginStart } from '../../data/public';
+import { RegionMapsConfigType } from './index';
+import { ConfigSchema } from '../../maps_legacy/config';
/** @private */
interface RegionMapVisualizationDependencies {
@@ -50,27 +51,46 @@ export interface RegionMapPluginSetupDependencies {
mapsLegacy: MapsLegacyPluginSetup;
}
+/** @internal */
+export interface RegionMapPluginStartDependencies {
+ data: DataPublicPluginStart;
+ notifications: NotificationsStart;
+}
+
/** @internal */
export interface RegionMapsConfig {
includeElasticMapsService: boolean;
layers: any[];
}
+export interface RegionMapPluginSetup {
+ config: any;
+}
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
+export interface RegionMapPluginStart {}
+
/** @internal */
-export class RegionMapPlugin implements Plugin, void> {
- initializerContext: PluginInitializerContext;
+export class RegionMapPlugin implements Plugin {
+ readonly _initializerContext: PluginInitializerContext;
constructor(initializerContext: PluginInitializerContext) {
- this.initializerContext = initializerContext;
+ this._initializerContext = initializerContext;
}
public async setup(
core: CoreSetup,
{ expressions, visualizations, mapsLegacy }: RegionMapPluginSetupDependencies
) {
+ const config = {
+ ...this._initializerContext.config.get(),
+ // The maps legacy plugin updates the regionmap config directly in service_settings,
+ // future work on how configurations across the different plugins are organized would
+ // ideally constrain regionmap config updates to occur only from this plugin
+ ...mapsLegacy.config.regionmap,
+ };
const visualizationDependencies: Readonly = {
uiSettings: core.uiSettings,
- regionmapsConfig: core.injectedMetadata.getInjectedVar('regionmap') as RegionMapsConfig,
+ regionmapsConfig: config as RegionMapsConfig,
serviceSettings: mapsLegacy.serviceSettings,
BaseMapsVisualization: getBaseMapsVis(core, mapsLegacy.serviceSettings),
};
@@ -80,9 +100,15 @@ export class RegionMapPlugin implements Plugin, void> {
visualizations.createBaseVisualization(
createRegionMapTypeDefinition(visualizationDependencies)
);
+
+ return {
+ config,
+ };
}
- public start(core: CoreStart) {
- // nothing to do here yet
+ // @ts-ignore
+ public start(core: CoreStart, { data }: RegionMapPluginStartDependencies) {
+ setFormatService(data.fieldFormats);
+ setNotifications(core.notifications);
}
}
diff --git a/src/legacy/core_plugins/region_map/public/region_map_fn.js b/src/plugins/region_map/public/region_map_fn.js
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/region_map_fn.js
rename to src/plugins/region_map/public/region_map_fn.js
diff --git a/src/legacy/core_plugins/region_map/public/region_map_fn.test.js b/src/plugins/region_map/public/region_map_fn.test.js
similarity index 92%
rename from src/legacy/core_plugins/region_map/public/region_map_fn.test.js
rename to src/plugins/region_map/public/region_map_fn.test.js
index 07b4e33b85e27..684cc5e897df4 100644
--- a/src/legacy/core_plugins/region_map/public/region_map_fn.test.js
+++ b/src/plugins/region_map/public/region_map_fn.test.js
@@ -18,11 +18,9 @@
*/
// eslint-disable-next-line
-import { functionWrapper } from '../../../../plugins/expressions/common/expression_functions/specs/tests/utils';
+import { functionWrapper } from '../../expressions/common/expression_functions/specs/tests/utils';
import { createRegionMapFn } from './region_map_fn';
-jest.mock('ui/new_platform');
-
describe('interpreter/functions#regionmap', () => {
const fn = functionWrapper(createRegionMapFn());
const context = {
diff --git a/src/legacy/core_plugins/region_map/public/region_map_type.js b/src/plugins/region_map/public/region_map_type.js
similarity index 95%
rename from src/legacy/core_plugins/region_map/public/region_map_type.js
rename to src/plugins/region_map/public/region_map_type.js
index b7ed14ed3706e..d29360a9589ab 100644
--- a/src/legacy/core_plugins/region_map/public/region_map_type.js
+++ b/src/plugins/region_map/public/region_map_type.js
@@ -21,9 +21,9 @@ import { i18n } from '@kbn/i18n';
import { mapToLayerWithId } from './util';
import { createRegionMapVisualization } from './region_map_visualization';
import { RegionMapOptions } from './components/region_map_options';
-import { truncatedColorSchemas } from '../../../../plugins/charts/public';
-import { Schemas } from '../../../../plugins/vis_default_editor/public';
-import { ORIGIN } from '../../../../plugins/maps_legacy/public';
+import { truncatedColorSchemas } from '../../charts/public';
+import { Schemas } from '../../vis_default_editor/public';
+import { ORIGIN } from '../../maps_legacy/public';
export function createRegionMapTypeDefinition(dependencies) {
const { uiSettings, regionmapsConfig, serviceSettings } = dependencies;
diff --git a/src/legacy/core_plugins/region_map/public/region_map_visualization.js b/src/plugins/region_map/public/region_map_visualization.js
similarity index 93%
rename from src/legacy/core_plugins/region_map/public/region_map_visualization.js
rename to src/plugins/region_map/public/region_map_visualization.js
index 5dbc1ecad277f..ed6a3ed2c10c8 100644
--- a/src/legacy/core_plugins/region_map/public/region_map_visualization.js
+++ b/src/plugins/region_map/public/region_map_visualization.js
@@ -19,11 +19,10 @@
import { i18n } from '@kbn/i18n';
import ChoroplethLayer from './choropleth_layer';
-import { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
-import { toastNotifications } from 'ui/notify';
-import { truncatedColorMaps } from '../../../../plugins/charts/public';
+import { getFormatService, getNotifications } from './kibana_services';
+import { truncatedColorMaps } from '../../charts/public';
import { tooltipFormatter } from './tooltip_formatter';
-import { mapTooltipProvider } from '../../../../plugins/maps_legacy/public';
+import { mapTooltipProvider } from '../../maps_legacy/public';
export function createRegionMapVisualization({
serviceSettings,
@@ -75,7 +74,7 @@ export function createRegionMapVisualization({
results
);
- const metricFieldFormatter = getFormat(this._params.metric.format);
+ const metricFieldFormatter = getFormatService().deserialize(this._params.metric.format);
this._choroplethLayer.setMetrics(results, metricFieldFormatter, valueColumn.name);
if (termColumn && valueColumn) {
@@ -108,7 +107,7 @@ export function createRegionMapVisualization({
this._params.showAllShapes
);
- const metricFieldFormatter = getFormat(this._params.metric.format);
+ const metricFieldFormatter = getFormatService().deserialize(this._params.metric.format);
this._choroplethLayer.setJoinField(visParams.selectedJoinField.name);
this._choroplethLayer.setColorRamp(truncatedColorMaps[visParams.colorSchema].value);
@@ -177,7 +176,7 @@ export function createRegionMapVisualization({
const shouldShowWarning =
this._params.isDisplayWarning && uiSettings.get('visualization:regionmap:showWarnings');
if (event.mismatches.length > 0 && shouldShowWarning) {
- toastNotifications.addWarning({
+ getNotifications().toasts.addWarning({
title: i18n.translate('regionMap.visualization.unableToShowMismatchesWarningTitle', {
defaultMessage:
'Unable to show {mismatchesLength} {oneMismatch, plural, one {result} other {results}} on map',
diff --git a/src/legacy/core_plugins/region_map/public/tooltip_formatter.js b/src/plugins/region_map/public/tooltip_formatter.js
similarity index 100%
rename from src/legacy/core_plugins/region_map/public/tooltip_formatter.js
rename to src/plugins/region_map/public/tooltip_formatter.js
diff --git a/src/legacy/core_plugins/region_map/public/util.ts b/src/plugins/region_map/public/util.ts
similarity index 86%
rename from src/legacy/core_plugins/region_map/public/util.ts
rename to src/plugins/region_map/public/util.ts
index b4e0dcd5f3510..0160a32e81522 100644
--- a/src/legacy/core_plugins/region_map/public/util.ts
+++ b/src/plugins/region_map/public/util.ts
@@ -17,8 +17,8 @@
* under the License.
*/
-import { FileLayer, VectorLayer } from '../../../../plugins/maps_legacy/public';
-import { ORIGIN } from '../../../../plugins/maps_legacy/public';
+import { FileLayer, VectorLayer } from '../../maps_legacy/public';
+import { ORIGIN } from '../../maps_legacy/public';
export const mapToLayerWithId = (prefix: string, layer: FileLayer): VectorLayer => ({
...layer,
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/initialize.ts b/src/plugins/region_map/server/index.ts
similarity index 69%
rename from test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/initialize.ts
rename to src/plugins/region_map/server/index.ts
index a4bc3cf17026c..e2c544d2d0ba6 100644
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/initialize.ts
+++ b/src/plugins/region_map/server/index.ts
@@ -17,4 +17,18 @@
* under the License.
*/
-import './np_ready/public/legacy';
+import { PluginConfigDescriptor } from 'kibana/server';
+import { configSchema, ConfigSchema } from '../config';
+
+export const config: PluginConfigDescriptor = {
+ exposeToBrowser: {
+ includeElasticMapsService: true,
+ layers: true,
+ },
+ schema: configSchema,
+};
+
+export const plugin = () => ({
+ setup() {},
+ start() {},
+});
diff --git a/src/test_utils/public/stub_index_pattern.js b/src/test_utils/public/stub_index_pattern.js
index 98ada2471e1ec..29fb4c20f692e 100644
--- a/src/test_utils/public/stub_index_pattern.js
+++ b/src/test_utils/public/stub_index_pattern.js
@@ -65,7 +65,6 @@ export default function StubIndexPattern(pattern, getConfig, timeField, fields,
this.getSourceFiltering = sinon.stub();
this.metaFields = ['_id', '_type', '_source'];
this.fieldFormatMap = {};
- this.routes = indexPatterns.getRoutes();
this.getComputedFields = IndexPattern.prototype.getComputedFields.bind(this);
this.flattenHit = indexPatterns.flattenHitWrapper(this, this.metaFields);
diff --git a/test/common/services/elasticsearch.ts b/test/common/services/elasticsearch.ts
index 63c4bfeeb4ce7..0436dc901292d 100644
--- a/test/common/services/elasticsearch.ts
+++ b/test/common/services/elasticsearch.ts
@@ -18,8 +18,9 @@
*/
import { format as formatUrl } from 'url';
-
+import fs from 'fs';
import { Client } from '@elastic/elasticsearch';
+import { CA_CERT_PATH } from '@kbn/dev-utils';
import { FtrProviderContext } from '../ftr_provider_context';
@@ -27,6 +28,9 @@ export function ElasticsearchProvider({ getService }: FtrProviderContext) {
const config = getService('config');
return new Client({
+ ssl: {
+ ca: fs.readFileSync(CA_CERT_PATH, 'utf-8'),
+ },
nodes: [formatUrl(config.get('servers.elasticsearch'))],
requestTimeout: config.get('timeouts.esRequestTimeout'),
});
diff --git a/test/functional/apps/discover/_discover_histogram.js b/test/functional/apps/discover/_discover_histogram.js
index 20e69ef8345c6..0f63510dce431 100644
--- a/test/functional/apps/discover/_discover_histogram.js
+++ b/test/functional/apps/discover/_discover_histogram.js
@@ -35,7 +35,7 @@ export default function({ getService, getPageObjects }) {
describe('discover histogram', function describeIndexTests() {
before(async function() {
log.debug('load kibana index with default index pattern');
- await PageObjects.common.navigateToApp('home');
+ await PageObjects.common.navigateToApp('settings');
await security.testUser.setRoles([
'kibana_admin',
'test_logstash_reader',
diff --git a/test/functional/apps/getting_started/_shakespeare.js b/test/functional/apps/getting_started/_shakespeare.js
index 3a3d6b93e166b..b0a572d9a54f9 100644
--- a/test/functional/apps/getting_started/_shakespeare.js
+++ b/test/functional/apps/getting_started/_shakespeare.js
@@ -58,6 +58,7 @@ export default function({ getService, getPageObjects }) {
});
it('should create shakespeare index pattern', async function() {
+ await PageObjects.common.navigateToApp('settings');
log.debug('Create shakespeare index pattern');
await PageObjects.settings.createIndexPattern('shakespeare', null);
const patternName = await PageObjects.settings.getIndexPageHeading();
diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts
index 93debdcc37f0a..4a7570049ded7 100644
--- a/test/functional/page_objects/common_page.ts
+++ b/test/functional/page_objects/common_page.ts
@@ -111,7 +111,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
await browser.get(appUrl);
} else {
log.debug(`navigateToUrl ${appUrl}`);
- await browser.get(appUrl);
+ await browser.get(appUrl, insertTimestamp);
// accept alert if it pops up
const alert = await browser.getAlert();
await alert?.accept();
@@ -242,7 +242,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
let lastUrl = await retry.try(async () => {
// since we're using hash URLs, always reload first to force re-render
log.debug('navigate to: ' + appUrl);
- await browser.get(appUrl);
+ await browser.get(appUrl, insertTimestamp);
// accept alert if it pops up
const alert = await browser.getAlert();
await alert?.accept();
diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts
index b7a6e10efd7dc..8175361ffc842 100644
--- a/test/functional/page_objects/settings_page.ts
+++ b/test/functional/page_objects/settings_page.ts
@@ -324,7 +324,6 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider
isStandardIndexPattern = true
) {
await retry.try(async () => {
- await this.navigateTo();
await PageObjects.header.waitUntilLoadingHasFinished();
await this.clickKibanaIndexPatterns();
await PageObjects.header.waitUntilLoadingHasFinished();
diff --git a/test/interpreter_functional/test_suites/run_pipeline/basic.ts b/test/interpreter_functional/test_suites/run_pipeline/basic.ts
index 51ad789143c54..a2172dd2da1ba 100644
--- a/test/interpreter_functional/test_suites/run_pipeline/basic.ts
+++ b/test/interpreter_functional/test_suites/run_pipeline/basic.ts
@@ -113,11 +113,10 @@ export default function({
await expectExpression('partial_test_2', metricExpr, context).toMatchSnapshot()
).toMatchScreenshot();
- // TODO: should be uncommented when the region map is migrated to the new platform
- // const regionMapExpr = `regionmap visConfig='{"metric":{"accessor":1,"format":{"id":"number"}},"bucket":{"accessor":0}}'`;
- // await (
- // await expectExpression('partial_test_3', regionMapExpr, context).toMatchSnapshot()
- // ).toMatchScreenshot();
+ const regionMapExpr = `regionmap visConfig='{"metric":{"accessor":1,"format":{"id":"number"}},"bucket":{"accessor":0}}'`;
+ await (
+ await expectExpression('partial_test_3', regionMapExpr, context).toMatchSnapshot()
+ ).toMatchScreenshot();
});
});
});
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/kibana.json b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/kibana.json
new file mode 100644
index 0000000000000..6c8d51ccb8651
--- /dev/null
+++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/kibana.json
@@ -0,0 +1,16 @@
+{
+ "id": "kbn_tp_embeddable_explorer",
+ "version": "0.0.1",
+ "kibanaVersion": "kibana",
+ "requiredPlugins": [
+ "visTypeMarkdown",
+ "visTypeVislib",
+ "data",
+ "embeddable",
+ "uiActions",
+ "inspector",
+ "discover"
+ ],
+ "server": false,
+ "ui": true
+}
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/app.tsx
similarity index 100%
rename from test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx
rename to test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/app.tsx
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/dashboard_container_example.tsx
similarity index 98%
rename from test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx
rename to test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/dashboard_container_example.tsx
index 16c2840d6a32e..e56b82378ddf7 100644
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx
+++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/dashboard_container_example.tsx
@@ -24,7 +24,7 @@ import {
DASHBOARD_CONTAINER_TYPE,
DashboardContainer,
DashboardContainerInput,
-} from '../../../../../../../../src/plugins/dashboard/public';
+} from '../../../../../../src/plugins/dashboard/public';
import { dashboardInput } from './dashboard_input';
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/dashboard_input.ts
similarity index 96%
rename from test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts
rename to test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/dashboard_input.ts
index 37ef8cad948cb..6f4e1f052f5e0 100644
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts
+++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/dashboard_input.ts
@@ -18,7 +18,7 @@
*/
import { ViewMode, CONTACT_CARD_EMBEDDABLE, HELLO_WORLD_EMBEDDABLE } from '../embeddable_api';
-import { DashboardContainerInput } from '../../../../../../../../src/plugins/dashboard/public';
+import { DashboardContainerInput } from '../../../../../../src/plugins/dashboard/public';
export const dashboardInput: DashboardContainerInput = {
panels: {
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/index.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/index.ts
similarity index 100%
rename from test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/index.ts
rename to test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/app/index.ts
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddable_api.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/embeddable_api.ts
similarity index 74%
rename from test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddable_api.ts
rename to test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/embeddable_api.ts
index dd25bebf89920..9f6597fefa1e4 100644
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddable_api.ts
+++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/embeddable_api.ts
@@ -17,6 +17,9 @@
* under the License.
*/
-export * from '../../../../../../../src/plugins/embeddable/public';
-export * from '../../../../../../../src/plugins/embeddable/public/lib/test_samples';
-export { HELLO_WORLD_EMBEDDABLE } from '../../../../../../../examples/embeddable_examples/public';
+export * from '../../../../../src/plugins/embeddable/public';
+export * from '../../../../../src/plugins/embeddable/public/lib/test_samples';
+export {
+ HELLO_WORLD_EMBEDDABLE,
+ HelloWorldEmbeddableFactory,
+} from '../../../../../examples/embeddable_examples/public';
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/index.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/index.ts
similarity index 100%
rename from test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/index.ts
rename to test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/index.ts
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/kibana.json b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/kibana.json
deleted file mode 100644
index d0d0784eae8d3..0000000000000
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/kibana.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "id": "kbn_tp_embeddable_explorer",
- "version": "kibana",
- "requiredPlugins": [
- "embeddable",
- "inspector"
- ],
- "server": false,
- "ui": true
-}
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/index.html b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/index.html
deleted file mode 100644
index a242631e1638f..0000000000000
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/index.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
- ANGULAR STUFF!
-
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/legacy.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/legacy.ts
deleted file mode 100644
index 6d125bc3002e0..0000000000000
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/legacy.ts
+++ /dev/null
@@ -1,90 +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.
- */
-/* eslint-disable @kbn/eslint/no-restricted-paths */
-import 'ui/autoload/all';
-
-import 'uiExports/interpreter';
-import 'uiExports/embeddableFactories';
-import 'uiExports/embeddableActions';
-import 'uiExports/contextMenuActions';
-import 'uiExports/devTools';
-import 'uiExports/docViews';
-import 'uiExports/embeddableActions';
-import 'uiExports/fieldFormatEditors';
-import 'uiExports/fieldFormats';
-import 'uiExports/home';
-import 'uiExports/indexManagement';
-import 'uiExports/inspectorViews';
-import 'uiExports/savedObjectTypes';
-import 'uiExports/search';
-import 'uiExports/shareContextMenuExtensions';
-import 'uiExports/visTypes';
-import 'uiExports/visualize';
-
-import { npSetup, npStart } from 'ui/new_platform';
-import { ExitFullScreenButton } from 'ui/exit_full_screen';
-import uiRoutes from 'ui/routes';
-// @ts-ignore
-import { uiModules } from 'ui/modules';
-/* eslint-enable @kbn/eslint/no-restricted-paths */
-
-import template from './index.html';
-
-import { plugin } from '.';
-
-const pluginInstance = plugin({} as any);
-
-export const setup = pluginInstance.setup(npSetup.core, {
- embeddable: npSetup.plugins.embeddable,
- inspector: npSetup.plugins.inspector,
- __LEGACY: {
- ExitFullScreenButton,
- },
-});
-
-let rendered = false;
-const onRenderCompleteListeners: Array<() => void> = [];
-
-uiRoutes.enable();
-uiRoutes.defaults(/\embeddable_explorer/, {});
-uiRoutes.when('/', {
- template,
- controller($scope) {
- $scope.$$postDigest(() => {
- rendered = true;
- onRenderCompleteListeners.forEach(listener => listener());
- });
- },
-});
-
-export const start = pluginInstance.start(npStart.core, {
- embeddable: npStart.plugins.embeddable,
- inspector: npStart.plugins.inspector,
- uiActions: npStart.plugins.uiActions,
- __LEGACY: {
- ExitFullScreenButton,
- onRenderComplete: (renderCompleteListener: () => void) => {
- if (rendered) {
- renderCompleteListener();
- } else {
- onRenderCompleteListeners.push(renderCompleteListener);
- }
- },
- },
-});
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/plugin.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/plugin.tsx
deleted file mode 100644
index b47e84216dd16..0000000000000
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/plugin.tsx
+++ /dev/null
@@ -1,84 +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 React from 'react';
-import ReactDOM from 'react-dom';
-import { CoreSetup, CoreStart, Plugin } from 'src/core/public';
-import { UiActionsStart } from '../../../../../../../src/plugins/ui_actions/public';
-import { createHelloWorldAction } from '../../../../../../../src/plugins/ui_actions/public/tests/test_samples';
-
-import {
- Start as InspectorStartContract,
- Setup as InspectorSetupContract,
-} from '../../../../../../../src/plugins/inspector/public';
-
-import { CONTEXT_MENU_TRIGGER } from './embeddable_api';
-
-const REACT_ROOT_ID = 'embeddableExplorerRoot';
-
-import { SayHelloAction, createSendMessageAction } from './embeddable_api';
-import { App } from './app';
-import {
- EmbeddableStart,
- EmbeddableSetup,
-} from '.../../../../../../../src/plugins/embeddable/public';
-
-export interface SetupDependencies {
- embeddable: EmbeddableSetup;
- inspector: InspectorSetupContract;
- __LEGACY: {
- ExitFullScreenButton: React.ComponentType;
- };
-}
-
-interface StartDependencies {
- embeddable: EmbeddableStart;
- uiActions: UiActionsStart;
- inspector: InspectorStartContract;
- __LEGACY: {
- ExitFullScreenButton: React.ComponentType;
- onRenderComplete: (onRenderComplete: () => void) => void;
- };
-}
-
-export type EmbeddableExplorerSetup = void;
-export type EmbeddableExplorerStart = void;
-
-export class EmbeddableExplorerPublicPlugin
- implements
- Plugin {
- public setup(core: CoreSetup, setupDeps: SetupDependencies): EmbeddableExplorerSetup {}
-
- public start(core: CoreStart, plugins: StartDependencies): EmbeddableExplorerStart {
- const helloWorldAction = createHelloWorldAction(core.overlays);
- const sayHelloAction = new SayHelloAction(alert);
- const sendMessageAction = createSendMessageAction(core.overlays);
-
- plugins.uiActions.registerAction(sayHelloAction);
- plugins.uiActions.registerAction(sendMessageAction);
-
- plugins.uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, helloWorldAction);
-
- plugins.__LEGACY.onRenderComplete(() => {
- const root = document.getElementById(REACT_ROOT_ID);
- ReactDOM.render(, root);
- });
- }
-
- public stop() {}
-}
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/plugin.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/plugin.tsx
new file mode 100644
index 0000000000000..f99d89ca630bb
--- /dev/null
+++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/plugin.tsx
@@ -0,0 +1,98 @@
+/*
+ * 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 React from 'react';
+import { render, unmountComponentAtNode } from 'react-dom';
+import { CoreSetup, Plugin, AppMountParameters } from 'kibana/public';
+import { UiActionsStart, UiActionsSetup } from '../../../../../src/plugins/ui_actions/public';
+import { createHelloWorldAction } from '../../../../../src/plugins/ui_actions/public/tests/test_samples';
+
+import {
+ Start as InspectorStartContract,
+ Setup as InspectorSetupContract,
+} from '../../../../../src/plugins/inspector/public';
+
+import { App } from './app';
+import {
+ CONTEXT_MENU_TRIGGER,
+ CONTACT_CARD_EMBEDDABLE,
+ HELLO_WORLD_EMBEDDABLE,
+ HelloWorldEmbeddableFactory,
+ ContactCardEmbeddableFactory,
+ SayHelloAction,
+ createSendMessageAction,
+} from './embeddable_api';
+import {
+ EmbeddableStart,
+ EmbeddableSetup,
+} from '.../../../../../../../src/plugins/embeddable/public';
+
+export interface SetupDependencies {
+ embeddable: EmbeddableSetup;
+ inspector: InspectorSetupContract;
+ uiActions: UiActionsSetup;
+}
+
+interface StartDependencies {
+ embeddable: EmbeddableStart;
+ uiActions: UiActionsStart;
+ inspector: InspectorStartContract;
+}
+
+export type EmbeddableExplorerSetup = void;
+export type EmbeddableExplorerStart = void;
+
+export class EmbeddableExplorerPublicPlugin
+ implements
+ Plugin {
+ public setup(core: CoreSetup, setupDeps: SetupDependencies): EmbeddableExplorerSetup {
+ const helloWorldAction = createHelloWorldAction({} as any);
+ const sayHelloAction = new SayHelloAction(alert);
+ const sendMessageAction = createSendMessageAction({} as any);
+
+ setupDeps.uiActions.registerAction(helloWorldAction);
+ setupDeps.uiActions.registerAction(sayHelloAction);
+ setupDeps.uiActions.registerAction(sendMessageAction);
+
+ setupDeps.uiActions.attachAction(CONTEXT_MENU_TRIGGER, helloWorldAction.id);
+
+ setupDeps.embeddable.registerEmbeddableFactory(
+ HELLO_WORLD_EMBEDDABLE,
+ new HelloWorldEmbeddableFactory()
+ );
+
+ setupDeps.embeddable.registerEmbeddableFactory(
+ CONTACT_CARD_EMBEDDABLE,
+ new ContactCardEmbeddableFactory((() => null) as any, {} as any)
+ );
+
+ core.application.register({
+ id: 'EmbeddableExplorer',
+ title: 'Embeddable Explorer',
+ async mount(params: AppMountParameters) {
+ const startPlugins = (await core.getStartServices())[1] as StartDependencies;
+ render(, params.element);
+
+ return () => unmountComponentAtNode(params.element);
+ },
+ });
+ }
+
+ public start() {}
+ public stop() {}
+}
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_element_position_data.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_element_position_data.ts
index 2f93765165e50..3999393600e48 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_element_position_data.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_element_position_data.ts
@@ -6,16 +6,17 @@
import { i18n } from '@kbn/i18n';
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
+import { LevelLogger as Logger, startTrace } from '../../../../server/lib';
import { LayoutInstance } from '../../layouts/layout';
-import { AttributesMap, ElementsPositionAndAttribute } from './types';
-import { Logger } from '../../../../types';
import { CONTEXT_ELEMENTATTRIBUTES } from './constants';
+import { AttributesMap, ElementsPositionAndAttribute } from './types';
export const getElementPositionAndAttributes = async (
browser: HeadlessBrowser,
layout: LayoutInstance,
logger: Logger
): Promise => {
+ const endTrace = startTrace('get_element_position_data', 'read');
const { screenshot: screenshotSelector } = layout.selectors; // data-shared-items-container
let elementsPositionAndAttributes: ElementsPositionAndAttribute[] | null;
try {
@@ -69,5 +70,7 @@ export const getElementPositionAndAttributes = async (
elementsPositionAndAttributes = null;
}
+ endTrace();
+
return elementsPositionAndAttributes;
};
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_number_of_items.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_number_of_items.ts
index 57d025890d3e2..d0c1a2a3ce672 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_number_of_items.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_number_of_items.ts
@@ -6,7 +6,7 @@
import { i18n } from '@kbn/i18n';
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
-import { LevelLogger } from '../../../../server/lib';
+import { LevelLogger, startTrace } from '../../../../server/lib';
import { CaptureConfig } from '../../../../server/types';
import { LayoutInstance } from '../../layouts/layout';
import { CONTEXT_GETNUMBEROFITEMS, CONTEXT_READMETADATA } from './constants';
@@ -17,6 +17,7 @@ export const getNumberOfItems = async (
layout: LayoutInstance,
logger: LevelLogger
): Promise => {
+ const endTrace = startTrace('get_number_of_items', 'read');
const { renderComplete: renderCompleteSelector, itemsCountAttribute } = layout.selectors;
let itemsCount: number;
@@ -70,5 +71,7 @@ export const getNumberOfItems = async (
itemsCount = 1;
}
+ endTrace();
+
return itemsCount;
};
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_screenshots.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_screenshots.ts
index d50ac64743f07..bc9e17854b27d 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_screenshots.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_screenshots.ts
@@ -6,26 +6,9 @@
import { i18n } from '@kbn/i18n';
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
-import { LevelLogger } from '../../../../server/lib';
+import { LevelLogger, startTrace } from '../../../../server/lib';
import { Screenshot, ElementsPositionAndAttribute } from './types';
-const getAsyncDurationLogger = (logger: LevelLogger) => {
- return async (description: string, promise: Promise) => {
- const start = Date.now();
- const result = await promise;
- logger.debug(
- i18n.translate('xpack.reporting.screencapture.asyncTook', {
- defaultMessage: '{description} took {took}ms',
- values: {
- description,
- took: Date.now() - start,
- },
- })
- );
- return result;
- };
-};
-
export const getScreenshots = async (
browser: HeadlessBrowser,
elementsPositionAndAttributes: ElementsPositionAndAttribute[],
@@ -37,21 +20,20 @@ export const getScreenshots = async (
})
);
- const asyncDurationLogger = getAsyncDurationLogger(logger);
const screenshots: Screenshot[] = [];
for (let i = 0; i < elementsPositionAndAttributes.length; i++) {
+ const endTrace = startTrace('get_screenshots', 'read');
const item = elementsPositionAndAttributes[i];
- const base64EncodedData = await asyncDurationLogger(
- `screenshot #${i + 1}`,
- browser.screenshot(item.position)
- );
+ const base64EncodedData = await browser.screenshot(item.position);
screenshots.push({
base64EncodedData,
title: item.attributes.title,
description: item.attributes.description,
});
+
+ endTrace();
}
logger.info(
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_time_range.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_time_range.ts
index c1c43ed452594..bcd4cf9000df4 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_time_range.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_time_range.ts
@@ -5,7 +5,7 @@
*/
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
-import { LevelLogger } from '../../../../server/lib';
+import { LevelLogger, startTrace } from '../../../../server/lib';
import { LayoutInstance } from '../../layouts/layout';
import { CONTEXT_GETTIMERANGE } from './constants';
import { TimeRange } from './types';
@@ -15,6 +15,7 @@ export const getTimeRange = async (
layout: LayoutInstance,
logger: LevelLogger
): Promise => {
+ const endTrace = startTrace('get_time_range', 'read');
logger.debug('getting timeRange');
const timeRange: TimeRange | null = await browser.evaluate(
@@ -45,5 +46,7 @@ export const getTimeRange = async (
logger.debug('no timeRange');
}
+ endTrace();
+
return timeRange;
};
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/inject_css.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/inject_css.ts
index cb2673e85186b..40bb84870b16d 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/inject_css.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/inject_css.ts
@@ -7,8 +7,8 @@
import { i18n } from '@kbn/i18n';
import fs from 'fs';
import { promisify } from 'util';
-import { LevelLogger } from '../../../../server/lib';
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
+import { LevelLogger, startTrace } from '../../../../server/lib';
import { Layout } from '../../layouts/layout';
import { CONTEXT_INJECTCSS } from './constants';
@@ -19,6 +19,7 @@ export const injectCustomCss = async (
layout: Layout,
logger: LevelLogger
): Promise => {
+ const endTrace = startTrace('inject_css', 'correction');
logger.debug(
i18n.translate('xpack.reporting.screencapture.injectingCss', {
defaultMessage: 'injecting custom css',
@@ -49,4 +50,6 @@ export const injectCustomCss = async (
})
);
}
+
+ endTrace();
};
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/observable.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/observable.ts
index eb96753f0ce18..282490a28d591 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/observable.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/observable.ts
@@ -4,8 +4,18 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import apm from 'elastic-apm-node';
import * as Rx from 'rxjs';
-import { catchError, concatMap, first, mergeMap, take, takeUntil, toArray } from 'rxjs/operators';
+import {
+ catchError,
+ concatMap,
+ first,
+ mergeMap,
+ take,
+ takeUntil,
+ tap,
+ toArray,
+} from 'rxjs/operators';
import { CaptureConfig } from '../../../../server/types';
import { DEFAULT_PAGELOAD_SELECTOR } from '../../constants';
import { HeadlessChromiumDriverFactory } from '../../../../types';
@@ -41,6 +51,9 @@ export function screenshotsObservableFactory(
layout,
browserTimezone,
}: ScreenshotObservableOpts): Rx.Observable {
+ const apmTrans = apm.startTransaction(`reporting screenshot pipeline`, 'reporting');
+
+ const apmCreatePage = apmTrans?.startSpan('create_page', 'wait');
const create$ = browserDriverFactory.createPage(
{ viewport: layout.getBrowserViewport(), browserTimezone },
logger
@@ -48,6 +61,7 @@ export function screenshotsObservableFactory(
return create$.pipe(
mergeMap(({ driver, exit$ }) => {
+ if (apmCreatePage) apmCreatePage.end();
return Rx.from(urls).pipe(
concatMap((url, index) => {
const setup$: Rx.Observable = Rx.of(1).pipe(
@@ -81,10 +95,12 @@ export function screenshotsObservableFactory(
// allows for them to be displayed properly in many cases
await injectCustomCss(driver, layout, logger);
+ const apmPositionElements = apmTrans?.startSpan('position_elements', 'correction');
if (layout.positionElements) {
// position panel elements for print layout
await layout.positionElements(driver, logger);
}
+ if (apmPositionElements) apmPositionElements.end();
await waitForRenderComplete(captureConfig, driver, layout, logger);
}),
@@ -125,7 +141,10 @@ export function screenshotsObservableFactory(
toArray()
);
}),
- first()
+ first(),
+ tap(() => {
+ if (apmTrans) apmTrans.end();
+ })
);
};
}
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/open_url.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/open_url.ts
index 92a58aded5f66..a0708b7dba36b 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/open_url.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/open_url.ts
@@ -6,7 +6,7 @@
import { i18n } from '@kbn/i18n';
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
-import { LevelLogger } from '../../../../server/lib';
+import { LevelLogger, startTrace } from '../../../../server/lib';
import { CaptureConfig } from '../../../../server/types';
import { ConditionalHeaders } from '../../../../types';
@@ -18,6 +18,7 @@ export const openUrl = async (
conditionalHeaders: ConditionalHeaders,
logger: LevelLogger
): Promise => {
+ const endTrace = startTrace('open_url', 'wait');
try {
await browser.open(
url,
@@ -32,11 +33,10 @@ export const openUrl = async (
throw new Error(
i18n.translate('xpack.reporting.screencapture.couldntLoadKibana', {
defaultMessage: `An error occurred when trying to open the Kibana URL. You may need to increase '{configKey}'. {error}`,
- values: {
- configKey: 'xpack.reporting.capture.timeouts.openUrl',
- error: err,
- },
+ values: { configKey: 'xpack.reporting.capture.timeouts.openUrl', error: err },
})
);
}
+
+ endTrace();
};
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/types.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/types.ts
index e113a5d228cd7..13ddf5eb74fcf 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/types.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/types.ts
@@ -30,7 +30,7 @@ export interface ElementsPositionAndAttribute {
}
export interface Screenshot {
- base64EncodedData: Buffer;
+ base64EncodedData: string;
title: string;
description: string;
}
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_render.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_render.ts
index 069896c8d9e90..fe92fbc9077e6 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_render.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_render.ts
@@ -6,7 +6,7 @@
import { i18n } from '@kbn/i18n';
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
-import { LevelLogger } from '../../../../server/lib';
+import { LevelLogger, startTrace } from '../../../../server/lib';
import { CaptureConfig } from '../../../../server/types';
import { LayoutInstance } from '../../layouts/layout';
import { CONTEXT_WAITFORRENDER } from './constants';
@@ -17,6 +17,8 @@ export const waitForRenderComplete = async (
layout: LayoutInstance,
logger: LevelLogger
) => {
+ const endTrace = startTrace('wait_for_render', 'wait');
+
logger.debug(
i18n.translate('xpack.reporting.screencapture.waitingForRenderComplete', {
defaultMessage: 'waiting for rendering to complete',
@@ -76,5 +78,7 @@ export const waitForRenderComplete = async (
defaultMessage: 'rendering is complete',
})
);
+
+ endTrace();
});
};
diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_visualizations.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_visualizations.ts
index 7960e1552e559..d456c4089ecee 100644
--- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_visualizations.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_visualizations.ts
@@ -6,7 +6,7 @@
import { i18n } from '@kbn/i18n';
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
-import { LevelLogger } from '../../../../server/lib';
+import { LevelLogger, startTrace } from '../../../../server/lib';
import { CaptureConfig } from '../../../../server/types';
import { LayoutInstance } from '../../layouts/layout';
import { CONTEXT_WAITFORELEMENTSTOBEINDOM } from './constants';
@@ -29,6 +29,7 @@ export const waitForVisualizations = async (
layout: LayoutInstance,
logger: LevelLogger
): Promise => {
+ const endTrace = startTrace('wait_for_visualizations', 'wait');
const { renderComplete: renderCompleteSelector } = layout.selectors;
logger.debug(
@@ -63,4 +64,6 @@ export const waitForVisualizations = async (
})
);
}
+
+ endTrace();
};
diff --git a/x-pack/legacy/plugins/reporting/export_types/png/server/execute_job/index.test.ts b/x-pack/legacy/plugins/reporting/export_types/png/server/execute_job/index.test.ts
index 9d3deda5d98be..fd879f0987232 100644
--- a/x-pack/legacy/plugins/reporting/export_types/png/server/execute_job/index.test.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/png/server/execute_job/index.test.ts
@@ -126,7 +126,7 @@ test(`returns content_type of application/png`, async () => {
const encryptedHeaders = await encryptHeaders({});
const generatePngObservable = (await generatePngObservableFactory(mockReporting)) as jest.Mock;
- generatePngObservable.mockReturnValue(Rx.of(Buffer.from('')));
+ generatePngObservable.mockReturnValue(Rx.of('foo'));
const { content_type: contentType } = await executeJob(
'pngJobId',
@@ -137,10 +137,10 @@ test(`returns content_type of application/png`, async () => {
});
test(`returns content of generatePng getBuffer base64 encoded`, async () => {
- const testContent = 'test content';
+ const testContent = 'raw string from get_screenhots';
const generatePngObservable = (await generatePngObservableFactory(mockReporting)) as jest.Mock;
- generatePngObservable.mockReturnValue(Rx.of({ buffer: Buffer.from(testContent) }));
+ generatePngObservable.mockReturnValue(Rx.of({ base64: testContent }));
const executeJob = await executeJobFactory(mockReporting, getMockLogger());
const encryptedHeaders = await encryptHeaders({});
@@ -150,5 +150,5 @@ test(`returns content of generatePng getBuffer base64 encoded`, async () => {
cancellationToken
);
- expect(content).toEqual(Buffer.from(testContent).toString('base64'));
+ expect(content).toEqual(testContent);
});
diff --git a/x-pack/legacy/plugins/reporting/export_types/png/server/execute_job/index.ts b/x-pack/legacy/plugins/reporting/export_types/png/server/execute_job/index.ts
index 0ffd42d0b52f9..88c2d8a9fe4bb 100644
--- a/x-pack/legacy/plugins/reporting/export_types/png/server/execute_job/index.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/png/server/execute_job/index.ts
@@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import apm from 'elastic-apm-node';
import * as Rx from 'rxjs';
import { catchError, map, mergeMap, takeUntil } from 'rxjs/operators';
import { PNG_JOB_TYPE } from '../../../../common/constants';
@@ -29,6 +30,10 @@ export const executeJobFactory: QueuedPngExecutorFactory = async function execut
const logger = parentLogger.clone([PNG_JOB_TYPE, 'execute']);
return async function executeJob(jobId: string, job: JobDocPayloadPNG, cancellationToken: any) {
+ const apmTrans = apm.startTransaction('reporting execute_job png', 'reporting');
+ const apmGetAssets = apmTrans?.startSpan('get_assets', 'setup');
+ let apmGeneratePng: { end: () => void } | null | undefined;
+
const generatePngObservable = await generatePngObservableFactory(reporting);
const jobLogger = logger.clone([jobId]);
const process$: Rx.Observable = Rx.of(1).pipe(
@@ -38,6 +43,9 @@ export const executeJobFactory: QueuedPngExecutorFactory = async function execut
mergeMap(conditionalHeaders => {
const urls = getFullUrls({ config, job });
const hashUrl = urls[0];
+ if (apmGetAssets) apmGetAssets.end();
+
+ apmGeneratePng = apmTrans?.startSpan('generate_png_pipeline', 'execute');
return generatePngObservable(
jobLogger,
hashUrl,
@@ -46,11 +54,14 @@ export const executeJobFactory: QueuedPngExecutorFactory = async function execut
job.layout
);
}),
- map(({ buffer, warnings }) => {
+ map(({ base64, warnings }) => {
+ if (apmGeneratePng) apmGeneratePng.end();
+
return {
content_type: 'image/png',
- content: buffer.toString('base64'),
- size: buffer.byteLength,
+ content: base64,
+ size: (base64 && base64.length) || 0,
+
warnings,
};
}),
diff --git a/x-pack/legacy/plugins/reporting/export_types/png/server/lib/generate_png.ts b/x-pack/legacy/plugins/reporting/export_types/png/server/lib/generate_png.ts
index c03ea170f76ee..c79aa28187052 100644
--- a/x-pack/legacy/plugins/reporting/export_types/png/server/lib/generate_png.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/png/server/lib/generate_png.ts
@@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import apm from 'elastic-apm-node';
import * as Rx from 'rxjs';
import { map } from 'rxjs/operators';
import { ReportingCore } from '../../../../server';
@@ -22,12 +23,16 @@ export async function generatePngObservableFactory(reporting: ReportingCore) {
browserTimezone: string,
conditionalHeaders: ConditionalHeaders,
layoutParams: LayoutParams
- ): Rx.Observable<{ buffer: Buffer; warnings: string[] }> {
+ ): Rx.Observable<{ base64: string | null; warnings: string[] }> {
+ const apmTrans = apm.startTransaction('reporting generate_png', 'reporting');
+ const apmLayout = apmTrans?.startSpan('create_layout', 'setup');
if (!layoutParams || !layoutParams.dimensions) {
throw new Error(`LayoutParams.Dimensions is undefined.`);
}
-
const layout = new PreserveLayout(layoutParams.dimensions);
+ if (apmLayout) apmLayout.end();
+
+ const apmScreenshots = apmTrans?.startSpan('screenshots_pipeline', 'setup');
const screenshots$ = getScreenshots({
logger,
urls: [url],
@@ -36,8 +41,11 @@ export async function generatePngObservableFactory(reporting: ReportingCore) {
browserTimezone,
}).pipe(
map((results: ScreenshotResults[]) => {
+ if (apmScreenshots) apmScreenshots.end();
+ if (apmTrans) apmTrans.end();
+
return {
- buffer: results[0].screenshots[0].base64EncodedData,
+ base64: results[0].screenshots[0].base64EncodedData,
warnings: results.reduce((found, current) => {
if (current.error) {
found.push(current.error.message);
diff --git a/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/execute_job/index.ts b/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/execute_job/index.ts
index 3d69042b6c7ab..5aad66c53a998 100644
--- a/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/execute_job/index.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/execute_job/index.ts
@@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import apm from 'elastic-apm-node';
import * as Rx from 'rxjs';
import { catchError, map, mergeMap, takeUntil } from 'rxjs/operators';
import { PDF_JOB_TYPE } from '../../../../common/constants';
@@ -31,6 +32,10 @@ export const executeJobFactory: QueuedPdfExecutorFactory = async function execut
const logger = parentLogger.clone([PDF_JOB_TYPE, 'execute']);
return async function executeJob(jobId: string, job: JobDocPayloadPDF, cancellationToken: any) {
+ const apmTrans = apm.startTransaction('reporting execute_job pdf', 'reporting');
+ const apmGetAssets = apmTrans?.startSpan('get_assets', 'setup');
+ let apmGeneratePdf: { end: () => void } | null | undefined;
+
const generatePdfObservable = await generatePdfObservableFactory(reporting);
const jobLogger = logger.clone([jobId]);
@@ -43,6 +48,9 @@ export const executeJobFactory: QueuedPdfExecutorFactory = async function execut
const urls = getFullUrls({ config, job });
const { browserTimezone, layout, title } = job;
+ if (apmGetAssets) apmGetAssets.end();
+
+ apmGeneratePdf = apmTrans?.startSpan('generate_pdf_pipeline', 'execute');
return generatePdfObservable(
jobLogger,
title,
@@ -53,12 +61,20 @@ export const executeJobFactory: QueuedPdfExecutorFactory = async function execut
logo
);
}),
- map(({ buffer, warnings }) => ({
- content_type: 'application/pdf',
- content: buffer.toString('base64'),
- size: buffer.byteLength,
- warnings,
- })),
+ map(({ buffer, warnings }) => {
+ if (apmGeneratePdf) apmGeneratePdf.end();
+
+ const apmEncode = apmTrans?.startSpan('encode_pdf', 'output');
+ const content = buffer?.toString('base64') || null;
+ if (apmEncode) apmEncode.end();
+
+ return {
+ content_type: 'application/pdf',
+ content,
+ size: buffer?.byteLength || 0,
+ warnings,
+ };
+ }),
catchError(err => {
jobLogger.error(err);
return Rx.throwError(err);
@@ -66,6 +82,8 @@ export const executeJobFactory: QueuedPdfExecutorFactory = async function execut
);
const stop$ = Rx.fromEventPattern(cancellationToken.on);
+
+ if (apmTrans) apmTrans.end();
return process$.pipe(takeUntil(stop$)).toPromise();
};
};
diff --git a/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/generate_pdf.ts b/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/generate_pdf.ts
index c882ef682f952..238accba8b1dc 100644
--- a/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/generate_pdf.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/generate_pdf.ts
@@ -13,6 +13,7 @@ import { ConditionalHeaders } from '../../../../types';
import { createLayout } from '../../../common/layouts';
import { LayoutInstance, LayoutParams } from '../../../common/layouts/layout';
import { ScreenshotResults } from '../../../common/lib/screenshots/types';
+import { getTracker } from './tracker';
// @ts-ignore untyped module
import { pdf } from './pdf';
@@ -39,8 +40,14 @@ export async function generatePdfObservableFactory(reporting: ReportingCore) {
conditionalHeaders: ConditionalHeaders,
layoutParams: LayoutParams,
logo?: string
- ): Rx.Observable<{ buffer: Buffer; warnings: string[] }> {
+ ): Rx.Observable<{ buffer: Buffer | null; warnings: string[] }> {
+ const tracker = getTracker();
+ tracker.startLayout();
+
const layout = createLayout(captureConfig, layoutParams) as LayoutInstance;
+ tracker.endLayout();
+
+ tracker.startScreenshots();
const screenshots$ = getScreenshots({
logger,
urls,
@@ -49,16 +56,22 @@ export async function generatePdfObservableFactory(reporting: ReportingCore) {
browserTimezone,
}).pipe(
mergeMap(async (results: ScreenshotResults[]) => {
- const pdfOutput = pdf.create(layout, logo);
+ tracker.endScreenshots();
+ tracker.startSetup();
+ const pdfOutput = pdf.create(layout, logo);
if (title) {
const timeRange = getTimeRange(results);
title += timeRange ? ` - ${timeRange.duration}` : '';
pdfOutput.setTitle(title);
}
+ tracker.endSetup();
results.forEach(r => {
r.screenshots.forEach(screenshot => {
+ logger.debug(`Adding image to PDF. Image base64 size: ${screenshot.base64EncodedData?.length || 0}`); // prettier-ignore
+ tracker.startAddImage();
+ tracker.endAddImage();
pdfOutput.addImage(screenshot.base64EncodedData, {
title: screenshot.title,
description: screenshot.description,
@@ -66,10 +79,26 @@ export async function generatePdfObservableFactory(reporting: ReportingCore) {
});
});
- pdfOutput.generate();
+ let buffer: Buffer | null = null;
+ try {
+ tracker.startCompile();
+ logger.debug(`Compiling PDF...`);
+ pdfOutput.generate();
+ tracker.endCompile();
+
+ tracker.startGetBuffer();
+ logger.debug(`Generating PDF Buffer...`);
+ buffer = await pdfOutput.getBuffer();
+ logger.debug(`PDF buffer byte length: ${buffer?.byteLength || 0}`);
+ tracker.endGetBuffer();
+ } catch (err) {
+ logger.error(`Could not generate the PDF buffer! ${err}`);
+ }
+
+ tracker.end();
return {
- buffer: await pdfOutput.getBuffer(),
+ buffer,
warnings: results.reduce((found, current) => {
if (current.error) {
found.push(current.error.message);
diff --git a/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/tracker.ts b/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/tracker.ts
new file mode 100644
index 0000000000000..b6fad243db7b1
--- /dev/null
+++ b/x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/tracker.ts
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+
+import apm from 'elastic-apm-node';
+
+interface PdfTracker {
+ startLayout: () => void;
+ endLayout: () => void;
+ startScreenshots: () => void;
+ endScreenshots: () => void;
+ startSetup: () => void;
+ endSetup: () => void;
+ startAddImage: () => void;
+ endAddImage: () => void;
+ startCompile: () => void;
+ endCompile: () => void;
+ startGetBuffer: () => void;
+ endGetBuffer: () => void;
+ end: () => void;
+}
+
+const SPANTYPE_SETUP = 'setup';
+const SPANTYPE_OUTPUT = 'output';
+
+interface ApmSpan {
+ end: () => void;
+}
+
+export function getTracker(): PdfTracker {
+ const apmTrans = apm.startTransaction('reporting generate_pdf', 'reporting');
+
+ let apmLayout: ApmSpan | null = null;
+ let apmScreenshots: ApmSpan | null = null;
+ let apmSetup: ApmSpan | null = null;
+ let apmAddImage: ApmSpan | null = null;
+ let apmCompilePdf: ApmSpan | null = null;
+ let apmGetBuffer: ApmSpan | null = null;
+
+ return {
+ startLayout() {
+ apmLayout = apmTrans?.startSpan('create_layout', SPANTYPE_SETUP) || null;
+ },
+ endLayout() {
+ if (apmLayout) apmLayout.end();
+ },
+ startScreenshots() {
+ apmScreenshots = apmTrans?.startSpan('screenshots_pipeline', SPANTYPE_SETUP) || null;
+ },
+ endScreenshots() {
+ if (apmScreenshots) apmScreenshots.end();
+ },
+ startSetup() {
+ apmSetup = apmTrans?.startSpan('setup_pdf', SPANTYPE_SETUP) || null;
+ },
+ endSetup() {
+ if (apmSetup) apmSetup.end();
+ },
+ startAddImage() {
+ apmAddImage = apmTrans?.startSpan('add_pdf_image', SPANTYPE_OUTPUT) || null;
+ },
+ endAddImage() {
+ if (apmAddImage) apmAddImage.end();
+ },
+ startCompile() {
+ apmCompilePdf = apmTrans?.startSpan('compile_pdf', SPANTYPE_OUTPUT) || null;
+ },
+ endCompile() {
+ if (apmCompilePdf) apmCompilePdf.end();
+ },
+ startGetBuffer() {
+ apmGetBuffer = apmTrans?.startSpan('get_buffer', SPANTYPE_OUTPUT) || null;
+ },
+ endGetBuffer() {
+ if (apmGetBuffer) apmGetBuffer.end();
+ },
+ end() {
+ if (apmTrans) apmTrans.end();
+ },
+ };
+}
diff --git a/x-pack/legacy/plugins/reporting/server/lib/create_worker.ts b/x-pack/legacy/plugins/reporting/server/lib/create_worker.ts
index 16b8fbdb30fdd..ad0f05c02a1f4 100644
--- a/x-pack/legacy/plugins/reporting/server/lib/create_worker.ts
+++ b/x-pack/legacy/plugins/reporting/server/lib/create_worker.ts
@@ -11,18 +11,13 @@ import {
ESQueueInstance,
ESQueueWorkerExecuteFn,
ExportTypeDefinition,
- ImmediateExecuteFn,
- JobDocPayload,
JobSource,
Logger,
- RequestFacade,
} from '../../types';
// @ts-ignore untyped dependency
import { events as esqueueEvents } from './esqueue';
export function createWorkerFactory(reporting: ReportingCore, logger: Logger) {
- type JobDocPayloadType = JobDocPayload;
-
const config = reporting.getConfig();
const queueConfig = config.get('queue');
const kibanaName = config.kbnConfig.get('server', 'name');
@@ -31,48 +26,36 @@ export function createWorkerFactory(reporting: ReportingCore, log
// Once more document types are added, this will need to be passed in
return async function createWorker(queue: ESQueueInstance) {
// export type / execute job map
- const jobExecutors: Map<
- string,
- ImmediateExecuteFn | ESQueueWorkerExecuteFn
- > = new Map();
+ const jobExecutors: Map> = new Map();
for (const exportType of reporting.getExportTypesRegistry().getAll() as Array<
- ExportTypeDefinition<
- JobParamsType,
- unknown,
- unknown,
- ImmediateExecuteFn | ESQueueWorkerExecuteFn
- >
+ ExportTypeDefinition>
>) {
const jobExecutor = await exportType.executeJobFactory(reporting, logger); // FIXME: does not "need" to be async
jobExecutors.set(exportType.jobType, jobExecutor);
}
- const workerFn = (jobSource: JobSource, ...workerRestArgs: any[]) => {
+ const workerFn = (
+ jobSource: JobSource,
+ jobParams: ScheduledTaskParamsType,
+ cancellationToken: CancellationToken
+ ) => {
const {
_id: jobId,
_source: { jobtype: jobType },
} = jobSource;
+ if (!jobId) {
+ throw new Error(`Claimed job is missing an ID!: ${JSON.stringify(jobSource)}`);
+ }
+
const jobTypeExecutor = jobExecutors.get(jobType);
- // pass the work to the jobExecutor
if (!jobTypeExecutor) {
throw new Error(`Unable to find a job executor for the claimed job: [${jobId}]`);
}
- if (jobId) {
- const jobExecutorWorker = jobTypeExecutor as ESQueueWorkerExecuteFn;
- return jobExecutorWorker(
- jobId,
- ...(workerRestArgs as [JobDocPayloadType, CancellationToken])
- );
- } else {
- const jobExecutorImmediate = jobExecutors.get(jobType) as ImmediateExecuteFn;
- return jobExecutorImmediate(
- null,
- ...(workerRestArgs as [JobDocPayload, RequestFacade])
- );
- }
+ // pass the work to the jobExecutor
+ return jobTypeExecutor(jobId, jobParams, cancellationToken);
};
const workerOptions = {
diff --git a/x-pack/legacy/plugins/reporting/server/lib/enqueue_job.ts b/x-pack/legacy/plugins/reporting/server/lib/enqueue_job.ts
index 3e87337dc4355..8f33d9b73566c 100644
--- a/x-pack/legacy/plugins/reporting/server/lib/enqueue_job.ts
+++ b/x-pack/legacy/plugins/reporting/server/lib/enqueue_job.ts
@@ -9,7 +9,6 @@ import {
ConditionalHeaders,
EnqueueJobFn,
ESQueueCreateJobFn,
- ImmediateCreateJobFn,
Job,
Logger,
RequestFacade,
@@ -40,7 +39,7 @@ export function enqueueJobFactory(reporting: ReportingCore, parentLogger: Logger
headers: ConditionalHeaders['headers'],
request: RequestFacade
): Promise {
- type CreateJobFn = ESQueueCreateJobFn | ImmediateCreateJobFn;
+ type CreateJobFn = ESQueueCreateJobFn;
const esqueue = await reporting.getEsqueue();
const exportType = reporting.getExportTypesRegistry().getById(exportTypeId);
diff --git a/x-pack/legacy/plugins/reporting/server/lib/index.ts b/x-pack/legacy/plugins/reporting/server/lib/index.ts
index f5ccbe493a91f..2a8fa45b6fcef 100644
--- a/x-pack/legacy/plugins/reporting/server/lib/index.ts
+++ b/x-pack/legacy/plugins/reporting/server/lib/index.ts
@@ -4,10 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/
+export { LevelLogger } from './level_logger';
export { checkLicenseFactory } from './check_license';
export { createQueueFactory } from './create_queue';
export { cryptoFactory } from './crypto';
export { enqueueJobFactory } from './enqueue_job';
export { getExportTypesRegistry } from './export_types_registry';
-export { LevelLogger } from './level_logger';
export { runValidations } from './validate';
+export { startTrace } from './trace';
diff --git a/x-pack/legacy/plugins/reporting/server/lib/trace.ts b/x-pack/legacy/plugins/reporting/server/lib/trace.ts
new file mode 100644
index 0000000000000..2d79d17715d0b
--- /dev/null
+++ b/x-pack/legacy/plugins/reporting/server/lib/trace.ts
@@ -0,0 +1,14 @@
+/*
+ * 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.
+ */
+
+import apm from 'elastic-apm-node';
+
+export function startTrace(name: string, category: string) {
+ const span = apm.startSpan(name, category);
+ return () => {
+ if (span) span.end();
+ };
+}
diff --git a/x-pack/plugins/actions/README.md b/x-pack/plugins/actions/README.md
index 4c8cc3aa503e6..54624b94e0de3 100644
--- a/x-pack/plugins/actions/README.md
+++ b/x-pack/plugins/actions/README.md
@@ -98,7 +98,7 @@ Built-In-Actions are configured using the _xpack.actions_ namespoace under _kiba
| _xpack.actions._**enabled** | Feature toggle which enabled Actions in Kibana. | boolean |
| _xpack.actions._**whitelistedHosts** | Which _hostnames_ are whitelisted for the Built-In-Action? This list should contain hostnames of every external service you wish to interact with using Webhooks, Email or any other built in Action. Note that you may use the string "\*" in place of a specific hostname to enable Kibana to target any URL, but keep in mind the potential use of such a feature to execute [SSRF](https://www.owasp.org/index.php/Server_Side_Request_Forgery) attacks from your server. | Array |
| _xpack.actions._**enabledActionTypes** | A list of _actionTypes_ id's that are enabled. A "\*" may be used as an element to indicate all registered actionTypes should be enabled. The actionTypes registered for Kibana are `.server-log`, `.slack`, `.email`, `.index`, `.pagerduty`, `.webhook`. Default: `["*"]` | Array |
-| _xpack.actions._**preconfigured** | A list of preconfigured actions. Default: `[]` | Array