Fix logstash integration with monitoring (#65165)

This commit is contained in:
Josh Dover 2020-05-06 10:42:07 -06:00 committed by GitHub
parent 46b91cc9fd
commit 5f314227d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View file

@ -9,6 +9,7 @@
], ],
"optionalPlugins": [ "optionalPlugins": [
"home", "home",
"monitoring",
"security" "security"
], ],
"server": true, "server": true,

View file

@ -31,16 +31,12 @@ import * as Breadcrumbs from './breadcrumbs';
export const renderApp = async ( export const renderApp = async (
core: CoreStart, core: CoreStart,
{ basePath, element, setBreadcrumbs }: ManagementAppMountParams, { basePath, element, setBreadcrumbs }: ManagementAppMountParams,
isMonitoringEnabled: boolean,
licenseService$: Observable<any> licenseService$: Observable<any>
) => { ) => {
const logstashLicenseService = await licenseService$.pipe(first()).toPromise(); const logstashLicenseService = await licenseService$.pipe(first()).toPromise();
const clusterService = new ClusterService(core.http); const clusterService = new ClusterService(core.http);
const monitoringService = new MonitoringService( const monitoringService = new MonitoringService(core.http, isMonitoringEnabled, clusterService);
core.http,
// When monitoring is migrated this should be fetched from monitoring's plugin contract
core.injectedMetadata.getInjectedVar('monitoringUiEnabled'),
clusterService
);
const pipelinesService = new PipelinesService(core.http, monitoringService); const pipelinesService = new PipelinesService(core.http, monitoringService);
const pipelineService = new PipelineService(core.http, pipelinesService); const pipelineService = new PipelineService(core.http, pipelinesService);
const upgradeService = new UpgradeService(core.http); const upgradeService = new UpgradeService(core.http);

View file

@ -49,8 +49,9 @@ export class LogstashPlugin implements Plugin<void, void, SetupDeps> {
mount: async params => { mount: async params => {
const [coreStart] = await core.getStartServices(); const [coreStart] = await core.getStartServices();
const { renderApp } = await import('./application'); const { renderApp } = await import('./application');
const isMonitoringEnabled = 'monitoring' in plugins;
return renderApp(coreStart, params, logstashLicense$); return renderApp(coreStart, params, isMonitoringEnabled, logstashLicense$);
}, },
}); });

View file

@ -9,14 +9,14 @@ import { ROUTES, MONITORING } from '../../../common/constants';
import { PipelineListItem } from '../../models/pipeline_list_item'; import { PipelineListItem } from '../../models/pipeline_list_item';
export class MonitoringService { export class MonitoringService {
constructor(http, monitoringUiEnabled, clusterService) { constructor(http, isMonitoringEnabled, clusterService) {
this.http = http; this.http = http;
this.monitoringUiEnabled = monitoringUiEnabled; this._isMonitoringEnabled = isMonitoringEnabled;
this.clusterService = clusterService; this.clusterService = clusterService;
} }
isMonitoringEnabled() { isMonitoringEnabled() {
return this.monitoringUiEnabled; return this._isMonitoringEnabled;
} }
getPipelineList() { getPipelineList() {
@ -27,6 +27,8 @@ export class MonitoringService {
return this.clusterService return this.clusterService
.loadCluster() .loadCluster()
.then(cluster => { .then(cluster => {
// This API call should live within the Monitoring plugin
// https://github.com/elastic/kibana/issues/63931
const url = `${ROUTES.MONITORING_API_ROOT}/v1/clusters/${cluster.uuid}/logstash/pipeline_ids`; const url = `${ROUTES.MONITORING_API_ROOT}/v1/clusters/${cluster.uuid}/logstash/pipeline_ids`;
const now = moment.utc(); const now = moment.utc();
const body = JSON.stringify({ const body = JSON.stringify({