Skip to content

Commit 5f31422

Browse files
authored
Fix logstash integration with monitoring (#65165)
1 parent 46b91cc commit 5f31422

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

x-pack/plugins/logstash/kibana.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
],
1010
"optionalPlugins": [
1111
"home",
12+
"monitoring",
1213
"security"
1314
],
1415
"server": true,

x-pack/plugins/logstash/public/application/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,12 @@ import * as Breadcrumbs from './breadcrumbs';
3131
export const renderApp = async (
3232
core: CoreStart,
3333
{ basePath, element, setBreadcrumbs }: ManagementAppMountParams,
34+
isMonitoringEnabled: boolean,
3435
licenseService$: Observable<any>
3536
) => {
3637
const logstashLicenseService = await licenseService$.pipe(first()).toPromise();
3738
const clusterService = new ClusterService(core.http);
38-
const monitoringService = new MonitoringService(
39-
core.http,
40-
// When monitoring is migrated this should be fetched from monitoring's plugin contract
41-
core.injectedMetadata.getInjectedVar('monitoringUiEnabled'),
42-
clusterService
43-
);
39+
const monitoringService = new MonitoringService(core.http, isMonitoringEnabled, clusterService);
4440
const pipelinesService = new PipelinesService(core.http, monitoringService);
4541
const pipelineService = new PipelineService(core.http, pipelinesService);
4642
const upgradeService = new UpgradeService(core.http);

x-pack/plugins/logstash/public/plugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ export class LogstashPlugin implements Plugin<void, void, SetupDeps> {
4949
mount: async params => {
5050
const [coreStart] = await core.getStartServices();
5151
const { renderApp } = await import('./application');
52+
const isMonitoringEnabled = 'monitoring' in plugins;
5253

53-
return renderApp(coreStart, params, logstashLicense$);
54+
return renderApp(coreStart, params, isMonitoringEnabled, logstashLicense$);
5455
},
5556
});
5657

x-pack/plugins/logstash/public/services/monitoring/monitoring_service.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import { ROUTES, MONITORING } from '../../../common/constants';
99
import { PipelineListItem } from '../../models/pipeline_list_item';
1010

1111
export class MonitoringService {
12-
constructor(http, monitoringUiEnabled, clusterService) {
12+
constructor(http, isMonitoringEnabled, clusterService) {
1313
this.http = http;
14-
this.monitoringUiEnabled = monitoringUiEnabled;
14+
this._isMonitoringEnabled = isMonitoringEnabled;
1515
this.clusterService = clusterService;
1616
}
1717

1818
isMonitoringEnabled() {
19-
return this.monitoringUiEnabled;
19+
return this._isMonitoringEnabled;
2020
}
2121

2222
getPipelineList() {
@@ -27,6 +27,8 @@ export class MonitoringService {
2727
return this.clusterService
2828
.loadCluster()
2929
.then(cluster => {
30+
// This API call should live within the Monitoring plugin
31+
// https://github.com/elastic/kibana/issues/63931
3032
const url = `${ROUTES.MONITORING_API_ROOT}/v1/clusters/${cluster.uuid}/logstash/pipeline_ids`;
3133
const now = moment.utc();
3234
const body = JSON.stringify({

0 commit comments

Comments
 (0)