diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index 7fdb8724243a3..3d7882176f64e 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -91,7 +91,7 @@ describe('Service inventory', () => { it('with the correct environment when changing the environment', () => { cy.wait(mainAliasNames); - cy.getByTestSubj('environmentFilter').type('production'); + cy.getByTestSubj('environmentFilter').type('{selectall}production'); cy.contains('button', 'production').click(); @@ -103,6 +103,7 @@ describe('Service inventory', () => { it('when selecting a different time range and clicking the update button', () => { cy.wait(mainAliasNames); + cy.getByTestSubj('apmServiceGroupsTourDismissButton').click(); cy.selectAbsoluteTimeRange( moment(timeRange.rangeFrom).subtract(5, 'm').toISOString(), diff --git a/x-pack/plugins/observability_solution/apm/kibana.jsonc b/x-pack/plugins/observability_solution/apm/kibana.jsonc index aa87258afbe36..c6a53232aaec0 100644 --- a/x-pack/plugins/observability_solution/apm/kibana.jsonc +++ b/x-pack/plugins/observability_solution/apm/kibana.jsonc @@ -30,7 +30,8 @@ "lens", "maps", "uiActions", - "logsDataAccess" + "logsDataAccess", + "entityManager" ], "optionalPlugins": [ "actions", @@ -52,13 +53,6 @@ "cases", "observabilityAIAssistant" ], - "requiredBundles": [ - "fleet", - "kibanaReact", - "kibanaUtils", - "ml", - "observability", - "maps" - ] + "requiredBundles": ["fleet", "kibanaReact", "kibanaUtils", "ml", "observability", "maps"] } } diff --git a/x-pack/plugins/observability_solution/apm/public/assets/services_inventory.png b/x-pack/plugins/observability_solution/apm/public/assets/services_inventory.png new file mode 100644 index 0000000000000..fc9347c5b5430 Binary files /dev/null and b/x-pack/plugins/observability_solution/apm/public/assets/services_inventory.png differ diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/index.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/index.tsx index d00dc0a6e2d6a..ed8f9e361c321 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/index.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/index.tsx @@ -5,24 +5,39 @@ * 2.0. */ import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiEmptyPrompt, EuiLoadingLogo } from '@elastic/eui'; import { isEmpty } from 'lodash'; -import { apmEnableMultiSignal } from '@kbn/observability-plugin/common'; -import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; import { ApmServiceInventory } from './apm_signal_inventory'; import { MultiSignalInventory } from './multi_signal_inventory'; import { useApmParams } from '../../../hooks/use_apm_params'; +import { useEntityManagerEnablementContext } from '../../../context/entity_manager_context/use_entity_manager_enablement_context'; -export const ServiceInventory = () => { - const { core } = useApmPluginContext(); - const isMultiSignalEnabled = core.uiSettings.get(apmEnableMultiSignal, false); +export function ServiceInventory() { + const { isEntityManagerEnabled, isEnablementPending } = useEntityManagerEnablementContext(); const { query: { serviceGroup }, } = useApmParams('/services'); - return isMultiSignalEnabled && isEmpty(serviceGroup) ? ( + if (isEnablementPending) { + return ( + } + title={ +

+ {i18n.translate('xpack.apm.loadingService', { + defaultMessage: 'Loading services', + })} +

+ } + /> + ); + } + + return isEntityManagerEnabled && isEmpty(serviceGroup) ? ( ) : ( ); -}; +} diff --git a/x-pack/plugins/observability_solution/apm/public/components/routing/apm_route_config.tsx b/x-pack/plugins/observability_solution/apm/public/components/routing/apm_route_config.tsx index 4fe5f5f583f1b..05d6b5f227e39 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/routing/apm_route_config.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/routing/apm_route_config.tsx @@ -101,6 +101,7 @@ const apmRoutes = { environmentFilter={false} showServiceGroupSaveButton={false} showServiceGroupsNav + showEnablementCallout selectedNavButton="serviceGroups" > diff --git a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/index.tsx b/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/index.tsx index b331027a79d0f..02d73e7df75bc 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/index.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/index.tsx @@ -42,6 +42,7 @@ import { RedirectWithDefaultEnvironment } from './redirect_with_default_environm import { RedirectWithOffset } from './redirect_with_offset'; import { ScrollToTopOnPathChange } from './scroll_to_top_on_path_change'; import { UpdateExecutionContextOnRouteChange } from './update_execution_context_on_route_change'; +import { EntityManagerEnablementContextProvider } from '../../../context/entity_manager_context/entity_manager_context'; const storage = new Storage(localStorage); @@ -83,15 +84,17 @@ export function ApmAppRoot({ - - - - - - - - - + + + + + + + + + + + diff --git a/x-pack/plugins/observability_solution/apm/public/components/routing/templates/apm_main_template.tsx b/x-pack/plugins/observability_solution/apm/public/components/routing/templates/apm_main_template.tsx index afe1de2490e07..36ab11d45851a 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/routing/templates/apm_main_template.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/routing/templates/apm_main_template.tsx @@ -23,6 +23,7 @@ import { ServiceGroupsButtonGroup } from '../../app/service_groups/service_group import { ApmEnvironmentFilter } from '../../shared/environment_filter'; import { getNoDataConfig } from './no_data_config'; import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; +import { EntityEnablement } from '../../shared/entity_enablement'; // Paths that must skip the no data screen const bypassNoDataScreenPaths = ['/settings', '/diagnostics']; @@ -45,6 +46,7 @@ export function ApmMainTemplate({ environmentFilter = true, showServiceGroupSaveButton = false, showServiceGroupsNav = false, + showEnablementCallout = false, environmentFilterInTemplate = true, selectedNavButton, ...pageTemplateProps @@ -55,6 +57,7 @@ export function ApmMainTemplate({ environmentFilter?: boolean; showServiceGroupSaveButton?: boolean; showServiceGroupsNav?: boolean; + showEnablementCallout?: boolean; selectedNavButton?: 'serviceGroups' | 'allServices'; } & KibanaPageTemplateProps & Pick) { @@ -126,6 +129,7 @@ export function ApmMainTemplate({ const pageHeaderTitle = ( {pageHeader?.pageTitle ?? pageTitle} + @@ -152,10 +156,14 @@ export function ApmMainTemplate({ rightSideItems, ...pageHeader, pageTitle: pageHeaderTitle, - children: - showServiceGroupsNav && selectedNavButton ? ( - - ) : null, + children: ( + + {showEnablementCallout && selectedNavButton === 'allServices' && } + {showServiceGroupsNav && selectedNavButton && ( + + )} + + ), }} {...pageTemplateProps} > diff --git a/x-pack/plugins/observability_solution/apm/public/components/routing/templates/service_group_template.tsx b/x-pack/plugins/observability_solution/apm/public/components/routing/templates/service_group_template.tsx index b34de178192d2..1f5074f6b0c78 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/routing/templates/service_group_template.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/routing/templates/service_group_template.tsx @@ -137,6 +137,7 @@ export function ServiceGroupTemplate({ environmentFilter={environmentFilter} showServiceGroupSaveButton={!isAllServices} showServiceGroupsNav={isAllServices} + showEnablementCallout selectedNavButton={isAllServices ? 'allServices' : 'serviceGroups'} {...pageTemplateProps} > diff --git a/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/feedback_modal.tsx b/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/feedback_modal.tsx new file mode 100644 index 0000000000000..e44dc8ae3a72b --- /dev/null +++ b/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/feedback_modal.tsx @@ -0,0 +1,106 @@ +/* + * 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 React, { useContext } from 'react'; +import { i18n } from '@kbn/i18n'; +import { + useEuiTheme, + EuiButtonEmpty, + EuiConfirmModal, + EuiFlexGroup, + EuiFlexItem, + EuiIcon, + EuiPanel, + EuiText, + EuiTitle, +} from '@elastic/eui'; +import { getSurveyFeedbackURL } from '@kbn/observability-shared-plugin/public'; +import { KibanaEnvironmentContext } from '../../../context/kibana_environment_context/kibana_environment_context'; +import { getPathForFeedback } from '../../../utils/get_path_for_feedback'; + +export function FeedbackModal({ + isFeedbackModalVisible = false, + onClose, +}: { + isFeedbackModalVisible?: boolean; + onClose: () => void; +}) { + const kibanaEnvironment = useContext(KibanaEnvironmentContext); + const { kibanaVersion, isCloudEnv, isServerlessEnv } = kibanaEnvironment; + const sanitizedPath = getPathForFeedback(window.location.pathname); + const { euiTheme } = useEuiTheme(); + + return ( + <> + {isFeedbackModalVisible && ( + + {i18n.translate('xpack.apm.eemFeedback.button.openSurvey', { + defaultMessage: 'Tell us what you think!', + })} + + } + defaultFocusedButton="confirm" + > + + + + + + + +

+ {i18n.translate('xpack.apm.eemFeedback.title', { + defaultMessage: 'Let us know what you think!', + })} +

+
+
+
+
+ + + +

+ {i18n.translate('xpack.apm.feedbackModal.body.thanks', { + defaultMessage: + "Thank you for trying our new experience. We'll be continuing to improve on this so please come back often.", + })} +

+
+
+
+ )} + + ); +} diff --git a/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/index.tsx b/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/index.tsx new file mode 100644 index 0000000000000..e305743243a4b --- /dev/null +++ b/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/index.tsx @@ -0,0 +1,169 @@ +/* + * 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 React, { useState } from 'react'; +import { useKibana } from '@kbn/kibana-react-plugin/public'; +import { ERROR_USER_NOT_AUTHORIZED } from '@kbn/entityManager-plugin/public'; +import useToggle from 'react-use/lib/useToggle'; +import { + EuiButtonIcon, + EuiFlexGroup, + EuiFlexItem, + EuiLink, + EuiLoadingSpinner, + EuiPopover, + EuiPopoverFooter, + EuiSkeletonText, + EuiText, + EuiTextColor, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { TechnicalPreviewBadge } from '../technical_preview_badge'; +import { ApmPluginStartDeps } from '../../../plugin'; +import { useEntityManagerEnablementContext } from '../../../context/entity_manager_context/use_entity_manager_enablement_context'; +import { FeedbackModal } from './feedback_modal'; +import { UnauthorisedModal } from './unauthorized_modal'; + +export function EntityEnablement() { + const [isFeedbackModalVisible, setsIsFeedbackModalVisible] = useState(false); + const [isUnauthorizedModalVisible, setsIsUnauthorizedModalVisible] = useState(false); + + const { + services: { entityManager }, + } = useKibana(); + + const { isEntityManagerEnabled, isEnablementPending, refetch } = + useEntityManagerEnablementContext(); + + const [isPopoverOpen, togglePopover] = useToggle(false); + const [isLoading, setIsLoading] = useToggle(false); + + const handleRestoreView = async () => { + setIsLoading(true); + try { + const response = await entityManager.entityClient.disableManagedEntityDiscovery(); + if (response.success) { + setIsLoading(false); + setsIsFeedbackModalVisible(true); + } + } catch (error) { + setIsLoading(false); + setsIsFeedbackModalVisible(true); + console.error(error); + } + }; + + const handleEnableblement = async () => { + setIsLoading(true); + try { + const response = await entityManager.entityClient.enableManagedEntityDiscovery(); + if (response.success) { + setIsLoading(false); + refetch(); + } + + if (response.reason === ERROR_USER_NOT_AUTHORIZED) { + setIsLoading(false); + setsIsUnauthorizedModalVisible(true); + } + } catch (error) { + setIsLoading(false); + console.error(error); + } + }; + + const handdleOnCloseFeedback = () => { + setsIsFeedbackModalVisible(false); + refetch(); + }; + + return isEnablementPending ? ( + + + + ) : ( + + + {isLoading ? : } + + + + {isEntityManagerEnabled + ? i18n.translate('xpack.apm.eemEnablement.enabled.', { + defaultMessage: 'Viewing our new experience', + }) + : i18n.translate('xpack.apm.eemEnablement.tryItButton.', { + defaultMessage: 'Try our new experience!', + })} + + + + + } + isOpen={isPopoverOpen} + closePopover={togglePopover} + anchorPosition="downLeft" + > +
+ +

+ {i18n.translate('xpack.apm.entityEnablement.content', { + defaultMessage: + 'Our new experience combines both APM-instrumented services with services detected from logs in a single service inventory.', + })} +

+
+
+ + + + {i18n.translate('xpack.apm.entityEnablement.footer', { + defaultMessage: 'Learn more', + })} + + + +
+
+ {isEntityManagerEnabled && ( + + + {i18n.translate('xpack.apm.eemEnablement.restoveClassicView.', { + defaultMessage: 'Restore classic view', + })} + + + )} + + setsIsUnauthorizedModalVisible(false)} + /> +
+ ); +} diff --git a/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/unauthorized_modal.tsx b/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/unauthorized_modal.tsx new file mode 100644 index 0000000000000..f728790f8c50f --- /dev/null +++ b/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/unauthorized_modal.tsx @@ -0,0 +1,106 @@ +/* + * 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. + */ + +/* +/* + * 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 React from 'react'; +import { i18n } from '@kbn/i18n'; +import { + EuiButton, + EuiConfirmModal, + EuiFlexGroup, + EuiFlexItem, + EuiIcon, + EuiImage, + EuiPanel, + EuiSpacer, + EuiText, + EuiTitle, +} from '@elastic/eui'; +import { useKibanaUrl } from '../../../hooks/use_kibana_url'; + +export function UnauthorisedModal({ + isUnauthorizedModalVisible = false, + onClose, +}: { + isUnauthorizedModalVisible?: boolean; + onClose: () => void; +}) { + const servicesInventory = useKibanaUrl('/plugins/apm/assets/services_inventory.png'); + + return ( + <> + {isUnauthorizedModalVisible && ( + + {i18n.translate('xpack.apm.unauthorised.button.openSurvey', { + defaultMessage: 'OK', + })} + + } + defaultFocusedButton="confirm" + > + + + + + + + +

+ {i18n.translate('xpack.apm.unauthorised.title', { + defaultMessage: 'This feature is turned off', + })} +

+
+
+
+
+ + + +

+ {i18n.translate('xpack.apm.unauthorised.body', { + defaultMessage: + 'To see services detected from logs and APM-instrumented services in our new service inventory, please ask an administrator to visit this page and try our new experience. ', + })} +

+
+
+ + + + +
+ )} + + ); +} diff --git a/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/entity_manager_context.tsx b/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/entity_manager_context.tsx new file mode 100644 index 0000000000000..9fd41de01d8fe --- /dev/null +++ b/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/entity_manager_context.tsx @@ -0,0 +1,40 @@ +/* + * 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 React, { createContext } from 'react'; +import { ENTITY_FETCH_STATUS, useEntityManager } from '../../hooks/use_entity_manager'; + +export interface EntityManagerEnablementContextValue { + isEntityManagerEnabled: boolean; + entityManagerEnablementStatus: ENTITY_FETCH_STATUS; + isEnablementPending: boolean; + refetch: () => void; +} + +export const EntityManagerEnablementContext = createContext( + {} as EntityManagerEnablementContextValue +); + +export function EntityManagerEnablementContextProvider({ + children, +}: { + children: React.ReactChild; +}) { + const { isEnabled, status, refetch } = useEntityManager(); + + return ( + + {children} + + ); +} diff --git a/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/use_entity_manager_enablement_context.ts b/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/use_entity_manager_enablement_context.ts new file mode 100644 index 0000000000000..83942af2e7715 --- /dev/null +++ b/x-pack/plugins/observability_solution/apm/public/context/entity_manager_context/use_entity_manager_enablement_context.ts @@ -0,0 +1,13 @@ +/* + * 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 { useContext } from 'react'; +import { EntityManagerEnablementContext } from './entity_manager_context'; + +export function useEntityManagerEnablementContext() { + return useContext(EntityManagerEnablementContext); +} diff --git a/x-pack/plugins/observability_solution/apm/public/hooks/use_entity_manager.ts b/x-pack/plugins/observability_solution/apm/public/hooks/use_entity_manager.ts new file mode 100644 index 0000000000000..554d58fe4cf10 --- /dev/null +++ b/x-pack/plugins/observability_solution/apm/public/hooks/use_entity_manager.ts @@ -0,0 +1,55 @@ +/* + * 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 { useKibana } from '@kbn/kibana-react-plugin/public'; +import { useEffect, useMemo, useState } from 'react'; +import { ApmPluginStartDeps } from '../plugin'; + +export enum ENTITY_FETCH_STATUS { + LOADING = 'loading', + SUCCESS = 'success', + FAILURE = 'failure', + NOT_INITIATED = 'not_initiated', +} + +export function useEntityManager() { + const { + services: { entityManager }, + } = useKibana(); + const [counter, setCounter] = useState(0); + const [result, setResult] = useState({ + isEnabled: false, + status: ENTITY_FETCH_STATUS.NOT_INITIATED, + }); + + useEffect(() => { + async function isManagedEntityDiscoveryEnabled() { + setResult({ isEnabled: false, status: ENTITY_FETCH_STATUS.LOADING }); + + try { + const response = await entityManager.entityClient.isManagedEntityDiscoveryEnabled(); + setResult({ isEnabled: response?.enabled, status: ENTITY_FETCH_STATUS.SUCCESS }); + } catch (err) { + setResult({ isEnabled: false, status: ENTITY_FETCH_STATUS.FAILURE }); + + console.error(err); + } + } + + isManagedEntityDiscoveryEnabled(); + }, [entityManager, counter]); + + return useMemo(() => { + return { + ...result, + refetch: () => { + // this will invalidate the deps to `useEffect` and will result in a new request + setCounter((count) => count + 1); + }, + }; + }, [result]); +} diff --git a/x-pack/plugins/observability_solution/apm/public/plugin.ts b/x-pack/plugins/observability_solution/apm/public/plugin.ts index 087718436afa8..70a2176fdc595 100644 --- a/x-pack/plugins/observability_solution/apm/public/plugin.ts +++ b/x-pack/plugins/observability_solution/apm/public/plugin.ts @@ -19,6 +19,7 @@ import { PluginInitializerContext, SecurityServiceStart, } from '@kbn/core/public'; +import { EntityManagerPublicPluginSetup } from '@kbn/entityManager-plugin/public'; import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { DiscoverSetup, DiscoverStart } from '@kbn/discover-plugin/public'; @@ -105,6 +106,7 @@ export interface ApmPluginSetupDeps { uiActions: UiActionsSetup; profiling?: ProfilingPluginSetup; cloud?: CloudSetup; + entityManager: EntityManagerPublicPluginSetup; } export interface ApmServices { @@ -140,6 +142,7 @@ export interface ApmPluginStartDeps { dashboard: DashboardStart; metricsDataAccess: MetricsDataPluginStart; uiSettings: IUiSettingsClient; + entityManager: EntityManagerPublicPluginSetup; } const servicesTitle = i18n.translate('xpack.apm.navigation.servicesTitle', { diff --git a/x-pack/plugins/observability_solution/apm/server/lib/helpers/create_es_client/create_assets_es_client/create_assets_es_clients.ts b/x-pack/plugins/observability_solution/apm/server/lib/helpers/create_es_client/create_assets_es_client/create_assets_es_clients.ts index 045d8bc251818..8b31141601d92 100644 --- a/x-pack/plugins/observability_solution/apm/server/lib/helpers/create_es_client/create_assets_es_client/create_assets_es_clients.ts +++ b/x-pack/plugins/observability_solution/apm/server/lib/helpers/create_es_client/create_assets_es_client/create_assets_es_clients.ts @@ -14,7 +14,7 @@ import { } from '@elastic/elasticsearch/lib/api/types'; import { withApmSpan } from '../../../../utils/with_apm_span'; -const ENTITIES_INDEX_NAME = '.entities-observability.latest-*'; +const ENTITIES_INDEX_NAME = '.entities.v1.latest.builtin_services*'; export function cancelEsRequestOnAbort>( promise: T, diff --git a/x-pack/plugins/observability_solution/apm/server/routes/historical_data/route.ts b/x-pack/plugins/observability_solution/apm/server/routes/historical_data/route.ts index 97f8f8c253033..c3513417cc565 100644 --- a/x-pack/plugins/observability_solution/apm/server/routes/historical_data/route.ts +++ b/x-pack/plugins/observability_solution/apm/server/routes/historical_data/route.ts @@ -5,12 +5,10 @@ * 2.0. */ -import { apmEnableMultiSignal } from '@kbn/observability-plugin/common'; import { createEntitiesESClient } from '../../lib/helpers/create_es_client/create_assets_es_client/create_assets_es_clients'; import { getApmEventClient } from '../../lib/helpers/get_apm_event_client'; import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; import { hasHistoricalAgentData } from './has_historical_agent_data'; -import { hasEntitiesData } from './has_historical_entities_data'; const hasDataRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/has_data', @@ -19,24 +17,14 @@ const hasDataRoute = createApmServerRoute({ const { context, request } = resources; const coreContext = await context.core; - const { - uiSettings: { client: uiSettingsClient }, - } = coreContext; - - const [apmEventClient, entitiesESClient, isApmEnableMultiSignal] = await Promise.all([ + const [apmEventClient] = await Promise.all([ getApmEventClient(resources), createEntitiesESClient({ request, esClient: coreContext.elasticsearch.client.asCurrentUser, }), - uiSettingsClient.get(apmEnableMultiSignal), ]); - if (isApmEnableMultiSignal) { - const hasData = await hasEntitiesData(entitiesESClient); - return { hasData }; - } - const hasData = await hasHistoricalAgentData(apmEventClient); return { hasData }; }, diff --git a/x-pack/plugins/observability_solution/apm/tsconfig.json b/x-pack/plugins/observability_solution/apm/tsconfig.json index 375283b72f6b6..fc7fccbded5dd 100644 --- a/x-pack/plugins/observability_solution/apm/tsconfig.json +++ b/x-pack/plugins/observability_solution/apm/tsconfig.json @@ -121,7 +121,8 @@ "@kbn/react-kibana-context-render", "@kbn/react-kibana-context-theme", "@kbn/test-jest-helpers", - "@kbn/security-plugin-types-common" + "@kbn/security-plugin-types-common", + "@kbn/entityManager-plugin" ], "exclude": [ "target/**/*" diff --git a/x-pack/plugins/observability_solution/entity_manager/public/index.ts b/x-pack/plugins/observability_solution/entity_manager/public/index.ts index e17edb959595d..e8b77529c2eac 100644 --- a/x-pack/plugins/observability_solution/entity_manager/public/index.ts +++ b/x-pack/plugins/observability_solution/entity_manager/public/index.ts @@ -18,3 +18,12 @@ export const plugin: PluginInitializer< export type { EntityManagerPublicPluginSetup, EntityManagerPublicPluginStart }; export type EntityManagerAppId = 'entityManager'; + +export { + ERROR_API_KEY_NOT_FOUND, + ERROR_API_KEY_NOT_VALID, + ERROR_USER_NOT_AUTHORIZED, + ERROR_API_KEY_SERVICE_DISABLED, + ERROR_PARTIAL_BUILTIN_INSTALLATION, + ERROR_DEFINITION_STOPPED, +} from '../common/errors';