Skip to content

Commit

Permalink
[Timeseries] remove unused configuration properties (#62543)
Browse files Browse the repository at this point in the history
* [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 <[email protected]>
  • Loading branch information
alexwizp and elasticmachine authored Apr 16, 2020
1 parent 464a3c2 commit 871f720
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/plugins/vis_type_timeseries/kibana.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "metrics",
"id": "visTypeTimeseries",
"version": "8.0.0",
"kibanaVersion": "kibana",
"server": true,
Expand Down
31 changes: 31 additions & 0 deletions src/plugins/vis_type_timeseries/server/config.ts
Original file line number Diff line number Diff line change
@@ -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>;
23 changes: 15 additions & 8 deletions src/plugins/vis_type_timeseries/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_timeseries/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/rollup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -53,7 +53,7 @@ export function rollup(kibana: any) {

rollupPluginInstance.setup(coreSetup, {
usageCollection,
metrics,
visTypeTimeseries,
indexManagement,
__LEGACY: {
plugins: {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/rollup/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"requiredPlugins": [
"home",
"index_management",
"metrics",
"visTypeTimeseries",
"indexPatternManagement"
],
"optionalPlugins": [
Expand Down
8 changes: 4 additions & 4 deletions x-pack/legacy/plugins/rollup/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
) {
Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/infra/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"home",
"data",
"dataEnhanced",
"metrics",
"visTypeTimeseries",
"alerting",
"triggers_actions_ui"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface InfraServerPluginDeps {
home: HomeServerPluginSetup;
spaces: SpacesPluginSetup;
usageCollection: UsageCollectionSetup;
metrics: VisTypeTimeseriesSetup;
visTypeTimeseries: VisTypeTimeseriesSetup;
features: FeaturesPluginSetup;
apm: APMPluginContract;
alerting: AlertingPluginContract;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 871f720

Please sign in to comment.