[Timeseries] remove unused configuration properties (#62543)

* [Timeseries] remove unused configuration properties

* Fix PR comments

* update id of vis_type_timeseries plugin

* metrics -> vis_type_timeseries

* fix wrong plugin id

* update requiredPliugins for infra/kibana.json

* change id

* update plugin id in infra folder

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Alexey Antonov 2020-04-16 19:28:04 +03:00 committed by GitHub
parent 464a3c23ba
commit 871f7209f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 58 additions and 20 deletions

View file

@ -1,5 +1,5 @@
{
"id": "metrics",
"id": "visTypeTimeseries",
"version": "8.0.0",
"kibanaVersion": "kibana",
"server": true,

View file

@ -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<typeof config>;

View file

@ -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<VisTypeTimeseriesConfig> = {
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<typeof config.schema>;
// Unused properties which should be removed after releasing Kibana v8.0:
unused('chartResolution'),
unused('minimumBucketSize'),
],
schema: configSchema,
};
export { ValidationTelemetryServiceSetup } from './validation_telemetry';

View file

@ -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';

View file

@ -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: {

View file

@ -4,7 +4,7 @@
"requiredPlugins": [
"home",
"index_management",
"metrics",
"visTypeTimeseries",
"indexPatternManagement"
],
"optionalPlugins": [

View file

@ -38,12 +38,12 @@ export class RollupsServerPlugin implements Plugin<void, void, any, any> {
{
__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<void, void, any, any> {
indexManagement.indexDataEnricher.add(rollupDataEnricher);
}
if (metrics) {
const { addSearchStrategy } = metrics;
if (visTypeTimeseries) {
const { addSearchStrategy } = visTypeTimeseries;
registerRollupSearchStrategy(routeDependencies, addSearchStrategy);
}
}

View file

@ -10,7 +10,7 @@
"home",
"data",
"dataEnhanced",
"metrics",
"visTypeTimeseries",
"alerting",
"triggers_actions_ui"
],

View file

@ -20,7 +20,7 @@ export interface InfraServerPluginDeps {
home: HomeServerPluginSetup;
spaces: SpacesPluginSetup;
usageCollection: UsageCollectionSetup;
metrics: VisTypeTimeseriesSetup;
visTypeTimeseries: VisTypeTimeseriesSetup;
features: FeaturesPluginSetup;
apm: APMPluginContract;
alerting: AlertingPluginContract;

View file

@ -245,7 +245,7 @@ export class KibanaFramework {
timerange: { min: number; max: number },
filters: any[]
): Promise<InfraTSVBResponse> {
const { getVisData } = this.plugins.metrics;
const { getVisData } = this.plugins.visTypeTimeseries;
if (typeof getVisData !== 'function') {
throw new Error('TSVB is not available');
}