Skip to content

Commit 871f720

Browse files
[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>
1 parent 464a3c2 commit 871f720

File tree

10 files changed

+58
-20
lines changed

10 files changed

+58
-20
lines changed

src/plugins/vis_type_timeseries/kibana.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "metrics",
2+
"id": "visTypeTimeseries",
33
"version": "8.0.0",
44
"kibanaVersion": "kibana",
55
"server": true,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { schema, TypeOf } from '@kbn/config-schema';
21+
22+
export const config = schema.object({
23+
enabled: schema.boolean({ defaultValue: true }),
24+
25+
/** @deprecated **/
26+
chartResolution: schema.number({ defaultValue: 150 }),
27+
/** @deprecated **/
28+
minimumBucketSize: schema.number({ defaultValue: 10 }),
29+
});
30+
31+
export type VisTypeTimeseriesConfig = TypeOf<typeof config>;

src/plugins/vis_type_timeseries/server/index.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,25 @@
1717
* under the License.
1818
*/
1919

20-
import { schema, TypeOf } from '@kbn/config-schema';
21-
import { PluginInitializerContext } from 'src/core/server';
20+
import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server';
21+
import { VisTypeTimeseriesConfig, config as configSchema } from './config';
2222
import { VisTypeTimeseriesPlugin } from './plugin';
23+
2324
export { VisTypeTimeseriesSetup, Framework } from './plugin';
2425

25-
export const config = {
26-
schema: schema.object({
27-
enabled: schema.boolean({ defaultValue: true }),
28-
}),
29-
};
26+
export const config: PluginConfigDescriptor<VisTypeTimeseriesConfig> = {
27+
deprecations: ({ unused, renameFromRoot }) => [
28+
// In Kibana v7.8 plugin id was renamed from 'metrics' to 'vis_type_timeseries':
29+
renameFromRoot('metrics.enabled', 'vis_type_timeseries.enabled', true),
30+
renameFromRoot('metrics.chartResolution', 'vis_type_timeseries.chartResolution', true),
31+
renameFromRoot('metrics.minimumBucketSize', 'vis_type_timeseries.minimumBucketSize', true),
3032

31-
export type VisTypeTimeseriesConfig = TypeOf<typeof config.schema>;
33+
// Unused properties which should be removed after releasing Kibana v8.0:
34+
unused('chartResolution'),
35+
unused('minimumBucketSize'),
36+
],
37+
schema: configSchema,
38+
};
3239

3340
export { ValidationTelemetryServiceSetup } from './validation_telemetry';
3441

src/plugins/vis_type_timeseries/server/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
} from 'src/core/server';
3030
import { Observable } from 'rxjs';
3131
import { Server } from 'hapi';
32-
import { VisTypeTimeseriesConfig } from '.';
32+
import { VisTypeTimeseriesConfig } from './config';
3333
import { getVisData, GetVisData, GetVisDataOptions } from './lib/get_vis_data';
3434
import { ValidationTelemetryService } from './validation_telemetry';
3535
import { UsageCollectionSetup } from '../../usage_collection/server';

x-pack/legacy/plugins/rollup/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function rollup(kibana: any) {
4040
},
4141
init(server: any) {
4242
const { core: coreSetup, plugins } = server.newPlatform.setup;
43-
const { usageCollection, metrics, indexManagement } = plugins;
43+
const { usageCollection, visTypeTimeseries, indexManagement } = plugins;
4444

4545
const rollupSetup = (plugins.rollup as unknown) as RollupSetup;
4646

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

5454
rollupPluginInstance.setup(coreSetup, {
5555
usageCollection,
56-
metrics,
56+
visTypeTimeseries,
5757
indexManagement,
5858
__LEGACY: {
5959
plugins: {

x-pack/legacy/plugins/rollup/kibana.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"requiredPlugins": [
55
"home",
66
"index_management",
7-
"metrics",
7+
"visTypeTimeseries",
88
"indexPatternManagement"
99
],
1010
"optionalPlugins": [

x-pack/legacy/plugins/rollup/server/plugin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ export class RollupsServerPlugin implements Plugin<void, void, any, any> {
3838
{
3939
__LEGACY: serverShim,
4040
usageCollection,
41-
metrics,
41+
visTypeTimeseries,
4242
indexManagement,
4343
}: {
4444
__LEGACY: ServerShim;
4545
usageCollection?: UsageCollectionSetup;
46-
metrics?: VisTypeTimeseriesSetup;
46+
visTypeTimeseries?: VisTypeTimeseriesSetup;
4747
indexManagement?: IndexManagementPluginSetup;
4848
}
4949
) {
@@ -83,8 +83,8 @@ export class RollupsServerPlugin implements Plugin<void, void, any, any> {
8383
indexManagement.indexDataEnricher.add(rollupDataEnricher);
8484
}
8585

86-
if (metrics) {
87-
const { addSearchStrategy } = metrics;
86+
if (visTypeTimeseries) {
87+
const { addSearchStrategy } = visTypeTimeseries;
8888
registerRollupSearchStrategy(routeDependencies, addSearchStrategy);
8989
}
9090
}

x-pack/plugins/infra/kibana.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"home",
1111
"data",
1212
"dataEnhanced",
13-
"metrics",
13+
"visTypeTimeseries",
1414
"alerting",
1515
"triggers_actions_ui"
1616
],

x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface InfraServerPluginDeps {
2020
home: HomeServerPluginSetup;
2121
spaces: SpacesPluginSetup;
2222
usageCollection: UsageCollectionSetup;
23-
metrics: VisTypeTimeseriesSetup;
23+
visTypeTimeseries: VisTypeTimeseriesSetup;
2424
features: FeaturesPluginSetup;
2525
apm: APMPluginContract;
2626
alerting: AlertingPluginContract;

x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export class KibanaFramework {
245245
timerange: { min: number; max: number },
246246
filters: any[]
247247
): Promise<InfraTSVBResponse> {
248-
const { getVisData } = this.plugins.metrics;
248+
const { getVisData } = this.plugins.visTypeTimeseries;
249249
if (typeof getVisData !== 'function') {
250250
throw new Error('TSVB is not available');
251251
}

0 commit comments

Comments
 (0)