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

Disable log stream and settings pages #203996

Merged
merged 16 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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: 0 additions & 1 deletion packages/kbn-management/settings/setting_ids/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ export const OBSERVABILITY_LOGS_EXPLORER_ALLOWED_DATA_VIEWS_ID =
export const OBSERVABILITY_LOGS_SHARED_NEW_LOGS_OVERVIEW_ID = 'observability:newLogsOverview';
export const OBSERVABILITY_ENTITY_CENTRIC_EXPERIENCE = 'observability:entityCentricExperience';
export const OBSERVABILITY_LOGS_DATA_ACCESS_LOG_SOURCES_ID = 'observability:logSources';
export const OBSERVABILITY_ENABLE_LOGS_STREAM = 'observability:enableLogsStream';
export const OBSERVABILITY_AI_ASSISTANT_SIMULATED_FUNCTION_CALLING =
'observability:aiAssistantSimulatedFunctionCalling';
export const OBSERVABILITY_AI_ASSISTANT_SEARCH_CONNECTOR_INDEX_PATTERN =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,6 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
_meta: { description: 'Non-default value of setting.' },
},
},
'observability:enableLogsStream': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'banners:placement': {
type: 'keyword',
_meta: { description: 'Non-default value of setting.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export interface UsageStats {
'observability:apmEnableServiceInventoryTableSearchBar': boolean;
'observability:logsExplorer:allowedDataViews': string[];
'observability:logSources': string[];
'observability:enableLogsStream': boolean;
'observability:newLogsOverview': boolean;
'observability:aiAssistantSimulatedFunctionCalling': boolean;
'observability:aiAssistantSearchConnectorIndexPattern': string;
Expand Down
6 changes: 0 additions & 6 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -11010,12 +11010,6 @@
}
}
},
"observability:enableLogsStream": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"banners:placement": {
"type": "keyword",
"_meta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

import expect from '@kbn/expect';
import { OBSERVABILITY_ENABLE_LOGS_STREAM } from '@kbn/management-settings-ids';
import { VisualizeConstants } from '@kbn/visualizations-plugin/common/constants';
import { FtrProviderContext } from '../../../ftr_provider_context';

Expand All @@ -28,20 +27,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
await kibanaServer.uiSettings.update({ [OBSERVABILITY_ENABLE_LOGS_STREAM]: true });
});

after(async () => {
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.uiSettings.update({ [OBSERVABILITY_ENABLE_LOGS_STREAM]: false });
});

it('ensure toolbar popover closes on add', async () => {
await dashboard.navigateToApp();
await dashboard.clickNewDashboard();
await dashboard.switchToEditMode();
await dashboardAddPanel.clickEditorMenuButton();
await dashboardAddPanel.clickAddNewPanelFromUIActionLink('Log stream (deprecated)');
await dashboardAddPanel.clickAddNewPanelFromUIActionLink('Pattern analysis');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to test another panel as the log stream panel is removed

await dashboardAddPanel.expectEditorMenuClosed();
});

Expand Down
1 change: 0 additions & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"@kbn/default-nav-management",
"@kbn/default-nav-devtools",
"@kbn/core-saved-objects-import-export-server-internal",
"@kbn/management-settings-ids",
"@kbn/core-deprecations-common",
]
}
455 changes: 1 addition & 454 deletions x-pack/platform/plugins/private/translations/translations/fr-FR.json

Large diffs are not rendered by default.

454 changes: 1 addition & 453 deletions x-pack/platform/plugins/private/translations/translations/ja-JP.json

Large diffs are not rendered by default.

455 changes: 1 addition & 454 deletions x-pack/platform/plugins/private/translations/translations/zh-CN.json

Large diffs are not rendered by default.

37 changes: 0 additions & 37 deletions x-pack/plugins/observability_solution/infra/common/ui_settings.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiHeaderLink, EuiHeaderLinks } from '@elast
import { i18n } from '@kbn/i18n';
import React, { useContext } from 'react';
import { Routes, Route } from '@kbn/shared-ux-router';
import { useKibana, useUiSetting } from '@kbn/kibana-react-plugin/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { HeaderMenuPortal, useLinkProps } from '@kbn/observability-shared-plugin/public';
import { SharePublicStart } from '@kbn/share-plugin/public/plugin';
import {
Expand All @@ -20,7 +20,6 @@ import {
} from '@kbn/deeplinks-observability';
import { dynamic } from '@kbn/shared-ux-utility';
import { isDevMode } from '@kbn/xstate-utils';
import { OBSERVABILITY_ENABLE_LOGS_STREAM } from '@kbn/management-settings-ids';
import { LazyAlertDropdownWrapper } from '../../alerting/log_threshold';
import { HelpCenterContent } from '../../components/help_center_content';
import { useReadOnlyBadge } from '../../hooks/use_readonly_badge';
Expand All @@ -29,16 +28,13 @@ import { RedirectWithQueryParams } from '../../utils/redirect_with_query_params'
import { NotFoundPage } from '../404';
import { getLogsAppRoutes } from './routes';

const StreamPage = dynamic(() => import('./stream').then((mod) => ({ default: mod.StreamPage })));
const LogEntryCategoriesPage = dynamic(() =>
import('./log_entry_categories').then((mod) => ({ default: mod.LogEntryCategoriesPage }))
);
const LogEntryRatePage = dynamic(() =>
import('./log_entry_rate').then((mod) => ({ default: mod.LogEntryRatePage }))
);
const LogsSettingsPage = dynamic(() =>
import('./settings').then((mod) => ({ default: mod.LogsSettingsPage }))
);

const StateMachinePlayground = dynamic(() =>
import('../../observability_logs/xstate_helpers').then((mod) => ({
default: mod.StateMachinePlayground,
Expand All @@ -48,8 +44,6 @@ const StateMachinePlayground = dynamic(() =>
export const LogsPageContent: React.FunctionComponent = () => {
const { application, share } = useKibana<{ share: SharePublicStart }>().services;

const isLogsStreamEnabled: boolean = useUiSetting(OBSERVABILITY_ENABLE_LOGS_STREAM, false);

const uiCapabilities = application?.capabilities;
const onboardingLocator = share?.url.locators.get<ObservabilityOnboardingLocatorParams>(
OBSERVABILITY_ONBOARDING_LOCATOR
Expand All @@ -60,7 +54,7 @@ export const LogsPageContent: React.FunctionComponent = () => {

useReadOnlyBadge(!uiCapabilities?.logs?.save);

const routes = getLogsAppRoutes({ isLogsStreamEnabled });
const routes = getLogsAppRoutes();

const settingsLinkProps = useLinkProps({
app: 'logs',
Expand Down Expand Up @@ -94,34 +88,23 @@ export const LogsPageContent: React.FunctionComponent = () => {
)}

<Routes>
{routes.stream ? (
<Route path={routes.stream.path} component={StreamPage} />
) : (
<Route
path="/stream"
exact
render={() => {
share.url.locators
.get<AllDatasetsLocatorParams>(ALL_DATASETS_LOCATOR_ID)
?.navigate({});

return null;
}}
/>
)}
<Route
path="/stream"
exact
render={() => {
share.url.locators.get<AllDatasetsLocatorParams>(ALL_DATASETS_LOCATOR_ID)?.navigate({});

return null;
}}
/>
<Route path={routes.logsAnomalies.path} component={LogEntryRatePage} />
<Route path={routes.logsCategories.path} component={LogEntryCategoriesPage} />
<Route path={routes.settings.path} component={LogsSettingsPage} />
{enableDeveloperRoutes && (
<Route path={'/state-machine-playground'} component={StateMachinePlayground} />
)}
<RedirectWithQueryParams from={'/analysis'} to={routes.logsAnomalies.path} exact />
<RedirectWithQueryParams from={'/log-rate'} to={routes.logsAnomalies.path} exact />
<RedirectWithQueryParams
from={'/'}
to={routes.stream?.path ?? routes.logsAnomalies.path}
exact
/>
<RedirectWithQueryParams from={'/'} to={routes.logsAnomalies.path} exact />

<Route render={() => <NotFoundPage title={pageTitle} />} />
</Routes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
* 2.0.
*/

import {
logsAnomaliesTitle,
logCategoriesTitle,
settingsTitle,
streamTitle,
} from '../../translations';
import { logsAnomaliesTitle, logCategoriesTitle } from '../../translations';

export interface LogsRoute {
id: string;
Expand All @@ -21,11 +16,9 @@ export interface LogsRoute {
export interface LogsAppRoutes {
logsAnomalies: LogsRoute;
logsCategories: LogsRoute;
settings: LogsRoute;
stream?: LogsRoute;
}

export const getLogsAppRoutes = ({ isLogsStreamEnabled }: { isLogsStreamEnabled: boolean }) => {
export const getLogsAppRoutes = () => {
const routes: LogsAppRoutes = {
logsAnomalies: {
id: 'anomalies',
Expand All @@ -37,20 +30,7 @@ export const getLogsAppRoutes = ({ isLogsStreamEnabled }: { isLogsStreamEnabled:
title: logCategoriesTitle,
path: '/log-categories',
},
settings: {
id: 'settings',
title: settingsTitle,
path: '/settings',
},
};

if (isLogsStreamEnabled) {
routes.stream = {
id: 'stream',
title: streamTitle,
path: '/stream',
};
}

return routes;
};
54 changes: 3 additions & 51 deletions x-pack/plugins/observability_solution/infra/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,19 @@ import {
map,
firstValueFrom,
} from 'rxjs';
import type { EmbeddableApiContext } from '@kbn/presentation-publishing';
import { apiCanAddNewPanel } from '@kbn/presentation-containers';
import { IncompatibleActionError, ADD_PANEL_TRIGGER } from '@kbn/ui-actions-plugin/public';
import { COMMON_EMBEDDABLE_GROUPING } from '@kbn/embeddable-plugin/public';
import {
ASSET_DETAILS_LOCATOR_ID,
INVENTORY_LOCATOR_ID,
type AssetDetailsLocatorParams,
type InventoryLocatorParams,
} from '@kbn/observability-shared-plugin/common';
import { OBSERVABILITY_ENABLE_LOGS_STREAM } from '@kbn/management-settings-ids';
import { NavigationEntry } from '@kbn/observability-shared-plugin/public';
import { OBSERVABILITY_LOGS_EXPLORER_APP_ID } from '@kbn/deeplinks-observability/constants';
import type { InfraPublicConfig } from '../common/plugin_config_types';
import { createInventoryMetricRuleType } from './alerting/inventory';
import { createLogThresholdRuleType } from './alerting/log_threshold';
import { createMetricThresholdRuleType } from './alerting/metric_threshold';
import { ADD_LOG_STREAM_ACTION_ID, LOG_STREAM_EMBEDDABLE } from './components/log_stream/constants';
import { LOG_STREAM_EMBEDDABLE } from './components/log_stream/constants';
import { createMetricsFetchData, createMetricsHasData } from './metrics_overview_fetchers';
import { registerFeatures } from './register_feature';
import { InventoryViewsService } from './services/inventory_views';
Expand All @@ -63,7 +58,6 @@ import type {
InfraClientStartExports,
} from './types';
import { getLogsHasDataFetcher, getLogsOverviewDataFetcher } from './utils/logs_overview_fetchers';
import type { LogStreamSerializedState } from './components/log_stream/types';
import {
hostsTitle,
inventoryTitle,
Expand Down Expand Up @@ -95,8 +89,6 @@ export class Plugin implements InfraClientPluginClass {
}

setup(core: InfraClientCoreSetup, pluginsSetup: InfraClientSetupDeps) {
const isLogsStreamEnabled = core.uiSettings.get(OBSERVABILITY_ENABLE_LOGS_STREAM, false);

if (pluginsSetup.home) {
registerFeatures(pluginsSetup.home);
}
Expand Down Expand Up @@ -146,7 +138,7 @@ export class Plugin implements InfraClientPluginClass {
)
);

const logRoutes = getLogsAppRoutes({ isLogsStreamEnabled });
const logRoutes = getLogsAppRoutes();

/** !! Need to be kept in sync with the deepLinks in x-pack/plugins/observability_solution/infra/public/plugin.ts */
pluginsSetup.observabilityShared.navigation.registerSections(
Expand Down Expand Up @@ -340,48 +332,11 @@ export class Plugin implements InfraClientPluginClass {
}

start(core: InfraClientCoreStart, plugins: InfraClientStartDeps) {
const { http, uiSettings } = core;
const isLogsStreamEnabled = uiSettings.get(OBSERVABILITY_ENABLE_LOGS_STREAM, false);
const { http } = core;
const inventoryViews = this.inventoryViews.start({ http });
const metricsExplorerViews = this.metricsExplorerViews?.start({ http });
const telemetry = this.telemetry.start();

if (isLogsStreamEnabled) {
plugins.uiActions.registerAction<EmbeddableApiContext>({
id: ADD_LOG_STREAM_ACTION_ID,
grouping: [COMMON_EMBEDDABLE_GROUPING.legacy],
order: 30,
getDisplayName: () =>
i18n.translate('xpack.infra.logStreamEmbeddable.displayName', {
defaultMessage: 'Log stream (deprecated)',
}),
getDisplayNameTooltip: () =>
i18n.translate('xpack.infra.logStreamEmbeddable.description', {
defaultMessage:
'Add a table of live streaming logs. For a more efficient experience, we recommend using the Discover Page to create a saved search instead of using Log stream.',
}),
getIconType: () => 'logsApp',
isCompatible: async ({ embeddable }) => {
return apiCanAddNewPanel(embeddable);
},
execute: async ({ embeddable }) => {
if (!apiCanAddNewPanel(embeddable)) throw new IncompatibleActionError();
embeddable.addNewPanel<LogStreamSerializedState>(
{
panelType: LOG_STREAM_EMBEDDABLE,
initialState: {
title: i18n.translate('xpack.infra.logStreamEmbeddable.title', {
defaultMessage: 'Log stream',
}),
},
},
true
);
},
});
plugins.uiActions.attachAction(ADD_PANEL_TRIGGER, ADD_LOG_STREAM_ACTION_ID);
}

const startContract: InfraClientStartExports = {
inventoryViews,
metricsExplorerViews,
Expand Down Expand Up @@ -417,12 +372,9 @@ const getLogsNavigationEntries = ({
}

// Display Stream nav entry when Logs Stream is enabled
Copy link
Contributor

@miloszmarcinkowski miloszmarcinkowski Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please remove comment associated with deleted line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, removed in 8c5c37d

if (routes.stream) entries.push(createNavEntryFromRoute(routes.stream));
// Display always Logs Anomalies and Logs Categories entries
entries.push(createNavEntryFromRoute(routes.logsAnomalies));
entries.push(createNavEntryFromRoute(routes.logsCategories));
// Display Logs Settings entry when Logs Stream is not enabled
if (!routes.stream) entries.push(createNavEntryFromRoute(routes.settings));

return entries;
};
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/observability_solution/infra/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import {
} from './types';
import { UsageCollector } from './usage/usage_collector';
import { mapSourceToLogView } from './utils/map_source_to_log_view';
import { uiSettings } from '../common/ui_settings';

export interface KbnServer extends Server {
usage: any;
Expand Down Expand Up @@ -134,9 +133,6 @@ export class InfraServerPlugin
const inventoryViews = this.inventoryViews.setup();
const metricsExplorerViews = this.metricsExplorerViews?.setup();

// Register uiSettings config
core.uiSettings.register(uiSettings);

// Register saved object types
core.savedObjects.registerType(infraSourceConfigurationSavedObjectType);
core.savedObjects.registerType(inventoryViewSavedObjectType);
Expand Down
Loading