diff --git a/config/serverless.oblt.yml b/config/serverless.oblt.yml index d89f5c5e76cd7..cd180cb3829fa 100644 --- a/config/serverless.oblt.yml +++ b/config/serverless.oblt.yml @@ -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 diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index f47b019176eed..56eae55099d4b 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -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)', diff --git a/x-pack/plugins/apm/public/components/shared/links/observability_logs_link.ts b/x-pack/plugins/apm/public/components/shared/links/observability_logs_link.ts index 6909d0035b2f0..85bbaf2d09bdf 100644 --- a/x-pack/plugins/apm/public/components/shared/links/observability_logs_link.ts +++ b/x-pack/plugins/apm/public/components/shared/links/observability_logs_link.ts @@ -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, - 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, - infraLogsLocator?: LogsLocator | DiscoverLogsLocator + infraLogsLocator?: LogsLocator ): string => { const query = `trace.id:"${traceId}" OR (not trace.id:* AND "${traceId}")`; diff --git a/x-pack/plugins/infra/common/constants.ts b/x-pack/plugins/infra/common/constants.ts index 9dd43c6e72c99..12d89484570c6 100644 --- a/x-pack/plugins/infra/common/constants.ts +++ b/x-pack/plugins/infra/common/constants.ts @@ -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.*', diff --git a/x-pack/plugins/infra/common/locators/discover_logs_locator.ts b/x-pack/plugins/infra/common/locators/discover_logs_locator.ts deleted file mode 100644 index 292105678388f..0000000000000 --- a/x-pack/plugins/infra/common/locators/discover_logs_locator.ts +++ /dev/null @@ -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; - -export class DiscoverLogsLocatorDefinition implements LocatorDefinition { - 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, - }); - }; -} diff --git a/x-pack/plugins/infra/common/locators/discover_node_logs_locator.ts b/x-pack/plugins/infra/common/locators/discover_node_logs_locator.ts deleted file mode 100644 index 43418747ab502..0000000000000 --- a/x-pack/plugins/infra/common/locators/discover_node_logs_locator.ts +++ /dev/null @@ -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; - -export class DiscoverNodeLogsLocatorDefinition implements LocatorDefinition { - 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, - }); - }; -} diff --git a/x-pack/plugins/infra/common/locators/index.ts b/x-pack/plugins/infra/common/locators/index.ts index 8749d88ae9b53..d84c42a6dc21e 100644 --- a/x-pack/plugins/infra/common/locators/index.ts +++ b/x-pack/plugins/infra/common/locators/index.ts @@ -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; } diff --git a/x-pack/plugins/infra/common/plugin_config_types.ts b/x-pack/plugins/infra/common/plugin_config_types.ts index 52803a09ae499..adff4cabe30a5 100644 --- a/x-pack/plugins/infra/common/plugin_config_types.ts +++ b/x-pack/plugins/infra/common/plugin_config_types.ts @@ -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 { diff --git a/x-pack/plugins/infra/public/apps/discover_app.tsx b/x-pack/plugins/infra/public/apps/discover_app.tsx deleted file mode 100644 index 2ea704fa9b21f..0000000000000 --- a/x-pack/plugins/infra/public/apps/discover_app.tsx +++ /dev/null @@ -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; -}; diff --git a/x-pack/plugins/infra/public/plugin.ts b/x-pack/plugins/infra/public/plugin.ts index 04e3f34e067b4..0bcdfa7e04bcc 100644 --- a/x-pack/plugins/infra/public/plugin.ts +++ b/x-pack/plugins/infra/public/plugin.ts @@ -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(() => ({})); @@ -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 = [ diff --git a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.test.ts b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.test.ts index 02308de051806..a47008a0fbaf1 100644 --- a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.test.ts +++ b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.test.ts @@ -100,9 +100,6 @@ const createMockStaticConfiguration = (sources: any) => ({ inventory: { compositeSize: 2000, }, - logs: { - app_target: 'logs-ui', - }, sources, }); diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts index 26fbb4d72a7e5..4b618dbd82e85 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts @@ -1899,9 +1899,6 @@ const createMockStaticConfiguration = (sources: any): InfraConfig => ({ inventory: { compositeSize: 2000, }, - logs: { - app_target: 'logs-ui', - }, enabled: true, sources, }); diff --git a/x-pack/plugins/infra/server/lib/sources/sources.test.ts b/x-pack/plugins/infra/server/lib/sources/sources.test.ts index a8c7cf3231b41..183ce952583a0 100644 --- a/x-pack/plugins/infra/server/lib/sources/sources.test.ts +++ b/x-pack/plugins/infra/server/lib/sources/sources.test.ts @@ -125,9 +125,6 @@ const createMockStaticConfiguration = (sources: any): InfraConfig => ({ inventory: { compositeSize: 2000, }, - logs: { - app_target: 'logs-ui', - }, sources, enabled: true, }); diff --git a/x-pack/plugins/infra/server/plugin.ts b/x-pack/plugins/infra/server/plugin.ts index d3898f064135f..10bf7e37fb7c6 100644 --- a/x-pack/plugins/infra/server/plugin.ts +++ b/x-pack/plugins/infra/server/plugin.ts @@ -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 = { 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 }),