diff --git a/src/platform/packages/shared/kbn-management/settings/setting_ids/index.ts b/src/platform/packages/shared/kbn-management/settings/setting_ids/index.ts index 2c2e51155a8fb..e76139cb86672 100644 --- a/src/platform/packages/shared/kbn-management/settings/setting_ids/index.ts +++ b/src/platform/packages/shared/kbn-management/settings/setting_ids/index.ts @@ -125,6 +125,7 @@ export const OBSERVABILITY_AI_ASSISTANT_SIMULATED_FUNCTION_CALLING = export const OBSERVABILITY_AI_ASSISTANT_SEARCH_CONNECTOR_INDEX_PATTERN = 'observability:aiAssistantSearchConnectorIndexPattern'; export const OBSERVABILITY_SEARCH_EXCLUDED_DATA_TIERS = 'observability:searchExcludedDataTiers'; +export const OBSERVABILITY_ENABLE_STREAMS_UI = 'observability:enableStreamsUI'; // Reporting settings export const XPACK_REPORTING_CUSTOM_PDF_LOGO_ID = 'xpackReporting:customPdfLogo'; diff --git a/src/platform/packages/shared/serverless/settings/observability_project/index.ts b/src/platform/packages/shared/serverless/settings/observability_project/index.ts index cf02073ca71db..af0e0d955bb51 100644 --- a/src/platform/packages/shared/serverless/settings/observability_project/index.ts +++ b/src/platform/packages/shared/serverless/settings/observability_project/index.ts @@ -25,4 +25,5 @@ export const OBSERVABILITY_PROJECT_SETTINGS = [ settings.OBSERVABILITY_AI_ASSISTANT_SIMULATED_FUNCTION_CALLING, settings.OBSERVABILITY_AI_ASSISTANT_SEARCH_CONNECTOR_INDEX_PATTERN, settings.OBSERVABILITY_LOGS_DATA_ACCESS_LOG_SOURCES_ID, + settings.OBSERVABILITY_ENABLE_STREAMS_UI, ]; diff --git a/src/platform/plugins/private/kibana_usage_collection/server/collectors/management/schema.ts b/src/platform/plugins/private/kibana_usage_collection/server/collectors/management/schema.ts index 38fc0bc1f2e2f..67ac050168267 100644 --- a/src/platform/plugins/private/kibana_usage_collection/server/collectors/management/schema.ts +++ b/src/platform/plugins/private/kibana_usage_collection/server/collectors/management/schema.ts @@ -656,4 +656,10 @@ export const stackManagementSchema: MakeSchemaFrom = { description: 'Enable the new logs overview component.', }, }, + 'observability:enableStreamsUI': { + type: 'boolean', + _meta: { + description: 'Enable Streams UI.', + }, + }, }; diff --git a/src/platform/plugins/private/kibana_usage_collection/server/collectors/management/types.ts b/src/platform/plugins/private/kibana_usage_collection/server/collectors/management/types.ts index 88cd565a8df78..40efb2de33184 100644 --- a/src/platform/plugins/private/kibana_usage_collection/server/collectors/management/types.ts +++ b/src/platform/plugins/private/kibana_usage_collection/server/collectors/management/types.ts @@ -171,4 +171,5 @@ export interface UsageStats { 'securitySolution:excludedDataTiersForRuleExecution': string[]; 'securitySolution:maxUnassociatedNotes': number; 'observability:searchExcludedDataTiers': string[]; + 'observability:enableStreamsUI': boolean; } diff --git a/src/platform/plugins/shared/telemetry/schema/oss_platform.json b/src/platform/plugins/shared/telemetry/schema/oss_platform.json index e3a51e0f692aa..e80ba6881da9d 100644 --- a/src/platform/plugins/shared/telemetry/schema/oss_platform.json +++ b/src/platform/plugins/shared/telemetry/schema/oss_platform.json @@ -11537,6 +11537,12 @@ "_meta": { "description": "Enable the new logs overview component." } + }, + "observability:enableStreamsUI": { + "type": "boolean", + "_meta": { + "description": "Enable Streams UI." + } } } }, diff --git a/x-pack/platform/plugins/shared/streams/public/plugin.ts b/x-pack/platform/plugins/shared/streams/public/plugin.ts index 0e08ba519ab85..a1e7896cab863 100644 --- a/x-pack/platform/plugins/shared/streams/public/plugin.ts +++ b/x-pack/platform/plugins/shared/streams/public/plugin.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { ApplicationStart, CoreSetup, CoreStart, PluginInitializerContext } from '@kbn/core/public'; +import { CoreSetup, CoreStart, PluginInitializerContext } from '@kbn/core/public'; import { Logger } from '@kbn/logging'; - +import { OBSERVABILITY_ENABLE_STREAMS_UI } from '@kbn/management-settings-ids'; import { createRepositoryClient } from '@kbn/server-route-repository-client'; import { Observable, from, shareReplay, startWith } from 'rxjs'; import { once } from 'lodash'; @@ -41,12 +41,7 @@ export class Plugin implements StreamsPluginClass { start(core: CoreStart, pluginsStart: StreamsPluginStartDependencies): StreamsPluginStart { return { streamsRepositoryClient: this.repositoryClient, - status$: createStreamsStatusObservable( - pluginsStart, - core.application, - this.repositoryClient, - this.logger - ), + status$: createStreamsStatusObservable(core, this.repositoryClient, this.logger), }; } @@ -59,21 +54,19 @@ const UNKNOWN_STATUS: StreamsStatus = { status: 'unknown' }; const createStreamsStatusObservable = once( ( - deps: StreamsPluginSetupDependencies | StreamsPluginStartDependencies, - application: ApplicationStart, + core: CoreStart, repositoryClient: StreamsRepositoryClient, logger: Logger ): Observable => { - const isObservabilityServerless = - deps.cloud?.isServerlessEnabled && deps.cloud?.serverless.projectType === 'observability'; - + const { application, uiSettings } = core; const hasCapabilities = application.capabilities?.streams?.show; + const isUIEnabled = uiSettings.get(OBSERVABILITY_ENABLE_STREAMS_UI); if (!hasCapabilities) { return from([DISABLED_STATUS]); } - if (isObservabilityServerless) { + if (isUIEnabled) { return from([ENABLED_STATUS]); } diff --git a/x-pack/platform/plugins/shared/streams/server/plugin.ts b/x-pack/platform/plugins/shared/streams/server/plugin.ts index 143d4eddba231..5066caca821c3 100644 --- a/x-pack/platform/plugins/shared/streams/server/plugin.ts +++ b/x-pack/platform/plugins/shared/streams/server/plugin.ts @@ -19,6 +19,8 @@ import { KibanaFeatureScope } from '@kbn/features-plugin/common'; import { i18n } from '@kbn/i18n'; import { STREAMS_RULE_TYPE_IDS } from '@kbn/rule-data-utils'; import { registerRoutes } from '@kbn/server-route-repository'; +import { schema } from '@kbn/config-schema'; +import { OBSERVABILITY_ENABLE_STREAMS_UI } from '@kbn/management-settings-ids'; import { StreamsConfig, configSchema, exposeToBrowserConfig } from '../common/config'; import { STREAMS_API_PRIVILEGES, @@ -63,7 +65,7 @@ export class StreamsPlugin public logger: Logger; public server?: StreamsServer; private isDev: boolean; - private telemtryService = new StreamsTelemetryService(); + private telemetryService = new StreamsTelemetryService(); constructor(context: PluginInitializerContext) { this.isDev = context.env.mode.dev; @@ -80,7 +82,7 @@ export class StreamsPlugin logger: this.logger, } as StreamsServer; - this.telemtryService.setup(core.analytics); + this.telemetryService.setup(core.analytics); const isSignificantEventsEnabled = this.config.experimental?.significantEventsEnabled === true; const alertingFeatures = isSignificantEventsEnabled @@ -157,7 +159,7 @@ export class StreamsPlugin dependencies: { assets: assetService, server: this.server, - telemetry: this.telemtryService.getClient(), + telemetry: this.telemetryService.getClient(), getScopedClients: async ({ request, }: { @@ -200,6 +202,30 @@ export class StreamsPlugin runDevModeChecks: this.isDev, }); + const isObservabilityServerless = + plugins.cloud?.isServerlessEnabled && + plugins.cloud?.serverless.projectType === 'observability'; + core.uiSettings.register({ + [OBSERVABILITY_ENABLE_STREAMS_UI]: { + category: ['observability'], + name: 'Streams UI', + value: isObservabilityServerless, + description: i18n.translate('xpack.streams.enableStreamsUIDescription', { + defaultMessage: '{technicalPreviewLabel} Enable the {streamsLink}.', + values: { + technicalPreviewLabel: `[${i18n.translate('xpack.streams.technicalPreviewLabel', { + defaultMessage: 'Technical Preview', + })}]`, + streamsLink: `Streams UI`, + }, + }), + type: 'boolean', + schema: schema.boolean(), + requiresPageReload: true, + solution: 'oblt', + }, + }); + return {}; } diff --git a/x-pack/platform/plugins/shared/streams/server/types.ts b/x-pack/platform/plugins/shared/streams/server/types.ts index b824ec53bd885..68473b38cf506 100644 --- a/x-pack/platform/plugins/shared/streams/server/types.ts +++ b/x-pack/platform/plugins/shared/streams/server/types.ts @@ -23,6 +23,7 @@ import type { TaskManagerSetupContract, TaskManagerStartContract, } from '@kbn/task-manager-plugin/server'; +import type { CloudSetup } from '@kbn/cloud-plugin/server'; import type { StreamsConfig } from '../common/config'; export interface StreamsServer { @@ -45,6 +46,7 @@ export interface StreamsPluginSetupDependencies { alerting: AlertingServerSetup; ruleRegistry: RuleRegistryPluginSetup; features: FeaturesPluginSetup; + cloud?: CloudSetup; } export interface StreamsPluginStartDependencies { diff --git a/x-pack/platform/plugins/shared/streams/tsconfig.json b/x-pack/platform/plugins/shared/streams/tsconfig.json index 95768c441dbdc..1e4020f6815da 100644 --- a/x-pack/platform/plugins/shared/streams/tsconfig.json +++ b/x-pack/platform/plugins/shared/streams/tsconfig.json @@ -51,6 +51,7 @@ "@kbn/zod-helpers", "@kbn/core-http-server-utils", "@kbn/inference-common", - "@kbn/lock-manager" + "@kbn/lock-manager", + "@kbn/management-settings-ids" ] }