diff --git a/src/plugins/vis_type_timeseries/kibana.json b/src/plugins/vis_type_timeseries/kibana.json index 305e159ac250..38662c6a7ff8 100644 --- a/src/plugins/vis_type_timeseries/kibana.json +++ b/src/plugins/vis_type_timeseries/kibana.json @@ -1,5 +1,5 @@ { - "id": "metrics", + "id": "visTypeTimeseries", "version": "8.0.0", "kibanaVersion": "kibana", "server": true, diff --git a/src/plugins/vis_type_timeseries/server/config.ts b/src/plugins/vis_type_timeseries/server/config.ts new file mode 100644 index 000000000000..f4668eff8fa0 --- /dev/null +++ b/src/plugins/vis_type_timeseries/server/config.ts @@ -0,0 +1,31 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { schema, TypeOf } from '@kbn/config-schema'; + +export const config = schema.object({ + enabled: schema.boolean({ defaultValue: true }), + + /** @deprecated **/ + chartResolution: schema.number({ defaultValue: 150 }), + /** @deprecated **/ + minimumBucketSize: schema.number({ defaultValue: 10 }), +}); + +export type VisTypeTimeseriesConfig = TypeOf; diff --git a/src/plugins/vis_type_timeseries/server/index.ts b/src/plugins/vis_type_timeseries/server/index.ts index fa74b6e96597..f460257caf5e 100644 --- a/src/plugins/vis_type_timeseries/server/index.ts +++ b/src/plugins/vis_type_timeseries/server/index.ts @@ -17,18 +17,25 @@ * under the License. */ -import { schema, TypeOf } from '@kbn/config-schema'; -import { PluginInitializerContext } from 'src/core/server'; +import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server'; +import { VisTypeTimeseriesConfig, config as configSchema } from './config'; import { VisTypeTimeseriesPlugin } from './plugin'; + export { VisTypeTimeseriesSetup, Framework } from './plugin'; -export const config = { - schema: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), -}; +export const config: PluginConfigDescriptor = { + deprecations: ({ unused, renameFromRoot }) => [ + // In Kibana v7.8 plugin id was renamed from 'metrics' to 'vis_type_timeseries': + renameFromRoot('metrics.enabled', 'vis_type_timeseries.enabled', true), + renameFromRoot('metrics.chartResolution', 'vis_type_timeseries.chartResolution', true), + renameFromRoot('metrics.minimumBucketSize', 'vis_type_timeseries.minimumBucketSize', true), -export type VisTypeTimeseriesConfig = TypeOf; + // Unused properties which should be removed after releasing Kibana v8.0: + unused('chartResolution'), + unused('minimumBucketSize'), + ], + schema: configSchema, +}; export { ValidationTelemetryServiceSetup } from './validation_telemetry'; diff --git a/src/plugins/vis_type_timeseries/server/plugin.ts b/src/plugins/vis_type_timeseries/server/plugin.ts index 6ef6362c6e37..05257cb79a75 100644 --- a/src/plugins/vis_type_timeseries/server/plugin.ts +++ b/src/plugins/vis_type_timeseries/server/plugin.ts @@ -29,7 +29,7 @@ import { } from 'src/core/server'; import { Observable } from 'rxjs'; import { Server } from 'hapi'; -import { VisTypeTimeseriesConfig } from '.'; +import { VisTypeTimeseriesConfig } from './config'; import { getVisData, GetVisData, GetVisDataOptions } from './lib/get_vis_data'; import { ValidationTelemetryService } from './validation_telemetry'; import { UsageCollectionSetup } from '../../usage_collection/server'; diff --git a/x-pack/legacy/plugins/rollup/index.ts b/x-pack/legacy/plugins/rollup/index.ts index 2c8363cc397f..621667f3618b 100644 --- a/x-pack/legacy/plugins/rollup/index.ts +++ b/x-pack/legacy/plugins/rollup/index.ts @@ -40,7 +40,7 @@ export function rollup(kibana: any) { }, init(server: any) { const { core: coreSetup, plugins } = server.newPlatform.setup; - const { usageCollection, metrics, indexManagement } = plugins; + const { usageCollection, visTypeTimeseries, indexManagement } = plugins; const rollupSetup = (plugins.rollup as unknown) as RollupSetup; @@ -53,7 +53,7 @@ export function rollup(kibana: any) { rollupPluginInstance.setup(coreSetup, { usageCollection, - metrics, + visTypeTimeseries, indexManagement, __LEGACY: { plugins: { diff --git a/x-pack/legacy/plugins/rollup/kibana.json b/x-pack/legacy/plugins/rollup/kibana.json index 3df8bd7c187d..78458c9218be 100644 --- a/x-pack/legacy/plugins/rollup/kibana.json +++ b/x-pack/legacy/plugins/rollup/kibana.json @@ -4,7 +4,7 @@ "requiredPlugins": [ "home", "index_management", - "metrics", + "visTypeTimeseries", "indexPatternManagement" ], "optionalPlugins": [ diff --git a/x-pack/legacy/plugins/rollup/server/plugin.ts b/x-pack/legacy/plugins/rollup/server/plugin.ts index 5f29ad160e05..05c22b030fff 100644 --- a/x-pack/legacy/plugins/rollup/server/plugin.ts +++ b/x-pack/legacy/plugins/rollup/server/plugin.ts @@ -38,12 +38,12 @@ export class RollupsServerPlugin implements Plugin { { __LEGACY: serverShim, usageCollection, - metrics, + visTypeTimeseries, indexManagement, }: { __LEGACY: ServerShim; usageCollection?: UsageCollectionSetup; - metrics?: VisTypeTimeseriesSetup; + visTypeTimeseries?: VisTypeTimeseriesSetup; indexManagement?: IndexManagementPluginSetup; } ) { @@ -83,8 +83,8 @@ export class RollupsServerPlugin implements Plugin { indexManagement.indexDataEnricher.add(rollupDataEnricher); } - if (metrics) { - const { addSearchStrategy } = metrics; + if (visTypeTimeseries) { + const { addSearchStrategy } = visTypeTimeseries; registerRollupSearchStrategy(routeDependencies, addSearchStrategy); } } diff --git a/x-pack/plugins/infra/kibana.json b/x-pack/plugins/infra/kibana.json index b8796ad7a358..a15465a0cde6 100644 --- a/x-pack/plugins/infra/kibana.json +++ b/x-pack/plugins/infra/kibana.json @@ -10,7 +10,7 @@ "home", "data", "dataEnhanced", - "metrics", + "visTypeTimeseries", "alerting", "triggers_actions_ui" ], diff --git a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts index 8ddd3935bcc3..038fd457fb6c 100644 --- a/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts @@ -20,7 +20,7 @@ export interface InfraServerPluginDeps { home: HomeServerPluginSetup; spaces: SpacesPluginSetup; usageCollection: UsageCollectionSetup; - metrics: VisTypeTimeseriesSetup; + visTypeTimeseries: VisTypeTimeseriesSetup; features: FeaturesPluginSetup; apm: APMPluginContract; alerting: AlertingPluginContract; diff --git a/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts index b73acd670305..eda1fbfa5f4c 100644 --- a/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts @@ -245,7 +245,7 @@ export class KibanaFramework { timerange: { min: number; max: number }, filters: any[] ): Promise { - const { getVisData } = this.plugins.metrics; + const { getVisData } = this.plugins.visTypeTimeseries; if (typeof getVisData !== 'function') { throw new Error('TSVB is not available'); }