diff --git a/src/legacy/core_plugins/vis_type_timeseries/index.ts b/src/legacy/core_plugins/vis_type_timeseries/index.ts index eb20c0f23965a8..9ca14b28e19b2a 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/index.ts +++ b/src/legacy/core_plugins/vis_type_timeseries/index.ts @@ -19,13 +19,9 @@ import { resolve } from 'path'; import { Legacy } from 'kibana'; -import { PluginInitializerContext } from 'src/core/server'; -import { CoreSetup } from 'src/core/server'; - -import { plugin } from './server/'; -import { CustomCoreSetup } from './server/plugin'; import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types'; +import { VisTypeTimeseriesSetup } from '../../../plugins/vis_type_timeseries/server'; const metricsPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) => new Plugin({ @@ -38,10 +34,9 @@ const metricsPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPlu injectDefaultVars: server => ({}), }, init: (server: Legacy.Server) => { - const initializerContext = {} as PluginInitializerContext; - const core = { http: { server } } as CoreSetup & CustomCoreSetup; - - plugin(initializerContext).setup(core); + const visTypeTimeSeriesPlugin = server.newPlatform.setup.plugins + .metrics as VisTypeTimeseriesSetup; + visTypeTimeSeriesPlugin.__legacy.registerLegacyAPI({ server }); }, config(Joi: any) { return Joi.object({ diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/index.ts b/src/legacy/core_plugins/vis_type_timeseries/server/index.ts index 14047c31f2dcdb..c010628ca04bfd 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/server/index.ts +++ b/src/legacy/core_plugins/vis_type_timeseries/server/index.ts @@ -17,9 +17,5 @@ * under the License. */ -import { PluginInitializerContext } from 'kibana/server'; -import { MetricsServerPlugin as Plugin } from './plugin'; - -export function plugin(initializerContext: PluginInitializerContext) { - return new Plugin(initializerContext); -} +export { init } from './init'; +export { getVisData, GetVisData, GetVisDataOptions } from './lib/get_vis_data'; diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/plugin.ts b/src/legacy/core_plugins/vis_type_timeseries/server/init.ts similarity index 59% rename from src/legacy/core_plugins/vis_type_timeseries/server/plugin.ts rename to src/legacy/core_plugins/vis_type_timeseries/server/init.ts index ce4ab64ffa07a0..7b42ae8098016d 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/server/plugin.ts +++ b/src/legacy/core_plugins/vis_type_timeseries/server/init.ts @@ -17,9 +17,6 @@ * under the License. */ -import { Legacy } from 'kibana'; -import { PluginInitializerContext, CoreSetup } from 'kibana/server'; - // @ts-ignore import { fieldsRoutes } from './routes/fields'; // @ts-ignore @@ -28,30 +25,15 @@ import { visDataRoutes } from './routes/vis'; import { SearchStrategiesRegister } from './lib/search_strategies/search_strategies_register'; // @ts-ignore import { getVisData } from './lib/get_vis_data'; +import { Framework } from '../../../../plugins/vis_type_timeseries/server'; -// TODO: Remove as CoreSetup is completed. -export interface CustomCoreSetup { - http: { - server: Legacy.Server; - }; -} - -export class MetricsServerPlugin { - public initializerContext: PluginInitializerContext; - - constructor(initializerContext: PluginInitializerContext) { - this.initializerContext = initializerContext; - } - - public setup(core: CoreSetup & CustomCoreSetup) { - const { http } = core; - - fieldsRoutes(http.server); - visDataRoutes(http.server); +export const init = async (framework: Framework, __LEGACY: any) => { + const { core } = framework; + const router = core.http.createRouter(); - // Expose getVisData to allow plugins to use TSVB's backend for metrics - http.server.expose('getVisData', getVisData); + visDataRoutes(router, framework); - SearchStrategiesRegister.init(http.server); - } -} + // [LEGACY_TODO] + fieldsRoutes(__LEGACY.server); + SearchStrategiesRegister.init(__LEGACY.server); +}; diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_vis_data.ts b/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_vis_data.ts new file mode 100644 index 00000000000000..58e624fa134429 --- /dev/null +++ b/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_vis_data.ts @@ -0,0 +1,101 @@ +/* + * 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 { RequestHandlerContext } from 'src/core/server'; +import _ from 'lodash'; +import { first, map } from 'rxjs/operators'; +import { getPanelData } from './vis_data/get_panel_data'; +import { Framework } from '../../../../../plugins/vis_type_timeseries/server'; + +interface GetVisDataResponse { + [key: string]: GetVisDataPanel; +} + +interface GetVisDataPanel { + id: string; + series: GetVisDataSeries[]; +} + +interface GetVisDataSeries { + id: string; + label: string; + data: GetVisDataDataPoint[]; +} + +type GetVisDataDataPoint = [number, number]; + +export interface GetVisDataOptions { + timerange?: any; + panels?: any; + filters?: any; + state?: any; + query?: any; +} + +export type GetVisData = ( + requestContext: RequestHandlerContext, + options: GetVisDataOptions, + framework: Framework +) => Promise; + +export function getVisData( + requestContext: RequestHandlerContext, + options: GetVisDataOptions, + framework: Framework +): Promise { + // NOTE / TODO: This facade has been put in place to make migrating to the New Platform easier. It + // removes the need to refactor many layers of dependencies on "req", and instead just augments the top + // level object passed from here. The layers should be refactored fully at some point, but for now + // this works and we are still using the New Platform services for these vis data portions. + const reqFacade: any = { + payload: options, + getUiSettingsService: () => requestContext.core.uiSettings.client, + getSavedObjectsClient: () => requestContext.core.savedObjects.client, + server: { + plugins: { + elasticsearch: { + getCluster: () => { + return { + callWithRequest: async (req: any, endpoint: string, params: any) => { + return await requestContext.core.elasticsearch.dataClient.callAsCurrentUser( + endpoint, + params + ); + }, + }; + }, + }, + }, + }, + getEsShardTimeout: async () => { + return await framework.globalConfig$ + .pipe( + first(), + map(config => config.elasticsearch.shardTimeout.asMilliseconds()) + ) + .toPromise(); + }, + }; + const promises = reqFacade.payload.panels.map(getPanelData(reqFacade)); + return Promise.all(promises).then(res => { + return res.reduce((acc, data) => { + return _.assign(acc as any, data); + }, {}); + }) as Promise; +} diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/__tests__/helpers/get_es_shard_timeout.js b/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/__tests__/helpers/get_es_shard_timeout.js index 2b53fc5a93b7b8..b19f6a32415971 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/__tests__/helpers/get_es_shard_timeout.js +++ b/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/__tests__/helpers/get_es_shard_timeout.js @@ -17,20 +17,14 @@ * under the License. */ -import moment from 'moment'; -import { of } from 'rxjs'; import { expect } from 'chai'; import { getEsShardTimeout } from '../../helpers/get_es_shard_timeout'; describe('getEsShardTimeout', () => { it('should return the elasticsearch.shardTimeout', async () => { const req = { - server: { - newPlatform: { - __internals: { - elasticsearch: { legacy: { config$: of({ shardTimeout: moment.duration(12345) }) } }, - }, - }, + getEsShardTimeout: async () => { + return 12345; }, }; diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_vis_data.js b/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.d.ts similarity index 71% rename from src/legacy/core_plugins/vis_type_timeseries/server/lib/get_vis_data.js rename to src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.d.ts index 055d4477825c7d..2f86236fefedcb 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_vis_data.js +++ b/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_panel_data.d.ts @@ -17,14 +17,4 @@ * under the License. */ -import _ from 'lodash'; -import { getPanelData } from './vis_data/get_panel_data'; - -export function getVisData(req) { - const promises = req.payload.panels.map(getPanelData(req)); - return Promise.all(promises).then(res => { - return res.reduce((acc, data) => { - return _.assign(acc, data); - }, {}); - }); -} +export function getPanelData(req: any): any; diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js b/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js index e3745bd6963e0e..b4eb9e6b108ff7 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js +++ b/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.js @@ -48,7 +48,6 @@ export async function getSeriesData(req, panel) { const data = await searchRequest.search(searches); const series = data.map(handleResponseBody(panel)); - let annotations = null; if (panel.annotations && panel.annotations.length) { diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.js b/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.js index c8acfa730af671..4eb3075e9b658d 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.js +++ b/src/legacy/core_plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_shard_timeout.js @@ -16,13 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { first, map } from 'rxjs/operators'; export async function getEsShardTimeout(req) { - return await req.server.newPlatform.__internals.elasticsearch.legacy.config$ - .pipe( - first(), - map(config => config.shardTimeout.asMilliseconds()) - ) - .toPromise(); + return await req.getEsShardTimeout(); } diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/routes/vis.js b/src/legacy/core_plugins/vis_type_timeseries/server/routes/vis.js index 15ff7b9a6c90b1..d2ded81309ffab 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/server/routes/vis.js +++ b/src/legacy/core_plugins/vis_type_timeseries/server/routes/vis.js @@ -17,23 +17,28 @@ * under the License. */ +import { schema } from '@kbn/config-schema'; import { getVisData } from '../lib/get_vis_data'; -import Boom from 'boom'; -export const visDataRoutes = server => { - server.route({ - path: '/api/metrics/vis/data', - method: 'POST', - handler: async req => { - try { - return await getVisData(req); - } catch (err) { - if (err.isBoom && err.status === 401) { - return err; - } +const escapeHatch = schema.object({}, { allowUnknowns: true }); - throw Boom.boomify(err, { statusCode: 500 }); - } +export const visDataRoutes = (router, framework) => { + router.post( + { + path: '/api/metrics/vis/data', + validate: { + body: escapeHatch, + }, }, - }); + async (requestContext, request, response) => { + try { + const results = await getVisData(requestContext, request.body, framework); + return response.ok({ body: results }); + } catch (error) { + return response.internalError({ + body: error.message, + }); + } + } + ); }; diff --git a/src/plugins/vis_type_timeseries/kibana.json b/src/plugins/vis_type_timeseries/kibana.json new file mode 100644 index 00000000000000..f9a368e85ed491 --- /dev/null +++ b/src/plugins/vis_type_timeseries/kibana.json @@ -0,0 +1,6 @@ +{ + "id": "metrics", + "version": "8.0.0", + "kibanaVersion": "kibana", + "server": true +} \ No newline at end of file diff --git a/src/plugins/vis_type_timeseries/server/index.ts b/src/plugins/vis_type_timeseries/server/index.ts new file mode 100644 index 00000000000000..599726612a936a --- /dev/null +++ b/src/plugins/vis_type_timeseries/server/index.ts @@ -0,0 +1,35 @@ +/* + * 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'; +import { PluginInitializerContext } from 'src/core/server'; +import { VisTypeTimeseriesPlugin } from './plugin'; +export { VisTypeTimeseriesSetup, Framework } from './plugin'; + +export const config = { + schema: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), +}; + +export type VisTypeTimeseriesConfig = TypeOf; + +export function plugin(initializerContext: PluginInitializerContext) { + return new VisTypeTimeseriesPlugin(initializerContext); +} diff --git a/src/plugins/vis_type_timeseries/server/plugin.ts b/src/plugins/vis_type_timeseries/server/plugin.ts new file mode 100644 index 00000000000000..f508aa250454fa --- /dev/null +++ b/src/plugins/vis_type_timeseries/server/plugin.ts @@ -0,0 +1,96 @@ +/* + * 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 { + PluginInitializerContext, + CoreSetup, + CoreStart, + Plugin, + RequestHandlerContext, + Logger, +} from 'src/core/server'; +import { Observable } from 'rxjs'; +import { Server } from 'hapi'; +import { once } from 'lodash'; +import { VisTypeTimeseriesConfig } from '.'; +import { + init, + getVisData, + GetVisData, + GetVisDataOptions, +} from '../../../legacy/core_plugins/vis_type_timeseries/server'; + +export interface LegacySetup { + server: Server; +} + +export interface VisTypeTimeseriesSetup { + /** @deprecated */ + __legacy: { + config$: Observable; + registerLegacyAPI: (__LEGACY: LegacySetup) => void; + }; + getVisData: ( + requestContext: RequestHandlerContext, + options: GetVisDataOptions + ) => ReturnType; +} + +export interface Framework { + core: CoreSetup; + plugins: any; + config$: Observable; + globalConfig$: PluginInitializerContext['config']['legacy']['globalConfig$']; + logger: Logger; +} + +export class VisTypeTimeseriesPlugin implements Plugin { + constructor(private readonly initializerContext: PluginInitializerContext) { + this.initializerContext = initializerContext; + } + + public setup(core: CoreSetup, plugins: any) { + const logger = this.initializerContext.logger.get('visTypeTimeseries'); + const config$ = this.initializerContext.config.create(); + // Global config contains things like the ES shard timeout + const globalConfig$ = this.initializerContext.config.legacy.globalConfig$; + + const framework: Framework = { + core, + plugins, + config$, + globalConfig$, + logger, + }; + + return { + __legacy: { + config$, + registerLegacyAPI: once((__LEGACY: LegacySetup) => { + init(framework, __LEGACY); + }), + }, + getVisData: async (requestContext: RequestHandlerContext, options: GetVisDataOptions) => { + return await getVisData(requestContext, options, framework); + }, + }; + } + + public start(core: CoreStart) {} +} diff --git a/x-pack/legacy/plugins/infra/index.ts b/x-pack/legacy/plugins/infra/index.ts index 38661f430c4020..e03b91c58f4a39 100644 --- a/x-pack/legacy/plugins/infra/index.ts +++ b/x-pack/legacy/plugins/infra/index.ts @@ -16,6 +16,7 @@ import { plugin, InfraServerPluginDeps } from './server/new_platform_index'; import { InfraSetup } from '../../../plugins/infra/server'; import { PluginSetupContract as FeaturesPluginSetup } from '../../../plugins/features/server'; import { SpacesPluginSetup } from '../../../plugins/spaces/server'; +import { VisTypeTimeseriesSetup } from '../../../../src/plugins/vis_type_timeseries/server'; import { APMPluginContract } from '../../../plugins/apm/server'; const APP_ID = 'infra'; @@ -92,19 +93,9 @@ export function infra(kibana: any) { indexPatterns: { indexPatternsServiceFactory: legacyServer.indexPatternsServiceFactory, }, - metrics: legacyServer.plugins.metrics, + metrics: plugins.metrics as VisTypeTimeseriesSetup, spaces: plugins.spaces as SpacesPluginSetup, features: plugins.features as FeaturesPluginSetup, - // NP_NOTE: [TSVB_GROUP] Huge hack to make TSVB (getVisData()) work with raw requests that - // originate from the New Platform router (and are very different to the old request object). - // Once TSVB has migrated over to NP, and can work with the new raw requests, or ideally just - // the requestContext, this can be removed. - ___legacy: { - tsvb: { - elasticsearch: legacyServer.plugins.elasticsearch, - __internals: legacyServer.newPlatform.__internals, - }, - }, apm: plugins.apm as APMPluginContract, }; diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts b/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts index 17054cc43fd3f9..019472e7be2731 100644 --- a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts +++ b/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts @@ -11,21 +11,19 @@ import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { RouteMethod, RouteConfig } from '../../../../../../../../src/core/server'; import { PluginSetupContract as FeaturesPluginSetup } from '../../../../../../../plugins/features/server'; import { SpacesPluginSetup } from '../../../../../../../plugins/spaces/server'; +import { VisTypeTimeseriesSetup } from '../../../../../../../../src/plugins/vis_type_timeseries/server'; import { APMPluginContract } from '../../../../../../../plugins/apm/server'; // NP_TODO: Compose real types from plugins we depend on, no "any" export interface InfraServerPluginDeps { spaces: SpacesPluginSetup; usageCollection: UsageCollectionSetup; - metrics: { - getVisData: any; - }; + metrics: VisTypeTimeseriesSetup; indexPatterns: { indexPatternsServiceFactory: any; }; features: FeaturesPluginSetup; apm: APMPluginContract; - ___legacy: any; } export interface CallWithRequestParams extends GenericParams { diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts index b0cdb8389cb290..d7dd4ed1c82a42 100644 --- a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts @@ -36,12 +36,10 @@ import { InfraConfig } from '../../../../../../../plugins/infra/server'; export class KibanaFramework { public router: IRouter; - private core: CoreSetup; public plugins: InfraServerPluginDeps; constructor(core: CoreSetup, config: InfraConfig, plugins: InfraServerPluginDeps) { this.router = core.http.createRouter(); - this.core = core; this.plugins = plugins; } @@ -246,45 +244,21 @@ export class KibanaFramework { } } - // NP_TODO: [TSVB_GROUP] This method needs fixing when the metrics plugin has migrated to the New Platform public async makeTSVBRequest( - request: KibanaRequest, + requestContext: RequestHandlerContext, model: TSVBMetricModel, timerange: { min: number; max: number }, - filters: any[], - requestContext: RequestHandlerContext + filters: any[] ): Promise { const { getVisData } = this.plugins.metrics; if (typeof getVisData !== 'function') { throw new Error('TSVB is not available'); } - const url = this.core.http.basePath.prepend('/api/metrics/vis/data'); - // For the following request we need a copy of the instnace of the internal request - // but modified for our TSVB request. This will ensure all the instance methods - // are available along with our overriden values - const requestCopy = Object.assign({}, request, { - url, - method: 'POST', - payload: { - timerange, - panels: [model], - filters, - }, - // NP_NOTE: [TSVB_GROUP] Huge hack to make TSVB (getVisData()) work with raw requests that - // originate from the New Platform router (and are very different to the old request object). - // Once TSVB has migrated over to NP, and can work with the new raw requests, or ideally just - // the requestContext, this can be removed. - server: { - plugins: { - elasticsearch: this.plugins.___legacy.tsvb.elasticsearch, - }, - newPlatform: { - __internals: this.plugins.___legacy.tsvb.__internals, - }, - }, - getUiSettingsService: () => requestContext.core.uiSettings.client, - getSavedObjectsClient: () => requestContext.core.savedObjects.client, - }); - return getVisData(requestCopy); + const options = { + timerange, + panels: [model], + filters, + }; + return getVisData(requestContext, options); } } diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts b/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts index c1b567576c2149..6acb8afbfb2491 100644 --- a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts +++ b/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts @@ -47,7 +47,7 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter { } const requests = options.metrics.map(metricId => - this.makeTSVBRequest(metricId, options, rawRequest, nodeField, requestContext) + this.makeTSVBRequest(metricId, options, nodeField, requestContext) ); return Promise.all(requests) @@ -89,7 +89,6 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter { async makeTSVBRequest( metricId: InfraMetric, options: InfraMetricsRequestOptions, - req: KibanaRequest, nodeField: string, requestContext: RequestHandlerContext ) { @@ -150,6 +149,6 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter { ? [{ match: { [model.map_field_to]: id } }] : [{ match: { [nodeField]: id } }]; - return this.framework.makeTSVBRequest(req, model, timerange, filters, requestContext); + return this.framework.makeTSVBRequest(requestContext, model, timerange, filters); } } diff --git a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts b/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts index 3dfbfbb5c39797..17fc46b41278af 100644 --- a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts +++ b/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts @@ -76,13 +76,7 @@ export const populateSeriesWithTSVBData = ( } // Get TSVB results using the model, timerange and filters - const tsvbResults = await framework.makeTSVBRequest( - request, - model, - timerange, - filters, - requestContext - ); + const tsvbResults = await framework.makeTSVBRequest(requestContext, model, timerange, filters); // If there is no data `custom` will not exist. if (!tsvbResults.custom) {