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] Hidding UP tab for RUM #167608

Merged
merged 4 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -5,17 +5,28 @@
* 2.0.
*/

import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiSpacer } from '@elastic/eui';
import {
EuiEmptyPrompt,
EuiFlexGroup,
EuiFlexItem,
EuiLink,
EuiSpacer,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { EmbeddableFlamegraph } from '@kbn/observability-shared-plugin/public';
import { isEmpty } from 'lodash';
import React from 'react';
import { ApmDataSourceWithSummary } from '../../../../common/data_source';
import { ApmDocumentType } from '../../../../common/document_type';
import { HOST_NAME } from '../../../../common/es_fields/apm';
import { toKueryFilterFormat } from '../../../../common/utils/to_kuery_filter_format';
import { isPending, useFetcher } from '../../../hooks/use_fetcher';
import {
FETCH_STATUS,
isPending,
useFetcher,
} from '../../../hooks/use_fetcher';
import { useProfilingPlugin } from '../../../hooks/use_profiling_plugin';
import { HostnamesFilterWarning } from './host_names_filter_warning';
import { ApmDataSourceWithSummary } from '../../../../common/data_source';
import { ApmDocumentType } from '../../../../common/document_type';

interface Props {
serviceName: string;
Expand Down Expand Up @@ -86,11 +97,24 @@ export function ProfilingFlamegraph({
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer />
<EmbeddableFlamegraph
data={data?.flamegraph}
isLoading={isPending(status)}
height="60vh"
/>
{status === FETCH_STATUS.SUCCESS && isEmpty(data) ? (
<EuiEmptyPrompt
titleSize="s"
title={
<div>
{i18n.translate('xpack.apm.profiling.flamegraph.noDataFound', {
defaultMessage: 'No data found',
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
})}
</div>
}
/>
) : (
<EmbeddableFlamegraph
data={data?.flamegraph}
isLoading={isPending(status)}
height="60vh"
/>
)}
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,10 @@ function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) {
label: i18n.translate('xpack.apm.home.profilingTabLabel', {
defaultMessage: 'Universal Profiling',
}),
hidden: !isProfilingAvailable,
hidden:
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
!isProfilingAvailable ||
!isMobileAgentName(agentName) ||
!isRumAgentName(agentName),
append: (
<EuiBadge color="accent">
{i18n.translate('xpack.apm.universalProfiling.newLabel', {
Expand Down
8 changes: 8 additions & 0 deletions x-pack/plugins/apm/server/routes/profiling/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ const profilingFlamegraphRoute = createApmServerRoute({
rollupInterval,
});

if (!serviceHostNames.length) {
return undefined;
}

const flamegraph =
await profilingDataAccessStart?.services.fetchFlamechartData({
esClient: esClient.asCurrentUser,
Expand Down Expand Up @@ -116,6 +120,10 @@ const profilingFunctionsRoute = createApmServerRoute({
rollupInterval,
});

if (!serviceHostNames.length) {
return undefined;
}

const functions = await profilingDataAccessStart?.services.fetchFunction({
esClient: esClient.asCurrentUser,
rangeFromMs: start,
Expand Down