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": [
"home",
"monitoring",
"security"
],
"server": true,

View file

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

View file

@ -49,8 +49,9 @@ export class LogstashPlugin implements Plugin<void, void, SetupDeps> {
mount: async params => {
const [coreStart] = await core.getStartServices();
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';
export class MonitoringService {
constructor(http, monitoringUiEnabled, clusterService) {
constructor(http, isMonitoringEnabled, clusterService) {
this.http = http;
this.monitoringUiEnabled = monitoringUiEnabled;
this._isMonitoringEnabled = isMonitoringEnabled;
this.clusterService = clusterService;
}
isMonitoringEnabled() {
return this.monitoringUiEnabled;
return this._isMonitoringEnabled;
}
getPipelineList() {
@ -27,6 +27,8 @@ export class MonitoringService {
return this.clusterService
.loadCluster()
.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 now = moment.utc();
const body = JSON.stringify({