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

[APM/Infra] Display entity detail views for logs-only signals when EEM is enabled #196387

Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2a32915
Create useEntityManager
iblancof Oct 15, 2024
2344dca
Hide noDataConfig when logs are present and EEM is enabled
iblancof Oct 15, 2024
38d8ae6
Remove duplicated EEM setting const
iblancof Oct 15, 2024
e77cb12
Create useEntityCentricExperienceSetting
iblancof Oct 15, 2024
ac3580c
Create isLogsSignal
iblancof Oct 15, 2024
1a9512f
Hide noDataConfig when logs are present and EEM is enabled
iblancof Oct 15, 2024
a5d126e
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 15, 2024
63b9114
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Oct 15, 2024
955839d
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 16, 2024
1fbf28d
Remove EntityManager usage in apm
iblancof Oct 16, 2024
1572b82
Add new logic to shouldBypassNoDataScreen
iblancof Oct 16, 2024
8c1bd53
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Oct 16, 2024
e96bf01
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 16, 2024
a81193c
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 16, 2024
3ee8a24
Move noDataConfig new logic
iblancof Oct 16, 2024
0a1f945
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 16, 2024
fdf0ef3
Add both logs and metrics check to bypass empty state
iblancof Oct 16, 2024
db30fa1
Merge branch '196084-inventory-logs-only-hosts-containers--services-d…
iblancof Oct 16, 2024
be9e36b
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 17, 2024
748d0d2
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 17, 2024
4286590
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 17, 2024
8bf92b4
Modify onboarding logic for asset detail
iblancof Oct 17, 2024
92595fb
Prevent calling hasData if onboardingFlow is undefined
iblancof Oct 17, 2024
753476d
Update x-pack/plugins/observability_solution/infra/public/components/…
iblancof Oct 17, 2024
4625539
Rename has EEM to shouldBypassOnboarding
iblancof Oct 17, 2024
1692be0
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 17, 2024
199f836
Remove unused attributes in getNoDataConfig
iblancof Oct 17, 2024
bdc324b
Merge branch 'main' into 196084-inventory-logs-only-hosts-containers-…
iblancof Oct 18, 2024
52a4967
Add missing onboardingFlow dep when fetching hasData
iblancof Oct 18, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

import { EuiFlexGroup, EuiPageHeaderProps } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { entityCentricExperience } from '@kbn/observability-plugin/common';
import { ObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public';
import type { KibanaPageTemplateProps } from '@kbn/shared-ux-page-kibana-template';
import React, { useContext } from 'react';
import { useLocation } from 'react-router-dom';
import { FeatureFeedbackButton } from '@kbn/observability-shared-plugin/public';
import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context';
import { isLogsSignal } from '../../../../utils/get_signal_type';
import { useLocalStorage } from '../../../../hooks/use_local_storage';
import { useDefaultAiAssistantStarterPromptsForAPM } from '../../../../hooks/use_default_ai_assistant_starter_prompts_for_apm';
import { KibanaEnvironmentContext } from '../../../../context/kibana_environment_context/kibana_environment_context';
Expand Down Expand Up @@ -71,12 +72,8 @@ export function ApmMainTemplate({
const { http, docLinks, observabilityShared, application } = services;
const { kibanaVersion, isCloudEnv, isServerlessEnv } = kibanaEnvironment;
const basePath = http?.basePath.get();
const { config, core } = useApmPluginContext();
const isEntityCentricExperienceSettingEnabled = core.uiSettings.get<boolean>(
entityCentricExperience,
true
);
iblancof marked this conversation as resolved.
Show resolved Hide resolved

const { config } = useApmPluginContext();
const { serviceEntitySummary } = useApmServiceContext();
const { isEntityCentricExperienceEnabled } = useEntityCentricExperienceSetting();

const ObservabilityPageTemplate = observabilityShared.navigation.PageTemplate;
Expand All @@ -97,9 +94,14 @@ export function ApmMainTemplate({
[application?.capabilities.savedObjectsManagement.edit]
);

const shouldBypassNoDataScreen = bypassNoDataScreenPaths.some((path) =>
location.pathname.includes(path)
);
const hasLogsData = serviceEntitySummary?.dataStreamTypes
? serviceEntitySummary?.dataStreamTypes?.length > 0 &&
isLogsSignal(serviceEntitySummary.dataStreamTypes)
: false;
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved

const shouldBypassNoDataScreen =
bypassNoDataScreenPaths.some((path) => location.pathname.includes(path)) ||
(isEntityCentricExperienceEnabled && hasLogsData);

const { data: fleetApmPoliciesData, status: fleetApmPoliciesStatus } = useFetcher(
(callApmApi) => {
Expand Down Expand Up @@ -158,7 +160,7 @@ export function ApmMainTemplate({

const showEntitiesInventoryCallout =
!dismissedEntitiesInventoryCallout &&
isEntityCentricExperienceSettingEnabled &&
isEntityCentricExperienceEnabled &&
selectedNavButton !== undefined;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import React, { useEffect } from 'react';
import type { InventoryItemType } from '@kbn/metrics-data-access-plugin/common';
import { EuiLoadingSpinner } from '@elastic/eui';
import { useEntityCentricExperienceSetting } from '../../../hooks/use_entity_centric_experience_setting';
import { isPending } from '../../../hooks/use_fetcher';
import { SYSTEM_INTEGRATION } from '../../../../common/constants';
import { useMetricsBreadcrumbs } from '../../../hooks/use_metrics_breadcrumbs';
import { useParentBreadcrumbResolver } from '../../../hooks/use_parent_breadcrumb_resolver';
Expand All @@ -24,7 +26,7 @@ import { InfraPageTemplate } from '../../shared/templates/infra_page_template';
import { OnboardingFlow } from '../../shared/templates/no_data_config';
import { PageTitleWithPopover } from '../header/page_title_with_popover';
import { useEntitySummary } from '../hooks/use_entity_summary';
import { isMetricsSignal } from '../utils/get_data_stream_types';
import { isLogsSignal, isMetricsSignal } from '../utils/get_data_stream_types';

const DATA_AVAILABILITY_PER_TYPE: Partial<Record<InventoryItemType, string[]>> = {
host: [SYSTEM_INTEGRATION],
Expand All @@ -36,10 +38,11 @@ export const Page = ({ tabs = [], links = [] }: ContentTemplateProps) => {
const { rightSideItems, tabEntries, breadcrumbs: headerBreadcrumbs } = usePageHeader(tabs, links);
const { asset } = useAssetDetailsRenderPropsContext();
const trackOnlyOnce = React.useRef(false);
const { dataStreams } = useEntitySummary({
const { dataStreams, status: entitySummaryStatus } = useEntitySummary({
entityType: asset.type,
entityId: asset.id,
});
const { isEntityCentricExperienceEnabled } = useEntityCentricExperienceSetting();
const { activeTabId } = useTabSwitcherContext();
const {
services: { telemetry },
Expand Down Expand Up @@ -85,10 +88,18 @@ export const Page = ({ tabs = [], links = [] }: ContentTemplateProps) => {
}, [activeTabId, asset.type, metadata, metadataLoading, telemetry]);

const showPageTitleWithPopover = asset.type === 'host' && !isMetricsSignal(dataStreams);
const hasEEM =
iblancof marked this conversation as resolved.
Show resolved Hide resolved
(isEntityCentricExperienceEnabled && isLogsSignal(dataStreams)) || isMetricsSignal(dataStreams);
iblancof marked this conversation as resolved.
Show resolved Hide resolved

return (
<InfraPageTemplate
onboardingFlow={asset.type === 'host' ? OnboardingFlow.Hosts : OnboardingFlow.Infra}
onboardingFlow={
isPending(entitySummaryStatus) || hasEEM
? undefined
: asset.type === 'host'
? OnboardingFlow.Hosts
: OnboardingFlow.Infra
}
dataAvailabilityModules={DATA_AVAILABILITY_PER_TYPE[asset.type] || undefined}
pageHeader={{
pageTitle: loading ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ import { EntityDataStreamType } from '@kbn/observability-shared-plugin/common';
export function isMetricsSignal(dataStreamTypes: EntityDataStreamType[] = []) {
return dataStreamTypes?.includes(EntityDataStreamType.METRICS);
}

export function isLogsSignal(dataStreamTypes: EntityDataStreamType[] = []) {
return dataStreamTypes?.includes(EntityDataStreamType.LOGS);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { OnboardingFlow, getNoDataConfig } from './no_data_config';
export const InfraPageTemplate = ({
'data-test-subj': _dataTestSubj,
dataAvailabilityModules,
onboardingFlow = OnboardingFlow.Infra,
onboardingFlow,
...pageTemplateProps
}: Omit<LazyObservabilityPageTemplateProps, 'noDataConfig'> & {
dataAvailabilityModules?: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ export const getNoDataConfig = ({
docsLink,
}: {
hasData: boolean;
hasEemData?: boolean;
iblancof marked this conversation as resolved.
Show resolved Hide resolved
loading: boolean;
onboardingFlow: OnboardingFlow;
onboardingFlow?: OnboardingFlow;
locators: LocatorClient;
docsLink?: string;
isEntityCentricExperienceEnabled?: boolean;
}): NoDataConfig | undefined => {
if (hasData || loading) {
if (!onboardingFlow || hasData || loading) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* 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 { entityCentricExperience } from '@kbn/observability-plugin/common';
import { useKibanaContextForPlugin } from './use_kibana';

export function useEntityCentricExperienceSetting() {
const { uiSettings } = useKibanaContextForPlugin().services;

const isEntityCentricExperienceEnabled = uiSettings.get<boolean>(entityCentricExperience, true);
iblancof marked this conversation as resolved.
Show resolved Hide resolved

return { isEntityCentricExperienceEnabled };
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
import { useTrackPageview } from '@kbn/observability-shared-plugin/public';
import { APP_WRAPPER_CLASS } from '@kbn/core/public';
import { css } from '@emotion/react';
import { OnboardingFlow } from '../../../components/shared/templates/no_data_config';
import { InfraPageTemplate } from '../../../components/shared/templates/infra_page_template';
import { useMetricsBreadcrumbs } from '../../../hooks/use_metrics_breadcrumbs';
import { inventoryTitle } from '../../../translations';
Expand Down Expand Up @@ -38,6 +39,7 @@ export const SnapshotPage = () => {
<WaffleFiltersProvider>
<div className={APP_WRAPPER_CLASS}>
<InfraPageTemplate
onboardingFlow={OnboardingFlow.Infra}
pageHeader={{
pageTitle: inventoryTitle,
rightSideItems: [<SavedViews />, <SurveySection />],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import moment from 'moment';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { InventoryMetric, InventoryItemType } from '@kbn/metrics-data-access-plugin/common';
import { decodeOrThrow } from '@kbn/io-ts-utils';
import { OnboardingFlow } from '../../../../components/shared/templates/no_data_config';
import { InfraPageTemplate } from '../../../../components/shared/templates/infra_page_template';
import { NodeDetailsMetricDataResponseRT } from '../../../../../common/http_api/node_details_api';
import { isPending, useFetcher } from '../../../../hooks/use_fetcher';
Expand Down Expand Up @@ -91,6 +92,7 @@ export const NodeDetailsPage = (props: Props) => {

return (
<InfraPageTemplate
onboardingFlow={OnboardingFlow.Infra}
pageHeader={{
pageTitle: props.name,
rightSideItems: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React, { useState } from 'react';
import { useRouteMatch } from 'react-router-dom';
import { findInventoryModel } from '@kbn/metrics-data-access-plugin/common';
import type { InventoryItemType } from '@kbn/metrics-data-access-plugin/common';
import { OnboardingFlow } from '../../../components/shared/templates/no_data_config';
import { InfraPageTemplate } from '../../../components/shared/templates/infra_page_template';
import { useMetricsBreadcrumbs } from '../../../hooks/use_metrics_breadcrumbs';
import { useParentBreadcrumbResolver } from '../../../hooks/use_parent_breadcrumb_resolver';
Expand Down Expand Up @@ -79,7 +80,7 @@ export const MetricDetailPage = () => {

if (metadataLoading && !filteredRequiredMetrics.length) {
return (
<InfraPageTemplate>
<InfraPageTemplate onboardingFlow={OnboardingFlow.Infra}>
<InfraLoadingPanel
height="100vh"
width="100%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { i18n } from '@kbn/i18n';
import React, { useEffect, useState } from 'react';
import { useTrackPageview, FeatureFeedbackButton } from '@kbn/observability-shared-plugin/public';
import { OnboardingFlow } from '../../../components/shared/templates/no_data_config';
import { InfraPageTemplate } from '../../../components/shared/templates/infra_page_template';
import { WithMetricsExplorerOptionsUrlState } from '../../../containers/metrics_explorer/with_metrics_explorer_options_url_state';
import { useKibanaEnvironmentContext } from '../../../hooks/use_kibana';
Expand Down Expand Up @@ -94,6 +95,7 @@ const MetricsExplorerContent = () => {

return (
<InfraPageTemplate
onboardingFlow={OnboardingFlow.Infra}
pageHeader={{
pageTitle: metricsExplorerTitle,
rightSideItems: [
Expand Down