From d2b7ab691c45075e527be6ca202dd3970e42c92c Mon Sep 17 00:00:00 2001 From: nreese Date: Fri, 24 Feb 2023 09:00:49 -0700 Subject: [PATCH 1/8] [maps] remove Maps data view telemetry --- .../maps/server/kibana_server_services.ts | 4 - .../maps_telemetry/collectors/register.ts | 4 - .../server/maps_telemetry/find_maps.test.ts | 4 +- .../index_pattern_stats/index.ts | 9 -- .../index_pattern_stats_collector.test.ts | 94 ------------- .../index_pattern_stats_collector.ts | 130 ------------------ .../index_pattern_stats/types.ts | 13 -- .../server/maps_telemetry/maps_telemetry.ts | 20 +-- 8 files changed, 4 insertions(+), 274 deletions(-) delete mode 100644 x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index.ts delete mode 100644 x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index_pattern_stats_collector.test.ts delete mode 100644 x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index_pattern_stats_collector.ts delete mode 100644 x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/types.ts diff --git a/x-pack/plugins/maps/server/kibana_server_services.ts b/x-pack/plugins/maps/server/kibana_server_services.ts index 84cedeb7218247..bca5fc06fbb5ce 100644 --- a/x-pack/plugins/maps/server/kibana_server_services.ts +++ b/x-pack/plugins/maps/server/kibana_server_services.ts @@ -18,7 +18,3 @@ export function setStartServices(core: CoreStart, plugins: StartDeps) { export const getSavedObjectClient = (extraTypes?: string[]) => { return coreStart.savedObjects.createInternalRepository(extraTypes); }; - -export const getIndexPatternsServiceFactory = () => - pluginsStart.data.indexPatterns.dataViewsServiceFactory; -export const getElasticsearch = () => coreStart.elasticsearch; diff --git a/x-pack/plugins/maps/server/maps_telemetry/collectors/register.ts b/x-pack/plugins/maps/server/maps_telemetry/collectors/register.ts index 9f2e520c428a23..77d1112f898170 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/collectors/register.ts +++ b/x-pack/plugins/maps/server/maps_telemetry/collectors/register.ts @@ -18,10 +18,6 @@ export function registerMapsUsageCollector(usageCollection?: UsageCollectionSetu isReady: () => true, fetch: async () => await getMapsTelemetry(), schema: { - indexPatternsWithGeoFieldCount: { type: 'long' }, - indexPatternsWithGeoPointFieldCount: { type: 'long' }, - indexPatternsWithGeoShapeFieldCount: { type: 'long' }, - geoShapeAggLayersCount: { type: 'long' }, mapsTotalCount: { type: 'long' }, timeCaptured: { type: 'date' }, layerTypes: { diff --git a/x-pack/plugins/maps/server/maps_telemetry/find_maps.test.ts b/x-pack/plugins/maps/server/maps_telemetry/find_maps.test.ts index acc9d11c66d4ab..64215045bd3eb1 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/find_maps.test.ts +++ b/x-pack/plugins/maps/server/maps_telemetry/find_maps.test.ts @@ -29,7 +29,7 @@ function getMockSavedObjectsClient(perPage: number) { } as unknown as ISavedObjectsRepository; } -test('should process all map saved objects with single page', async () => { +test('should process all map saved objects with a single page', async () => { const foundMapIds: string[] = []; await findMaps(getMockSavedObjectsClient(20), async (savedObject) => { foundMapIds.push(savedObject.id); @@ -43,7 +43,7 @@ test('should process all map saved objects with single page', async () => { ]); }); -test('should process all map saved objects with with paging', async () => { +test('should process all map saved objects with paging', async () => { const foundMapIds: string[] = []; await findMaps(getMockSavedObjectsClient(2), async (savedObject) => { foundMapIds.push(savedObject.id); diff --git a/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index.ts b/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index.ts deleted file mode 100644 index 9e4c0ef21fdea9..00000000000000 --- a/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { IndexPatternStatsCollector } from './index_pattern_stats_collector'; -export type { IndexPatternStats } from './types'; diff --git a/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index_pattern_stats_collector.test.ts b/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index_pattern_stats_collector.test.ts deleted file mode 100644 index 9877c29bc5951d..00000000000000 --- a/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index_pattern_stats_collector.test.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { asyncForEach } from '@kbn/std'; -// @ts-ignore -import mapSavedObjects from '../../../common/telemetry/test_resources/sample_map_saved_objects.json'; -import { DataViewsService } from '@kbn/data-views-plugin/common'; -import { IndexPatternStatsCollector } from './index_pattern_stats_collector'; - -test('returns zeroed telemetry data when there are no saved objects', async () => { - const mockIndexPatternService = { - getIds: () => { - return []; - }, - } as unknown as DataViewsService; - const statsCollector = new IndexPatternStatsCollector(mockIndexPatternService); - const stats = await statsCollector.getStats(); - expect(stats).toEqual({ - geoShapeAggLayersCount: 0, - indexPatternsWithGeoFieldCount: 0, - indexPatternsWithGeoPointFieldCount: 0, - indexPatternsWithGeoShapeFieldCount: 0, - }); -}); - -test('returns expected telemetry data from saved objects', async () => { - const mockIndexPatternService = { - get: (id: string) => { - if (id === 'd3d7af60-4c81-11e8-b3d7-01146121b73d') { - return { - getFieldByName: (name: string) => { - return { type: 'geo_point' }; - }, - fields: { - getByType: (type: string) => { - return type === 'geo_point' ? [{}] : []; - }, - }, - }; - } - - if (id === '4a7f6010-0aed-11ea-9dd2-95afd7ad44d4') { - return { - getFieldByName: (name: string) => { - return { type: 'geo_shape' }; - }, - fields: { - getByType: (type: string) => { - return type === 'geo_shape' ? [{}] : []; - }, - }, - }; - } - - if (id === 'indexPatternWithNoGeoFields') { - return { - getFieldByName: (name: string) => { - return null; - }, - fields: { - getByType: (type: string) => { - return []; - }, - }, - }; - } - - throw new Error('Index pattern not found'); - }, - getIds: () => { - return [ - 'd3d7af60-4c81-11e8-b3d7-01146121b73d', - '4a7f6010-0aed-11ea-9dd2-95afd7ad44d4', - 'indexPatternWithNoGeoFields', - 'missingIndexPattern', - ]; - }, - } as unknown as DataViewsService; - const statsCollector = new IndexPatternStatsCollector(mockIndexPatternService); - await asyncForEach(mapSavedObjects, async (savedObject) => { - await statsCollector.push(savedObject); - }); - const stats = await statsCollector.getStats(); - expect(stats).toEqual({ - geoShapeAggLayersCount: 2, // index pattern '4a7f6010-0aed-11ea-9dd2-95afd7ad44d4' with geo_shape field is used in 2 maps with geo_tile_grid aggregation - indexPatternsWithGeoFieldCount: 2, - indexPatternsWithGeoPointFieldCount: 1, - indexPatternsWithGeoShapeFieldCount: 1, - }); -}); diff --git a/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index_pattern_stats_collector.ts b/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index_pattern_stats_collector.ts deleted file mode 100644 index 2b8047cdaf41f8..00000000000000 --- a/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/index_pattern_stats_collector.ts +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { SavedObject } from '@kbn/core/server'; -import { asyncForEach } from '@kbn/std'; -import { KBN_FIELD_TYPES } from '@kbn/field-types'; -import { DataViewsService } from '@kbn/data-views-plugin/common'; -import { SCALING_TYPES, SOURCE_TYPES } from '../../../common/constants'; -import { injectReferences } from '../../../common/migrations/references'; -import { - ESGeoGridSourceDescriptor, - ESSearchSourceDescriptor, - LayerDescriptor, -} from '../../../common/descriptor_types'; -import type { MapSavedObjectAttributes } from '../../../common/map_saved_object_type'; -import { IndexPatternStats } from './types'; - -/* - * Use IndexPatternStatsCollector instance to track index pattern geospatial field stats. - */ -export class IndexPatternStatsCollector { - private _geoShapeAggCount = 0; - private _indexPatternsService: DataViewsService; - - constructor(indexPatternService: DataViewsService) { - this._indexPatternsService = indexPatternService; - } - - async push(savedObject: SavedObject) { - let layerList: LayerDescriptor[] = []; - try { - const { attributes } = injectReferences(savedObject); - if (!attributes.layerListJSON) { - return; - } - layerList = JSON.parse(attributes.layerListJSON); - } catch (e) { - return; - } - - let geoShapeAggCountPerMap = 0; - await asyncForEach(layerList, async (layerDescriptor) => { - if (await this._isGeoShapeAggLayer(layerDescriptor)) { - geoShapeAggCountPerMap++; - } - }); - this._geoShapeAggCount += geoShapeAggCountPerMap; - } - - async getStats(): Promise { - let geoCount = 0; - let pointCount = 0; - let shapeCount = 0; - - const indexPatternIds = await this._indexPatternsService.getIds(); - await asyncForEach(indexPatternIds, async (indexPatternId) => { - let indexPattern; - try { - indexPattern = await this._indexPatternsService.get(indexPatternId); - } catch (e) { - return; - } - const pointFields = indexPattern.fields.getByType(KBN_FIELD_TYPES.GEO_POINT); - const shapeFields = indexPattern.fields.getByType(KBN_FIELD_TYPES.GEO_SHAPE); - if (pointFields.length || shapeFields.length) { - geoCount++; - } - if (pointFields.length) { - pointCount++; - } - if (shapeFields.length) { - shapeCount++; - } - }); - - return { - // Tracks whether user uses Gold+ functionality of aggregating on geo_shape field - geoShapeAggLayersCount: this._geoShapeAggCount, - indexPatternsWithGeoFieldCount: geoCount, - indexPatternsWithGeoPointFieldCount: pointCount, - indexPatternsWithGeoShapeFieldCount: shapeCount, - }; - } - - async _isFieldGeoShape(indexPatternId: string, geoField: string | undefined): Promise { - if (!geoField || !indexPatternId) { - return false; - } - - let indexPattern; - try { - indexPattern = await this._indexPatternsService.get(indexPatternId); - } catch (e) { - return false; - } - - const field = indexPattern.getFieldByName(geoField); - return !!field && field.type === KBN_FIELD_TYPES.GEO_SHAPE; - } - - async _isGeoShapeAggLayer(layer: LayerDescriptor): Promise { - if (!layer.sourceDescriptor) { - return false; - } - - const sourceDescriptor = layer.sourceDescriptor; - if (sourceDescriptor.type === SOURCE_TYPES.ES_GEO_GRID) { - return await this._isFieldGeoShape( - (sourceDescriptor as ESGeoGridSourceDescriptor).indexPatternId, - (sourceDescriptor as ESGeoGridSourceDescriptor).geoField - ); - } - - if ( - sourceDescriptor.type === SOURCE_TYPES.ES_SEARCH && - (sourceDescriptor as ESSearchSourceDescriptor).scalingType === SCALING_TYPES.CLUSTERS - ) { - return await this._isFieldGeoShape( - (sourceDescriptor as ESSearchSourceDescriptor).indexPatternId, - (sourceDescriptor as ESSearchSourceDescriptor).geoField - ); - } - - return false; - } -} diff --git a/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/types.ts b/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/types.ts deleted file mode 100644 index 0a0060606b4239..00000000000000 --- a/x-pack/plugins/maps/server/maps_telemetry/index_pattern_stats/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export interface IndexPatternStats { - indexPatternsWithGeoFieldCount: number; - indexPatternsWithGeoPointFieldCount: number; - indexPatternsWithGeoShapeFieldCount: number; - geoShapeAggLayersCount: number; -} diff --git a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts index b7497c010f15ff..9168ff54314885 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts +++ b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts @@ -5,37 +5,21 @@ * 2.0. */ -import { SavedObjectsClient } from '@kbn/core/server'; import { - getElasticsearch, - getIndexPatternsServiceFactory, getSavedObjectClient, } from '../kibana_server_services'; import { MapStats, MapStatsCollector } from './map_stats'; -import { IndexPatternStats, IndexPatternStatsCollector } from './index_pattern_stats'; import { findMaps } from './find_maps'; -export type MapsUsage = MapStats & IndexPatternStats; - -async function getReadOnlyIndexPatternsService() { - const factory = getIndexPatternsServiceFactory(); - return factory( - new SavedObjectsClient(getSavedObjectClient()), - getElasticsearch().client.asInternalUser - ); -} +export type MapsUsage = MapStats; export async function getMapsTelemetry(): Promise { const mapStatsCollector = new MapStatsCollector(); - const indexPatternService = await getReadOnlyIndexPatternsService(); - const indexPatternStatsCollector = new IndexPatternStatsCollector(indexPatternService); - await findMaps(getSavedObjectClient(), async (savedObject) => { + await findMaps(getSavedObjectClient(), (savedObject) => { mapStatsCollector.push(savedObject.attributes); - await indexPatternStatsCollector.push(savedObject); }); return { - ...(await indexPatternStatsCollector.getStats()), ...mapStatsCollector.getStats(), }; } From ffeb34a74a96a8a35d27b3a28b186400d986493e Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:06:51 +0000 Subject: [PATCH 2/8] [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' --- x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts index 9168ff54314885..351195fd942d16 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts +++ b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts @@ -5,9 +5,7 @@ * 2.0. */ -import { - getSavedObjectClient, -} from '../kibana_server_services'; +import { getSavedObjectClient } from '../kibana_server_services'; import { MapStats, MapStatsCollector } from './map_stats'; import { findMaps } from './find_maps'; From f8bf601ece4bb225a2d35d3a0c849ba752827c7a Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:13:12 +0000 Subject: [PATCH 3/8] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- x-pack/plugins/maps/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugins/maps/tsconfig.json b/x-pack/plugins/maps/tsconfig.json index 0505ffb7473c10..8d32c7229a4e08 100644 --- a/x-pack/plugins/maps/tsconfig.json +++ b/x-pack/plugins/maps/tsconfig.json @@ -62,7 +62,6 @@ "@kbn/safer-lodash-set", "@kbn/custom-integrations-plugin", "@kbn/config-schema", - "@kbn/field-types", "@kbn/controls-plugin", "@kbn/shared-ux-router", ], From c27b329a9352c8222c94000bebda43cf7e59b5a1 Mon Sep 17 00:00:00 2001 From: nreese Date: Fri, 24 Feb 2023 09:31:29 -0700 Subject: [PATCH 4/8] node scripts/telemetry_check --fix --- .../schema/xpack_plugins.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 5a94f1361380c2..99e466ebbb357e 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -5502,18 +5502,6 @@ }, "maps": { "properties": { - "indexPatternsWithGeoFieldCount": { - "type": "long" - }, - "indexPatternsWithGeoPointFieldCount": { - "type": "long" - }, - "indexPatternsWithGeoShapeFieldCount": { - "type": "long" - }, - "geoShapeAggLayersCount": { - "type": "long" - }, "mapsTotalCount": { "type": "long" }, From c33fcc89bade19979098b333a4dd5aac96bef6e2 Mon Sep 17 00:00:00 2001 From: nreese Date: Fri, 24 Feb 2023 10:03:50 -0700 Subject: [PATCH 5/8] tslint --- x-pack/plugins/maps/server/kibana_server_services.ts | 5 +---- x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts | 2 +- x-pack/plugins/maps/server/plugin.ts | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/maps/server/kibana_server_services.ts b/x-pack/plugins/maps/server/kibana_server_services.ts index bca5fc06fbb5ce..ef12c3edaa81ff 100644 --- a/x-pack/plugins/maps/server/kibana_server_services.ts +++ b/x-pack/plugins/maps/server/kibana_server_services.ts @@ -6,13 +6,10 @@ */ import { CoreStart } from '@kbn/core/server'; -import { StartDeps } from './types'; let coreStart: CoreStart; -let pluginsStart: StartDeps; -export function setStartServices(core: CoreStart, plugins: StartDeps) { +export function setStartServices(core: CoreStart) { coreStart = core; - pluginsStart = plugins; } export const getSavedObjectClient = (extraTypes?: string[]) => { diff --git a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts index 351195fd942d16..462f8ca57d6926 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts +++ b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts @@ -13,7 +13,7 @@ export type MapsUsage = MapStats; export async function getMapsTelemetry(): Promise { const mapStatsCollector = new MapStatsCollector(); - await findMaps(getSavedObjectClient(), (savedObject) => { + await findMaps(getSavedObjectClient(), async (savedObject) => { mapStatsCollector.push(savedObject.attributes); }); diff --git a/x-pack/plugins/maps/server/plugin.ts b/x-pack/plugins/maps/server/plugin.ts index 0fe317beef05ef..1dc497a87fdd94 100644 --- a/x-pack/plugins/maps/server/plugin.ts +++ b/x-pack/plugins/maps/server/plugin.ts @@ -207,6 +207,6 @@ export class MapsPlugin implements Plugin { } start(core: CoreStart, plugins: StartDeps) { - setStartServices(core, plugins); + setStartServices(core); } } From 9ad62b69852d25b8a91a46506e48f63634db1f33 Mon Sep 17 00:00:00 2001 From: nreese Date: Fri, 24 Feb 2023 12:38:24 -0700 Subject: [PATCH 6/8] update maps telemetry tests --- .../api_integration/apis/maps/maps_telemetry.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/x-pack/test/api_integration/apis/maps/maps_telemetry.ts b/x-pack/test/api_integration/apis/maps/maps_telemetry.ts index d4d4c48c603366..918b59304fcf0b 100644 --- a/x-pack/test/api_integration/apis/maps/maps_telemetry.ts +++ b/x-pack/test/api_integration/apis/maps/maps_telemetry.ts @@ -24,14 +24,23 @@ export default function ({ getService }: FtrProviderContext) { }) .expect(200); + const geoPointFieldStats = apiResponse.cluster_stats.indices.mappings.field_types.find(fieldStat => { + return fieldStat.name === 'geo_point'; + }); + expect(geoPointFieldStats.count).to.be(7); + expect(geoPointFieldStats.index_count).to.be(6); + + const geoShapeFieldStats = apiResponse.cluster_stats.indices.mappings.field_types.find(fieldStat => { + return fieldStat.name === 'geo_shape'; + }); + expect(geoShapeFieldStats.count).to.be(3); + expect(geoShapeFieldStats.index_count).to.be(3); + + const mapUsage = apiResponse.stack_stats.kibana.plugins.maps; delete mapUsage.timeCaptured; expect(mapUsage).eql({ - geoShapeAggLayersCount: 1, - indexPatternsWithGeoFieldCount: 6, - indexPatternsWithGeoPointFieldCount: 4, - indexPatternsWithGeoShapeFieldCount: 2, mapsTotalCount: 27, basemaps: {}, joins: { term: { min: 1, max: 1, total: 3, avg: 0.1111111111111111 } }, From 03f57496af0424a6667c0f0acd03dbeda00ad669 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 24 Feb 2023 19:43:06 +0000 Subject: [PATCH 7/8] [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' --- .../api_integration/apis/maps/maps_telemetry.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/x-pack/test/api_integration/apis/maps/maps_telemetry.ts b/x-pack/test/api_integration/apis/maps/maps_telemetry.ts index 918b59304fcf0b..1fe55ee2b67a07 100644 --- a/x-pack/test/api_integration/apis/maps/maps_telemetry.ts +++ b/x-pack/test/api_integration/apis/maps/maps_telemetry.ts @@ -24,19 +24,22 @@ export default function ({ getService }: FtrProviderContext) { }) .expect(200); - const geoPointFieldStats = apiResponse.cluster_stats.indices.mappings.field_types.find(fieldStat => { - return fieldStat.name === 'geo_point'; - }); + const geoPointFieldStats = apiResponse.cluster_stats.indices.mappings.field_types.find( + (fieldStat) => { + return fieldStat.name === 'geo_point'; + } + ); expect(geoPointFieldStats.count).to.be(7); expect(geoPointFieldStats.index_count).to.be(6); - const geoShapeFieldStats = apiResponse.cluster_stats.indices.mappings.field_types.find(fieldStat => { - return fieldStat.name === 'geo_shape'; - }); + const geoShapeFieldStats = apiResponse.cluster_stats.indices.mappings.field_types.find( + (fieldStat) => { + return fieldStat.name === 'geo_shape'; + } + ); expect(geoShapeFieldStats.count).to.be(3); expect(geoShapeFieldStats.index_count).to.be(3); - const mapUsage = apiResponse.stack_stats.kibana.plugins.maps; delete mapUsage.timeCaptured; From 3752de2ed7f4477b4b5d7867f106926ad6480045 Mon Sep 17 00:00:00 2001 From: nreese Date: Fri, 24 Feb 2023 14:25:44 -0700 Subject: [PATCH 8/8] tslint integration test --- x-pack/test/api_integration/apis/maps/maps_telemetry.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x-pack/test/api_integration/apis/maps/maps_telemetry.ts b/x-pack/test/api_integration/apis/maps/maps_telemetry.ts index 1fe55ee2b67a07..1d63f8872776ff 100644 --- a/x-pack/test/api_integration/apis/maps/maps_telemetry.ts +++ b/x-pack/test/api_integration/apis/maps/maps_telemetry.ts @@ -6,6 +6,7 @@ */ import expect from '@kbn/expect'; +import { estypes } from '@elastic/elasticsearch'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { @@ -25,7 +26,7 @@ export default function ({ getService }: FtrProviderContext) { .expect(200); const geoPointFieldStats = apiResponse.cluster_stats.indices.mappings.field_types.find( - (fieldStat) => { + (fieldStat: estypes.ClusterStatsFieldTypes) => { return fieldStat.name === 'geo_point'; } ); @@ -33,7 +34,7 @@ export default function ({ getService }: FtrProviderContext) { expect(geoPointFieldStats.index_count).to.be(6); const geoShapeFieldStats = apiResponse.cluster_stats.indices.mappings.field_types.find( - (fieldStat) => { + (fieldStat: estypes.ClusterStatsFieldTypes) => { return fieldStat.name === 'geo_shape'; } );