Skip to content

Commit

Permalink
[Logs+] Remove configurable redirects to Discover (#167151)
Browse files Browse the repository at this point in the history
## Summary

Closes #165227.

Removes configurable app targets. Only the standard logs app is
registered (Note: [Infra is disabled in
serverless](#165289) observability
/ security projects currently).

---------

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
Kerry350 and kibanamachine authored Sep 27, 2023
1 parent 1b9993e commit b2271a9
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 221 deletions.
1 change: 0 additions & 1 deletion config/serverless.oblt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ xpack.legacy_uptime.enabled: false
xpack.serverless.observability.enabled: true

## Configure plugins
xpack.infra.logs.app_target: discover

## Set the home route
uiSettings.overrides.defaultRoute: /app/observability/landing
Expand Down
5 changes: 0 additions & 5 deletions test/plugin_functional/test_suites/core_plugins/rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
'xpack.index_management.dev.enableIndexDetailsPage (boolean)',
'xpack.index_management.enableIndexStats (any)',
'xpack.infra.sources.default.fields.message (array)',
/**
* xpack.infra.logs is conditional and will resolve to an object of properties
* - xpack.infra.logs.app_target (string)
*/
'xpack.infra.logs (any)',
'xpack.license_management.ui.enabled (boolean)',
'xpack.maps.preserveDrawingBuffer (boolean)',
'xpack.maps.showMapsInspectorAdapter (boolean)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

import type {
NodeLogsLocator,
DiscoverNodeLogsLocator,
LogsLocator,
DiscoverLogsLocator,
} from '@kbn/infra-plugin/common/locators';
import { AllDatasetsLocatorParams } from '@kbn/deeplinks-observability/locators';
import { LocatorPublic } from '@kbn/share-plugin/common';
Expand All @@ -29,7 +27,7 @@ export const getNodeLogsHref = (
id: string,
time: number | undefined,
allDatasetsLocator: LocatorPublic<AllDatasetsLocatorParams>,
infraNodeLocator?: NodeLogsLocator | DiscoverNodeLogsLocator
infraNodeLocator?: NodeLogsLocator
): string => {
if (infraNodeLocator)
return infraNodeLocator?.getRedirectUrl({
Expand All @@ -55,7 +53,7 @@ export const getTraceLogsHref = (
traceId: string,
time: number | undefined,
allDatasetsLocator: LocatorPublic<AllDatasetsLocatorParams>,
infraLogsLocator?: LogsLocator | DiscoverLogsLocator
infraLogsLocator?: LogsLocator
): string => {
const query = `trace.id:"${traceId}" OR (not trace.id:* AND "${traceId}")`;

Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/infra/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ export const HOST_FIELD = 'host.name';
export const CONTAINER_FIELD = 'container.id';
export const POD_FIELD = 'kubernetes.pod.uid';

export const DISCOVER_APP_TARGET = 'discover';
export const LOGS_APP_TARGET = 'logs-ui';

export const O11Y_AAD_FIELDS = [
'cloud.*',
'host.*',
Expand Down
27 changes: 0 additions & 27 deletions x-pack/plugins/infra/common/locators/discover_logs_locator.ts

This file was deleted.

32 changes: 0 additions & 32 deletions x-pack/plugins/infra/common/locators/discover_node_logs_locator.ts

This file was deleted.

8 changes: 2 additions & 6 deletions x-pack/plugins/infra/common/locators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* 2.0.
*/

import type { DiscoverLogsLocator } from './discover_logs_locator';
import type { DiscoverNodeLogsLocator } from './discover_node_logs_locator';
import type { LogsLocator } from './logs_locator';
import type { NodeLogsLocator } from './node_logs_locator';

export * from './discover_logs_locator';
export * from './discover_node_logs_locator';
export * from './logs_locator';
export * from './node_logs_locator';

export interface InfraLocators {
logsLocator: LogsLocator | DiscoverLogsLocator;
nodeLogsLocator: NodeLogsLocator | DiscoverNodeLogsLocator;
logsLocator: LogsLocator;
nodeLogsLocator: NodeLogsLocator;
}
4 changes: 0 additions & 4 deletions x-pack/plugins/infra/common/plugin_config_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ export interface InfraConfig {
inventory: {
compositeSize: number;
};
logs: {
app_target: 'logs-ui' | 'discover';
};
sources?: {
default?: {
fields?: {
Expand All @@ -32,7 +29,6 @@ export interface InfraConfig {

export const publicConfigKeys = {
sources: true,
logs: true,
} as const;

export type InfraPublicConfigKey = keyof {
Expand Down
30 changes: 0 additions & 30 deletions x-pack/plugins/infra/public/apps/discover_app.tsx

This file was deleted.

130 changes: 49 additions & 81 deletions x-pack/plugins/infra/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import {
AppMountParameters,
AppNavLinkStatus,
AppUpdater,
CoreStart,
DEFAULT_APP_CATEGORIES,
Expand All @@ -18,7 +17,6 @@ import { enableInfrastructureHostsView } from '@kbn/observability-plugin/public'
import { ObservabilityTriggerId } from '@kbn/observability-shared-plugin/common';
import { BehaviorSubject, combineLatest, from } from 'rxjs';
import { map } from 'rxjs/operators';
import { DISCOVER_APP_TARGET, LOGS_APP_TARGET } from '../common/constants';
import { InfraPublicConfig } from '../common/plugin_config_types';
import { createInventoryMetricRuleType } from './alerting/inventory';
import { createLogThresholdRuleType } from './alerting/log_threshold';
Expand All @@ -29,8 +27,6 @@ import { createLazyPodMetricsTable } from './components/infrastructure_node_metr
import { LOG_STREAM_EMBEDDABLE } from './components/log_stream/log_stream_embeddable';
import { LogStreamEmbeddableFactoryDefinition } from './components/log_stream/log_stream_embeddable_factory';
import {
DiscoverLogsLocatorDefinition,
DiscoverNodeLogsLocatorDefinition,
InfraLocators,
LogsLocatorDefinition,
NodeLogsLocatorDefinition,
Expand All @@ -57,7 +53,6 @@ export class Plugin implements InfraClientPluginClass {
private metricsExplorerViews: MetricsExplorerViewsService;
private telemetry: TelemetryService;
private locators?: InfraLocators;
private appTarget: string;
private kibanaVersion: string;
private readonly appUpdater$ = new BehaviorSubject<AppUpdater>(() => ({}));

Expand All @@ -67,7 +62,6 @@ export class Plugin implements InfraClientPluginClass {
this.inventoryViews = new InventoryViewsService();
this.metricsExplorerViews = new MetricsExplorerViewsService();
this.telemetry = new TelemetryService();
this.appTarget = this.config.logs.app_target;
this.kibanaVersion = context.env.packageInfo.version;
}

Expand Down Expand Up @@ -163,89 +157,63 @@ export class Plugin implements InfraClientPluginClass {
);

// Register Locators
let logsLocator = pluginsSetup.share.url.locators.create(new LogsLocatorDefinition({ core }));
let nodeLogsLocator = pluginsSetup.share.url.locators.create(
const logsLocator = pluginsSetup.share.url.locators.create(new LogsLocatorDefinition({ core }));
const nodeLogsLocator = pluginsSetup.share.url.locators.create(
new NodeLogsLocatorDefinition({ core })
);

if (this.appTarget === DISCOVER_APP_TARGET) {
// Register Locators
logsLocator = pluginsSetup.share.url.locators.create(
new DiscoverLogsLocatorDefinition({ core })
);
nodeLogsLocator = pluginsSetup.share.url.locators.create(
new DiscoverNodeLogsLocatorDefinition({ core })
);

core.application.register({
id: 'logs-to-discover',
title: '',
navLinkStatus: AppNavLinkStatus.hidden,
appRoute: '/app/logs',
mount: async (params: AppMountParameters) => {
// mount callback should not use setup dependencies, get start dependencies instead
const [coreStart, , pluginStart] = await core.getStartServices();
const { renderApp } = await import('./apps/discover_app');

return renderApp(coreStart, pluginStart, params);
},
});
}

pluginsSetup.observability.observabilityRuleTypeRegistry.register(
createLogThresholdRuleType(core, logsLocator)
);

if (this.appTarget === LOGS_APP_TARGET) {
core.application.register({
id: 'logs',
title: i18n.translate('xpack.infra.logs.pluginTitle', {
defaultMessage: 'Logs',
}),
euiIconType: 'logoObservability',
order: 8100,
appRoute: '/app/logs',
// !! Need to be kept in sync with the routes in x-pack/plugins/infra/public/pages/logs/page_content.tsx
deepLinks: [
{
id: 'stream',
title: i18n.translate('xpack.infra.logs.index.streamTabTitle', {
defaultMessage: 'Stream',
}),
path: '/stream',
},
{
id: 'anomalies',
title: i18n.translate('xpack.infra.logs.index.anomaliesTabTitle', {
defaultMessage: 'Anomalies',
}),
path: '/anomalies',
},
{
id: 'log-categories',
title: i18n.translate('xpack.infra.logs.index.logCategoriesBetaBadgeTitle', {
defaultMessage: 'Categories',
}),
path: '/log-categories',
},
{
id: 'settings',
title: i18n.translate('xpack.infra.logs.index.settingsTabTitle', {
defaultMessage: 'Settings',
}),
path: '/settings',
},
],
category: DEFAULT_APP_CATEGORIES.observability,
mount: async (params: AppMountParameters) => {
// mount callback should not use setup dependencies, get start dependencies instead
const [coreStart, plugins, pluginStart] = await core.getStartServices();

const { renderApp } = await import('./apps/logs_app');
return renderApp(coreStart, plugins, pluginStart, params);
core.application.register({
id: 'logs',
title: i18n.translate('xpack.infra.logs.pluginTitle', {
defaultMessage: 'Logs',
}),
euiIconType: 'logoObservability',
order: 8100,
appRoute: '/app/logs',
// !! Need to be kept in sync with the routes in x-pack/plugins/infra/public/pages/logs/page_content.tsx
deepLinks: [
{
id: 'stream',
title: i18n.translate('xpack.infra.logs.index.streamTabTitle', {
defaultMessage: 'Stream',
}),
path: '/stream',
},
});
}
{
id: 'anomalies',
title: i18n.translate('xpack.infra.logs.index.anomaliesTabTitle', {
defaultMessage: 'Anomalies',
}),
path: '/anomalies',
},
{
id: 'log-categories',
title: i18n.translate('xpack.infra.logs.index.logCategoriesBetaBadgeTitle', {
defaultMessage: 'Categories',
}),
path: '/log-categories',
},
{
id: 'settings',
title: i18n.translate('xpack.infra.logs.index.settingsTabTitle', {
defaultMessage: 'Settings',
}),
path: '/settings',
},
],
category: DEFAULT_APP_CATEGORIES.observability,
mount: async (params: AppMountParameters) => {
// mount callback should not use setup dependencies, get start dependencies instead
const [coreStart, plugins, pluginStart] = await core.getStartServices();

const { renderApp } = await import('./apps/logs_app');
return renderApp(coreStart, plugins, pluginStart, params);
},
});

// !! Need to be kept in sync with the routes in x-pack/plugins/infra/public/pages/metrics/index.tsx
const infraDeepLinks = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ const createMockStaticConfiguration = (sources: any) => ({
inventory: {
compositeSize: 2000,
},
logs: {
app_target: 'logs-ui',
},
sources,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1899,9 +1899,6 @@ const createMockStaticConfiguration = (sources: any): InfraConfig => ({
inventory: {
compositeSize: 2000,
},
logs: {
app_target: 'logs-ui',
},
enabled: true,
sources,
});
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/infra/server/lib/sources/sources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ const createMockStaticConfiguration = (sources: any): InfraConfig => ({
inventory: {
compositeSize: 2000,
},
logs: {
app_target: 'logs-ui',
},
sources,
enabled: true,
});
Expand Down
Loading

0 comments on commit b2271a9

Please sign in to comment.