mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Logs+] Remove configurable redirects to Discover (#167151)
## Summary Closes https://github.com/elastic/kibana/issues/165227. Removes configurable app targets. Only the standard logs app is registered (Note: [Infra is disabled in serverless](https://github.com/elastic/kibana/pull/165289) observability / security projects currently). --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
1b9993eb07
commit
b2271a9fd7
14 changed files with 55 additions and 221 deletions
|
@ -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
|
||||
|
|
|
@ -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)',
|
||||
|
|
|
@ -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';
|
||||
|
@ -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({
|
||||
|
@ -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}")`;
|
||||
|
||||
|
|
|
@ -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.*',
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/public';
|
||||
import type { LogsLocatorDependencies, LogsLocatorParams } from './logs_locator';
|
||||
import { LOGS_LOCATOR_ID } from './logs_locator';
|
||||
|
||||
export type DiscoverLogsLocator = LocatorPublic<LogsLocatorParams>;
|
||||
|
||||
export class DiscoverLogsLocatorDefinition implements LocatorDefinition<LogsLocatorParams> {
|
||||
public readonly id = LOGS_LOCATOR_ID;
|
||||
|
||||
constructor(protected readonly deps: LogsLocatorDependencies) {}
|
||||
|
||||
public readonly getLocation = async (params: LogsLocatorParams) => {
|
||||
const { getLocationToDiscover } = await import('./helpers');
|
||||
|
||||
return getLocationToDiscover({
|
||||
core: this.deps.core,
|
||||
...params,
|
||||
});
|
||||
};
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/public';
|
||||
import type { NodeLogsLocatorDependencies, NodeLogsLocatorParams } from './node_logs_locator';
|
||||
import { NODE_LOGS_LOCATOR_ID } from './node_logs_locator';
|
||||
|
||||
export type DiscoverNodeLogsLocator = LocatorPublic<NodeLogsLocatorParams>;
|
||||
|
||||
export class DiscoverNodeLogsLocatorDefinition implements LocatorDefinition<NodeLogsLocatorParams> {
|
||||
public readonly id = NODE_LOGS_LOCATOR_ID;
|
||||
|
||||
constructor(protected readonly deps: NodeLogsLocatorDependencies) {}
|
||||
|
||||
public readonly getLocation = async (params: NodeLogsLocatorParams) => {
|
||||
const { createNodeLogsQuery, getLocationToDiscover } = await import('./helpers');
|
||||
|
||||
const { timeRange, logView } = params;
|
||||
const query = createNodeLogsQuery(params);
|
||||
|
||||
return getLocationToDiscover({
|
||||
core: this.deps.core,
|
||||
timeRange,
|
||||
filter: query,
|
||||
logView,
|
||||
});
|
||||
};
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -18,9 +18,6 @@ export interface InfraConfig {
|
|||
inventory: {
|
||||
compositeSize: number;
|
||||
};
|
||||
logs: {
|
||||
app_target: 'logs-ui' | 'discover';
|
||||
};
|
||||
sources?: {
|
||||
default?: {
|
||||
fields?: {
|
||||
|
@ -32,7 +29,6 @@ export interface InfraConfig {
|
|||
|
||||
export const publicConfigKeys = {
|
||||
sources: true,
|
||||
logs: true,
|
||||
} as const;
|
||||
|
||||
export type InfraPublicConfigKey = keyof {
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { createKbnUrlStateStorage } from '@kbn/kibana-utils-plugin/public';
|
||||
import type { AppMountParameters, CoreStart } from '@kbn/core/public';
|
||||
import { getLogViewReferenceFromUrl } from '@kbn/logs-shared-plugin/public';
|
||||
import type { InfraClientStartExports } from '../types';
|
||||
|
||||
export const renderApp = (
|
||||
core: CoreStart,
|
||||
pluginStart: InfraClientStartExports,
|
||||
params: AppMountParameters
|
||||
) => {
|
||||
const toastsService = core.notifications.toasts;
|
||||
|
||||
const urlStateStorage = createKbnUrlStateStorage({
|
||||
history: params.history,
|
||||
useHash: false,
|
||||
useHashQuery: false,
|
||||
});
|
||||
|
||||
const logView = getLogViewReferenceFromUrl({ toastsService, urlStateStorage });
|
||||
|
||||
pluginStart.locators.logsLocator.navigate({ ...(logView ? { logView } : {}) }, { replace: true });
|
||||
|
||||
return () => true;
|
||||
};
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import {
|
||||
AppMountParameters,
|
||||
AppNavLinkStatus,
|
||||
AppUpdater,
|
||||
CoreStart,
|
||||
DEFAULT_APP_CATEGORIES,
|
||||
|
@ -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';
|
||||
|
@ -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,
|
||||
|
@ -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>(() => ({}));
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 = [
|
||||
|
|
|
@ -100,9 +100,6 @@ const createMockStaticConfiguration = (sources: any) => ({
|
|||
inventory: {
|
||||
compositeSize: 2000,
|
||||
},
|
||||
logs: {
|
||||
app_target: 'logs-ui',
|
||||
},
|
||||
sources,
|
||||
});
|
||||
|
||||
|
|
|
@ -1899,9 +1899,6 @@ const createMockStaticConfiguration = (sources: any): InfraConfig => ({
|
|||
inventory: {
|
||||
compositeSize: 2000,
|
||||
},
|
||||
logs: {
|
||||
app_target: 'logs-ui',
|
||||
},
|
||||
enabled: true,
|
||||
sources,
|
||||
});
|
||||
|
|
|
@ -125,9 +125,6 @@ const createMockStaticConfiguration = (sources: any): InfraConfig => ({
|
|||
inventory: {
|
||||
compositeSize: 2000,
|
||||
},
|
||||
logs: {
|
||||
app_target: 'logs-ui',
|
||||
},
|
||||
sources,
|
||||
enabled: true,
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { Server } from '@hapi/hapi';
|
||||
import { offeringBasedSchema, schema } from '@kbn/config-schema';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import {
|
||||
CoreStart,
|
||||
Plugin,
|
||||
|
@ -19,12 +19,7 @@ import { Logger } from '@kbn/logging';
|
|||
import { alertsLocatorID } from '@kbn/observability-plugin/common';
|
||||
import { DEFAULT_SPACE_ID } from '@kbn/spaces-plugin/common';
|
||||
import { GetMetricIndicesOptions } from '@kbn/metrics-data-access-plugin/server';
|
||||
import {
|
||||
DISCOVER_APP_TARGET,
|
||||
LOGS_APP_TARGET,
|
||||
LOGS_FEATURE_ID,
|
||||
METRICS_FEATURE_ID,
|
||||
} from '../common/constants';
|
||||
import { LOGS_FEATURE_ID, METRICS_FEATURE_ID } from '../common/constants';
|
||||
import { publicConfigKeys } from '../common/plugin_config_types';
|
||||
import { configDeprecations, getInfraDeprecationsFactory } from './deprecations';
|
||||
import { LOGS_FEATURE, METRICS_FEATURE } from './features';
|
||||
|
@ -61,18 +56,6 @@ import { mapSourceToLogView } from './utils/map_source_to_log_view';
|
|||
export const config: PluginConfigDescriptor<InfraConfig> = {
|
||||
schema: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
// Setting variants only allowed in the Serverless offering, otherwise always default `logs-ui` value
|
||||
logs: offeringBasedSchema({
|
||||
serverless: schema.object({
|
||||
app_target: schema.oneOf(
|
||||
[schema.literal(LOGS_APP_TARGET), schema.literal(DISCOVER_APP_TARGET)],
|
||||
{ defaultValue: LOGS_APP_TARGET }
|
||||
),
|
||||
}),
|
||||
options: {
|
||||
defaultValue: { app_target: LOGS_APP_TARGET } as const, // "as const" is required for TS to not generalize `app_target: string`
|
||||
},
|
||||
}),
|
||||
alerting: schema.object({
|
||||
inventory_threshold: schema.object({
|
||||
group_by_page_size: schema.number({ defaultValue: 5_000 }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue