From 1b2d37ee668b4f618d92e6d0af963bc0e70c2934 Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Wed, 31 Mar 2021 22:45:25 -0500 Subject: [PATCH] Index pattern scripted field / runtime field usage collection (#95366) (#96012) * add index pattern telemetry # Conflicts: # docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.md # docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.setup.md # src/plugins/data/server/index_patterns/index_patterns_service.ts # src/plugins/data/server/plugin.ts # src/plugins/data/server/server.api.md --- ...ata-server.indexpatternsserviceprovider.md | 2 +- ...rver.indexpatternsserviceprovider.setup.md | 6 +- ...rver.indexpatternsserviceprovider.start.md | 4 +- .../index_patterns/index_patterns_service.ts | 75 ++++--- ...ter_index_pattern_usage_collection.test.ts | 140 +++++++++++++ ...register_index_pattern_usage_collection.ts | 193 ++++++++++++++++++ src/plugins/data/server/plugin.ts | 7 +- .../data/server/search/search_service.test.ts | 4 +- .../data/server/search/search_service.ts | 4 +- src/plugins/data/server/server.api.md | 12 +- src/plugins/telemetry/schema/oss_plugins.json | 75 +++++++ 11 files changed, 476 insertions(+), 46 deletions(-) create mode 100644 src/plugins/data/server/index_patterns/register_index_pattern_usage_collection.test.ts create mode 100644 src/plugins/data/server/index_patterns/register_index_pattern_usage_collection.ts diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.md index 698b4bc7f2043..61487de2dd611 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.md @@ -14,6 +14,6 @@ export declare class IndexPatternsServiceProvider implements PluginSignature: ```typescript -setup(core: CoreSetup, { logger, expressions }: IndexPatternsServiceSetupDeps): void; +setup(core: CoreSetup, { logger, expressions, usageCollection }: IndexPatternsServiceSetupDeps): void; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| core | CoreSetup<DataPluginStartDependencies, DataPluginStart> | | -| { logger, expressions } | IndexPatternsServiceSetupDeps | | +| core | CoreSetup<IndexPatternsServiceStartDeps, DataPluginStart> | | +| { logger, expressions, usageCollection } | IndexPatternsServiceSetupDeps | | Returns: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.start.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.start.md index 98f9310c6d98c..88079bb2fa3cb 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.start.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsserviceprovider.start.md @@ -8,7 +8,7 @@ ```typescript start(core: CoreStart, { fieldFormats, logger }: IndexPatternsServiceStartDeps): { - indexPatternsServiceFactory: (savedObjectsClient: SavedObjectsClientContract, elasticsearchClient: ElasticsearchClient) => Promise; + indexPatternsServiceFactory: (savedObjectsClient: Pick, elasticsearchClient: ElasticsearchClient) => Promise; }; ``` @@ -22,6 +22,6 @@ start(core: CoreStart, { fieldFormats, logger }: IndexPatternsServiceStartDeps): Returns: `{ - indexPatternsServiceFactory: (savedObjectsClient: SavedObjectsClientContract, elasticsearchClient: ElasticsearchClient) => Promise; + indexPatternsServiceFactory: (savedObjectsClient: Pick, elasticsearchClient: ElasticsearchClient) => Promise; }` diff --git a/src/plugins/data/server/index_patterns/index_patterns_service.ts b/src/plugins/data/server/index_patterns/index_patterns_service.ts index 4d93e9c0e0606..8897b0d136047 100644 --- a/src/plugins/data/server/index_patterns/index_patterns_service.ts +++ b/src/plugins/data/server/index_patterns/index_patterns_service.ts @@ -13,9 +13,11 @@ import { Logger, SavedObjectsClientContract, ElasticsearchClient, + UiSettingsServiceStart, } from 'kibana/server'; import { ExpressionsServerSetup } from 'src/plugins/expressions/server'; -import { DataPluginStartDependencies, DataPluginStart } from '../plugin'; +import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; +import { DataPluginStart } from '../plugin'; import { registerRoutes } from './routes'; import { indexPatternSavedObjectType } from '../saved_objects'; import { capabilitiesProvider } from './capabilities_provider'; @@ -26,6 +28,7 @@ import { UiSettingsServerToCommon } from './ui_settings_wrapper'; import { IndexPatternsApiServer } from './index_patterns_api_client'; import { SavedObjectsClientServerToCommon } from './saved_objects_client_wrapper'; import { DataRequestHandlerContext } from '../types'; +import { registerIndexPatternsUsageCollector } from './register_index_pattern_usage_collection'; export interface IndexPatternsServiceStart { indexPatternsServiceFactory: ( @@ -37,6 +40,7 @@ export interface IndexPatternsServiceStart { export interface IndexPatternsServiceSetupDeps { expressions: ExpressionsServerSetup; logger: Logger; + usageCollection?: UsageCollectionSetup; } export interface IndexPatternsServiceStartDeps { @@ -44,10 +48,44 @@ export interface IndexPatternsServiceStartDeps { logger: Logger; } +export const indexPatternsServiceFactory = ({ + logger, + uiSettings, + fieldFormats, +}: { + logger: Logger; + uiSettings: UiSettingsServiceStart; + fieldFormats: FieldFormatsStart; +}) => async ( + savedObjectsClient: SavedObjectsClientContract, + elasticsearchClient: ElasticsearchClient +) => { + const uiSettingsClient = uiSettings.asScopedToClient(savedObjectsClient); + const formats = await fieldFormats.fieldFormatServiceFactory(uiSettingsClient); + + return new IndexPatternsCommonService({ + uiSettings: new UiSettingsServerToCommon(uiSettingsClient), + savedObjectsClient: new SavedObjectsClientServerToCommon(savedObjectsClient), + apiClient: new IndexPatternsApiServer(elasticsearchClient), + fieldFormats: formats, + onError: (error) => { + logger.error(error); + }, + onNotification: ({ title, text }) => { + logger.warn(`${title} : ${text}`); + }, + onUnsupportedTimePattern: ({ index, title }) => { + logger.warn( + `Currently querying all indices matching ${index}. ${title} should be migrated to a wildcard-based index pattern.` + ); + }, + }); +}; + export class IndexPatternsServiceProvider implements Plugin { public setup( - core: CoreSetup, - { logger, expressions }: IndexPatternsServiceSetupDeps + core: CoreSetup, + { logger, expressions, usageCollection }: IndexPatternsServiceSetupDeps ) { core.savedObjects.registerType(indexPatternSavedObjectType); core.capabilities.registerProvider(capabilitiesProvider); @@ -71,37 +109,18 @@ export class IndexPatternsServiceProvider implements Plugin { - const uiSettingsClient = uiSettings.asScopedToClient(savedObjectsClient); - const formats = await fieldFormats.fieldFormatServiceFactory(uiSettingsClient); - - return new IndexPatternsCommonService({ - uiSettings: new UiSettingsServerToCommon(uiSettingsClient), - savedObjectsClient: new SavedObjectsClientServerToCommon(savedObjectsClient), - apiClient: new IndexPatternsApiServer(elasticsearchClient), - fieldFormats: formats, - onError: (error) => { - logger.error(error); - }, - onNotification: ({ title, text }) => { - logger.warn(`${title} : ${text}`); - }, - onUnsupportedTimePattern: ({ index, title }) => { - logger.warn( - `Currently querying all indices matching ${index}. ${title} should be migrated to a wildcard-based index pattern.` - ); - }, - }); - }, + indexPatternsServiceFactory: indexPatternsServiceFactory({ + logger, + uiSettings, + fieldFormats, + }), }; } } diff --git a/src/plugins/data/server/index_patterns/register_index_pattern_usage_collection.test.ts b/src/plugins/data/server/index_patterns/register_index_pattern_usage_collection.test.ts new file mode 100644 index 0000000000000..c43431e10731a --- /dev/null +++ b/src/plugins/data/server/index_patterns/register_index_pattern_usage_collection.test.ts @@ -0,0 +1,140 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { + minMaxAvgLoC, + updateMin, + updateMax, + getIndexPatternTelemetry, +} from './register_index_pattern_usage_collection'; +import { IndexPatternsCommonService } from '..'; + +const scriptA = 'emit(0);'; +const scriptB = 'emit(1);\nemit(2);'; +const scriptC = 'emit(3);\nemit(4)\nemit(5)'; + +const scriptedFieldA = { script: scriptA }; +const scriptedFieldB = { script: scriptB }; +const scriptedFieldC = { script: scriptC }; + +const runtimeFieldA = { runtimeField: { script: { source: scriptA } } }; +const runtimeFieldB = { runtimeField: { script: { source: scriptB } } }; +const runtimeFieldC = { runtimeField: { script: { source: scriptC } } }; + +const indexPatterns = ({ + getIds: async () => [1, 2, 3], + get: jest.fn().mockResolvedValue({ + getScriptedFields: () => [], + fields: [], + }), +} as any) as IndexPatternsCommonService; + +describe('index pattern usage collection', () => { + it('minMaxAvgLoC calculates min, max, and average ', () => { + const scripts = [scriptA, scriptB, scriptC]; + expect(minMaxAvgLoC(scripts)).toEqual({ min: 1, max: 3, avg: 2 }); + expect(minMaxAvgLoC([undefined, undefined, undefined])).toEqual({ min: 0, max: 0, avg: 0 }); + }); + + it('updateMin returns minimum value', () => { + expect(updateMin(undefined, 1)).toEqual(1); + expect(updateMin(1, 0)).toEqual(0); + }); + + it('updateMax returns maximum value', () => { + expect(updateMax(undefined, 1)).toEqual(1); + expect(updateMax(1, 0)).toEqual(1); + }); + + describe('calculates index pattern usage', () => { + const countSummaryDefault = { + min: undefined, + max: undefined, + avg: undefined, + }; + + it('when there are no runtime fields or scripted fields', async () => { + expect(await getIndexPatternTelemetry(indexPatterns)).toEqual({ + indexPatternsCount: 3, + indexPatternsWithScriptedFieldCount: 0, + indexPatternsWithRuntimeFieldCount: 0, + scriptedFieldCount: 0, + runtimeFieldCount: 0, + perIndexPattern: { + scriptedFieldCount: countSummaryDefault, + runtimeFieldCount: countSummaryDefault, + scriptedFieldLineCount: countSummaryDefault, + runtimeFieldLineCount: countSummaryDefault, + }, + }); + }); + + it('when there are both runtime fields or scripted fields', async () => { + indexPatterns.get = jest.fn().mockResolvedValue({ + getScriptedFields: () => [scriptedFieldA, scriptedFieldB, scriptedFieldC], + fields: [runtimeFieldA, runtimeFieldB, runtimeFieldC], + }); + + expect(await getIndexPatternTelemetry(indexPatterns)).toEqual({ + indexPatternsCount: 3, + indexPatternsWithScriptedFieldCount: 3, + indexPatternsWithRuntimeFieldCount: 3, + scriptedFieldCount: 9, + runtimeFieldCount: 9, + perIndexPattern: { + scriptedFieldCount: { min: 3, max: 3, avg: 3 }, + runtimeFieldCount: { min: 3, max: 3, avg: 3 }, + scriptedFieldLineCount: { min: 1, max: 3, avg: 2 }, + runtimeFieldLineCount: { min: 1, max: 3, avg: 2 }, + }, + }); + }); + + it('when there are only runtime fields', async () => { + indexPatterns.get = jest.fn().mockResolvedValue({ + getScriptedFields: () => [], + fields: [runtimeFieldA, runtimeFieldB, runtimeFieldC], + }); + + expect(await getIndexPatternTelemetry(indexPatterns)).toEqual({ + indexPatternsCount: 3, + indexPatternsWithScriptedFieldCount: 0, + indexPatternsWithRuntimeFieldCount: 3, + scriptedFieldCount: 0, + runtimeFieldCount: 9, + perIndexPattern: { + scriptedFieldCount: countSummaryDefault, + runtimeFieldCount: { min: 3, max: 3, avg: 3 }, + scriptedFieldLineCount: countSummaryDefault, + runtimeFieldLineCount: { min: 1, max: 3, avg: 2 }, + }, + }); + }); + + it('when there are only scripted fields', async () => { + indexPatterns.get = jest.fn().mockResolvedValue({ + getScriptedFields: () => [scriptedFieldA, scriptedFieldB, scriptedFieldC], + fields: [], + }); + + expect(await getIndexPatternTelemetry(indexPatterns)).toEqual({ + indexPatternsCount: 3, + indexPatternsWithScriptedFieldCount: 3, + indexPatternsWithRuntimeFieldCount: 0, + scriptedFieldCount: 9, + runtimeFieldCount: 0, + perIndexPattern: { + scriptedFieldCount: { min: 3, max: 3, avg: 3 }, + runtimeFieldCount: countSummaryDefault, + scriptedFieldLineCount: { min: 1, max: 3, avg: 2 }, + runtimeFieldLineCount: countSummaryDefault, + }, + }); + }); + }); +}); diff --git a/src/plugins/data/server/index_patterns/register_index_pattern_usage_collection.ts b/src/plugins/data/server/index_patterns/register_index_pattern_usage_collection.ts new file mode 100644 index 0000000000000..36c2a59ce2753 --- /dev/null +++ b/src/plugins/data/server/index_patterns/register_index_pattern_usage_collection.ts @@ -0,0 +1,193 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; +import { StartServicesAccessor } from 'src/core/server'; +import { IndexPatternsCommonService } from '..'; +import { SavedObjectsClient } from '../../../../core/server'; +import { DataPluginStartDependencies, DataPluginStart } from '../plugin'; + +interface CountSummary { + min?: number; + max?: number; + avg?: number; +} + +interface IndexPatternUsage { + indexPatternsCount: number; + indexPatternsWithScriptedFieldCount: number; + indexPatternsWithRuntimeFieldCount: number; + scriptedFieldCount: number; + runtimeFieldCount: number; + perIndexPattern: { + scriptedFieldCount: CountSummary; + runtimeFieldCount: CountSummary; + scriptedFieldLineCount: CountSummary; + runtimeFieldLineCount: CountSummary; + }; +} + +export const minMaxAvgLoC = (scripts: Array) => { + const lengths = scripts.map((script) => script?.split(/\r\n|\r|\n/).length || 0).sort(); + return { + min: lengths[0], + max: lengths[lengths.length - 1], + avg: lengths.reduce((col, count) => col + count, 0) / lengths.length, + }; +}; + +export const updateMin = (currentMin: number | undefined, newVal: number): number => { + if (currentMin === undefined || currentMin > newVal) { + return newVal; + } else { + return currentMin; + } +}; + +export const updateMax = (currentMax: number | undefined, newVal: number): number => { + if (currentMax === undefined || currentMax < newVal) { + return newVal; + } else { + return currentMax; + } +}; + +export async function getIndexPatternTelemetry(indexPatterns: IndexPatternsCommonService) { + const ids = await indexPatterns.getIds(); + + const countSummaryDefaults: CountSummary = { + min: undefined, + max: undefined, + avg: undefined, + }; + + const results = { + indexPatternsCount: ids.length, + indexPatternsWithScriptedFieldCount: 0, + indexPatternsWithRuntimeFieldCount: 0, + scriptedFieldCount: 0, + runtimeFieldCount: 0, + perIndexPattern: { + scriptedFieldCount: { ...countSummaryDefaults }, + runtimeFieldCount: { ...countSummaryDefaults }, + scriptedFieldLineCount: { ...countSummaryDefaults }, + runtimeFieldLineCount: { ...countSummaryDefaults }, + }, + }; + + await ids.reduce(async (col, id) => { + await col; + const ip = await indexPatterns.get(id); + + const scriptedFields = ip.getScriptedFields(); + const runtimeFields = ip.fields.filter((fld) => !!fld.runtimeField); + + if (scriptedFields.length > 0) { + // increment counts + results.indexPatternsWithScriptedFieldCount++; + results.scriptedFieldCount += scriptedFields.length; + + // calc LoC + results.perIndexPattern.scriptedFieldLineCount = minMaxAvgLoC( + scriptedFields.map((fld) => fld.script || '') + ); + + // calc field counts + results.perIndexPattern.scriptedFieldCount.min = updateMin( + results.perIndexPattern.scriptedFieldCount.min, + scriptedFields.length + ); + results.perIndexPattern.scriptedFieldCount.max = updateMax( + results.perIndexPattern.scriptedFieldCount.max, + scriptedFields.length + ); + results.perIndexPattern.scriptedFieldCount.avg = + results.scriptedFieldCount / results.indexPatternsWithScriptedFieldCount; + } + + if (runtimeFields.length > 0) { + // increment counts + results.indexPatternsWithRuntimeFieldCount++; + results.runtimeFieldCount += runtimeFields.length; + + // calc LoC + const runtimeFieldScripts = runtimeFields.map( + (fld) => fld.runtimeField?.script?.source || '' + ); + results.perIndexPattern.runtimeFieldLineCount = minMaxAvgLoC(runtimeFieldScripts); + + // calc field counts + results.perIndexPattern.runtimeFieldCount.min = updateMin( + results.perIndexPattern.runtimeFieldCount.min, + runtimeFields.length + ); + results.perIndexPattern.runtimeFieldCount.max = updateMax( + results.perIndexPattern.runtimeFieldCount.max, + runtimeFields.length + ); + results.perIndexPattern.runtimeFieldCount.avg = + results.runtimeFieldCount / results.indexPatternsWithRuntimeFieldCount; + } + }, Promise.resolve()); + + return results; +} + +export function registerIndexPatternsUsageCollector( + getStartServices: StartServicesAccessor, + usageCollection?: UsageCollectionSetup +): void { + if (!usageCollection) { + return; + } + + const indexPatternUsageCollector = usageCollection.makeUsageCollector({ + type: 'index-patterns', + isReady: () => true, + fetch: async () => { + const [{ savedObjects, elasticsearch }, , { indexPatterns }] = await getStartServices(); + const indexPatternService = await indexPatterns.indexPatternsServiceFactory( + new SavedObjectsClient(savedObjects.createInternalRepository()), + elasticsearch.client.asInternalUser + ); + + return await getIndexPatternTelemetry(indexPatternService); + }, + schema: { + indexPatternsCount: { type: 'long' }, + indexPatternsWithScriptedFieldCount: { type: 'long' }, + indexPatternsWithRuntimeFieldCount: { type: 'long' }, + scriptedFieldCount: { type: 'long' }, + runtimeFieldCount: { type: 'long' }, + perIndexPattern: { + scriptedFieldCount: { + min: { type: 'long' }, + max: { type: 'long' }, + avg: { type: 'float' }, + }, + runtimeFieldCount: { + min: { type: 'long' }, + max: { type: 'long' }, + avg: { type: 'float' }, + }, + scriptedFieldLineCount: { + min: { type: 'long' }, + max: { type: 'long' }, + avg: { type: 'float' }, + }, + runtimeFieldLineCount: { + min: { type: 'long' }, + max: { type: 'long' }, + avg: { type: 'float' }, + }, + }, + }, + }); + + usageCollection.registerCollector(indexPatternUsageCollector); +} diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index 3408c39cbb8e2..7b73802f1a34d 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -46,8 +46,10 @@ export interface DataPluginSetupDependencies { usageCollection?: UsageCollectionSetup; } -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface DataPluginStartDependencies {} +export interface DataPluginStartDependencies { + fieldFormats: FieldFormatsStart; + logger: Logger; +} export class DataServerPlugin implements @@ -85,6 +87,7 @@ export class DataServerPlugin this.indexPatterns.setup(core, { expressions, logger: this.logger.get('indexPatterns'), + usageCollection, }); core.uiSettings.register(getUiSettings()); diff --git a/src/plugins/data/server/search/search_service.test.ts b/src/plugins/data/server/search/search_service.test.ts index 192c133c94a04..d5a83efcc215f 100644 --- a/src/plugins/data/server/search/search_service.test.ts +++ b/src/plugins/data/server/search/search_service.test.ts @@ -10,7 +10,7 @@ import type { MockedKeys } from '@kbn/utility-types/jest'; import { CoreSetup, CoreStart, SavedObject } from '../../../../core/server'; import { coreMock } from '../../../../core/server/mocks'; -import { DataPluginStart } from '../plugin'; +import { DataPluginStart, DataPluginStartDependencies } from '../plugin'; import { createFieldFormatsStartMock } from '../field_formats/mocks'; import { createIndexPatternsStartMock } from '../index_patterns/mocks'; @@ -32,7 +32,7 @@ import { createSearchSessionsClientMock } from './mocks'; describe('Search service', () => { let plugin: SearchService; - let mockCoreSetup: MockedKeys>; + let mockCoreSetup: MockedKeys>; let mockCoreStart: MockedKeys; beforeEach(() => { diff --git a/src/plugins/data/server/search/search_service.ts b/src/plugins/data/server/search/search_service.ts index 038fe4025622e..9dc144d5e8f1f 100644 --- a/src/plugins/data/server/search/search_service.ts +++ b/src/plugins/data/server/search/search_service.ts @@ -37,7 +37,7 @@ import { FieldFormatsStart } from '../field_formats'; import { IndexPatternsServiceStart } from '../index_patterns'; import { getCallMsearch, registerMsearchRoute, registerSearchRoute } from './routes'; import { ES_SEARCH_STRATEGY, esSearchStrategyProvider } from './es_search'; -import { DataPluginStart } from '../plugin'; +import { DataPluginStart, DataPluginStartDependencies } from '../plugin'; import { UsageCollectionSetup } from '../../../usage_collection/server'; import { registerUsageCollector } from './collectors/register'; import { usageProvider } from './collectors/usage'; @@ -114,7 +114,7 @@ export class SearchService implements Plugin { } public setup( - core: CoreSetup<{}, DataPluginStart>, + core: CoreSetup, { bfetch, expressions, usageCollection }: SearchServiceSetupDependencies ): ISearchSetup { const usage = usageCollection ? usageProvider(core) : undefined; diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 432a01fc0acc0..023e0adbf97e2 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -73,6 +73,7 @@ import { Type } from '@kbn/config-schema'; import { TypeOf } from '@kbn/config-schema'; import { UiCounterMetricType } from '@kbn/analytics'; import { Unit } from '@elastic/datemath'; +import { UsageCollectionSetup as UsageCollectionSetup_2 } from 'src/plugins/usage_collection/server'; // Warning: (ae-forgotten-export) The symbol "AggConfigSerialized" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "AggConfigOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -970,16 +971,14 @@ export { IndexPatternsService } // // @public (undocumented) export class IndexPatternsServiceProvider implements Plugin_3 { - // Warning: (ae-forgotten-export) The symbol "DataPluginStartDependencies" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "IndexPatternsServiceStartDeps" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "IndexPatternsServiceSetupDeps" needs to be exported by the entry point index.d.ts // // (undocumented) - setup(core: CoreSetup_2, { logger, expressions }: IndexPatternsServiceSetupDeps): void; - // Warning: (ae-forgotten-export) The symbol "IndexPatternsServiceStartDeps" needs to be exported by the entry point index.d.ts - // + setup(core: CoreSetup_2, { logger, expressions, usageCollection }: IndexPatternsServiceSetupDeps): void; // (undocumented) start(core: CoreStart, { fieldFormats, logger }: IndexPatternsServiceStartDeps): { - indexPatternsServiceFactory: (savedObjectsClient: SavedObjectsClientContract_2, elasticsearchClient: ElasticsearchClient_2) => Promise; + indexPatternsServiceFactory: (savedObjectsClient: Pick, elasticsearchClient: ElasticsearchClient_2) => Promise; }; } @@ -1225,6 +1224,7 @@ export type ParsedInterval = ReturnType; export function parseInterval(interval: string): moment.Duration | null; // Warning: (ae-forgotten-export) The symbol "DataPluginSetupDependencies" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DataPluginStartDependencies" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "DataServerPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -1529,7 +1529,7 @@ export function usageProvider(core: CoreSetup_2): SearchUsage; // src/plugins/data/server/index.ts:267:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:270:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:271:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/plugin.ts:79:74 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/plugin.ts:81:74 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts // src/plugins/data/server/search/types.ts:112:5 - (ae-forgotten-export) The symbol "ISearchStartSearchSource" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index f31e867194150..6d291a2d5cc0e 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -24,6 +24,81 @@ } } }, + "index-patterns": { + "properties": { + "indexPatternsCount": { + "type": "long" + }, + "indexPatternsWithScriptedFieldCount": { + "type": "long" + }, + "indexPatternsWithRuntimeFieldCount": { + "type": "long" + }, + "scriptedFieldCount": { + "type": "long" + }, + "runtimeFieldCount": { + "type": "long" + }, + "perIndexPattern": { + "properties": { + "scriptedFieldCount": { + "properties": { + "min": { + "type": "long" + }, + "max": { + "type": "long" + }, + "avg": { + "type": "float" + } + } + }, + "runtimeFieldCount": { + "properties": { + "min": { + "type": "long" + }, + "max": { + "type": "long" + }, + "avg": { + "type": "float" + } + } + }, + "scriptedFieldLineCount": { + "properties": { + "min": { + "type": "long" + }, + "max": { + "type": "long" + }, + "avg": { + "type": "float" + } + } + }, + "runtimeFieldLineCount": { + "properties": { + "min": { + "type": "long" + }, + "max": { + "type": "long" + }, + "avg": { + "type": "float" + } + } + } + } + } + } + }, "kql": { "properties": { "optInCount": {