Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logstash integration with monitoring #65165

Merged
merged 2 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/plugins/logstash/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
],
"optionalPlugins": [
"home",
"monitoring",
"security"
],
"server": true,
Expand Down
8 changes: 2 additions & 6 deletions x-pack/plugins/logstash/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/logstash/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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$);
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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({
Expand Down