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

[8.x] [Infra] Display "Add metrics" callout for all containers without metrics (#202220) #202465

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const containerDefaultActions = (
return {
actions: {
primary: {
href: locator?.getRedirectUrl({ category: OnboardingFlow.Infra }),
href: locator?.getRedirectUrl({ category: OnboardingFlow.Hosts }),
label: defaultPrimaryActionLabel,
},
link: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { MetricsTemplate } from './metrics_template';
import { DockerCharts, KubernetesContainerCharts } from '../../charts';
import { DOCKER_METRIC_TYPES, INTEGRATIONS, KUBERNETES_METRIC_TYPES } from '../../constants';
import { useIntegrationCheck } from '../../hooks/use_integration_check';
import { AddMetricsCallout } from '../../add_metrics_callout';

export const ContainerMetrics = () => {
const ref = useRef<HTMLDivElement>(null);
Expand All @@ -29,7 +30,7 @@ export const ContainerMetrics = () => {
});

if (!isDockerContainer && !isKubernetesContainer) {
return null;
return <AddMetricsCallout id="containerMetrics" />;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import { AddMetricsCallout } from '../../add_metrics_callout';
import { AddMetricsCalloutKey } from '../../add_metrics_callout/constants';
import { useEntitySummary } from '../../hooks/use_entity_summary';
import { isMetricsSignal } from '../../utils/get_data_stream_types';
import { INTEGRATIONS } from '../../constants';
import { useIntegrationCheck } from '../../hooks/use_integration_check';

export const Overview = () => {
const { dateRange } = useDatePickerContext();
Expand All @@ -50,10 +48,6 @@ export const Overview = () => {
`infra.dismissedAddMetricsCallout.${addMetricsCalloutId}`,
false
);
const isDockerContainer = useIntegrationCheck({ dependsOn: INTEGRATIONS.docker });
const isKubernetesContainer = useIntegrationCheck({
dependsOn: INTEGRATIONS.kubernetesContainer,
});

const metadataSummarySection = isFullPageView ? (
<MetadataSummaryList metadata={metadata} loading={metadataLoading} assetType={asset.type} />
Expand All @@ -74,13 +68,7 @@ export const Overview = () => {
return false;
}

const { type } = asset;
const baseCondition = !isMetricsSignal(dataStreams);

const isRelevantContainer =
type === 'container' && (isDockerContainer || isKubernetesContainer);

return baseCondition && (type === 'host' || isRelevantContainer);
return !isMetricsSignal(dataStreams);
};

const showAddMetricsCallout = shouldShowCallout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { noMetricIndicesPromptDescription, noMetricIndicesPromptTitle } from '..

export enum OnboardingFlow {
Infra = 'infra',
Hosts = 'logs',
Hosts = 'host',
}

interface NoDataConfigDetails {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/infra/hosts_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const currentUrl = await browser.getCurrentUrl();
const parsedUrl = new URL(currentUrl);
const baseUrl = `${parsedUrl.protocol}//${parsedUrl.host}`;
const expectedUrlPattern = `${baseUrl}/app/observabilityOnboarding/?category=logs`;
const expectedUrlPattern = `${baseUrl}/app/observabilityOnboarding/?category=host`;
expect(currentUrl).to.equal(expectedUrlPattern);
});
});
Expand Down