Skip to content

Commit

Permalink
[APM] Remove service maps badge row and num instances in popover (#65492
Browse files Browse the repository at this point in the history
)

* Closes #65487 by removing the badge row and num instances metrics

* removed unused translations for xpack.apm.serviceMap.numInstancesMetric
  • Loading branch information
ogupte authored May 6, 2020
1 parent 6dd5ba0 commit 41c8426
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 100 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/apm/common/service_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export interface Connection {
}

export interface ServiceNodeMetrics {
numInstances: number;
avgMemoryUsage: number | null;
avgCpuUsage: number | null;
avgTransactionDuration: number | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ storiesOf('app/ServiceMap/Popover/ServiceMetricList', module)
avgRequestsPerMinute={164.47222031860858}
avgCpuUsage={0.32809666568309237}
avgMemoryUsage={0.5504868173242986}
numInstances={2}
isLoading={false}
/>
))
Expand All @@ -27,7 +26,6 @@ storiesOf('app/ServiceMap/Popover/ServiceMetricList', module)
avgRequestsPerMinute={null}
avgCpuUsage={null}
avgMemoryUsage={null}
numInstances={1}
isLoading={true}
/>
))
Expand All @@ -38,7 +36,6 @@ storiesOf('app/ServiceMap/Popover/ServiceMetricList', module)
avgRequestsPerMinute={8.439583235652972}
avgCpuUsage={null}
avgMemoryUsage={null}
numInstances={1}
isLoading={false}
/>
))
Expand All @@ -49,7 +46,6 @@ storiesOf('app/ServiceMap/Popover/ServiceMetricList', module)
avgRequestsPerMinute={null}
avgCpuUsage={null}
avgMemoryUsage={null}
numInstances={1}
isLoading={false}
/>
));
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import {
EuiBadge,
EuiFlexGroup,
EuiFlexItem,
EuiLoadingSpinner
} from '@elastic/eui';
import { EuiFlexGroup, EuiLoadingSpinner } from '@elastic/eui';
import lightTheme from '@elastic/eui/dist/eui_theme_light.json';
import { i18n } from '@kbn/i18n';
import { isNumber } from 'lodash';
Expand All @@ -30,10 +25,6 @@ function LoadingSpinner() {
);
}

const BadgeRow = styled(EuiFlexItem)`
padding-bottom: ${lightTheme.gutterTypes.gutterSmall};
`;

export const ItemRow = styled('tr')`
line-height: 2;
`;
Expand All @@ -57,7 +48,6 @@ export function ServiceMetricList({
avgErrorsPerMinute,
avgCpuUsage,
avgMemoryUsage,
numInstances,
isLoading
}: ServiceMetricListProps) {
const listItems = [
Expand Down Expand Up @@ -110,39 +100,22 @@ export function ServiceMetricList({
: null
}
];
const showBadgeRow = numInstances > 1;

return isLoading ? (
<LoadingSpinner />
) : (
<>
{showBadgeRow && (
<BadgeRow>
<EuiFlexGroup gutterSize="none">
{numInstances > 1 && (
<EuiBadge iconType="apps" color="hollow">
{i18n.translate('xpack.apm.serviceMap.numInstancesMetric', {
values: { numInstances },
defaultMessage: '{numInstances} instances'
})}
</EuiBadge>
)}
</EuiFlexGroup>
</BadgeRow>
)}
<table>
<tbody>
{listItems.map(
({ title, description }) =>
description && (
<ItemRow key={title}>
<ItemTitle>{title}</ItemTitle>
<ItemDescription>{description}</ItemDescription>
</ItemRow>
)
)}
</tbody>
</table>
</>
<table>
<tbody>
{listItems.map(
({ title, description }) =>
description && (
<ItemRow key={title}>
<ItemTitle>{title}</ItemTitle>
<ItemDescription>{description}</ItemDescription>
</ItemRow>
)
)}
</tbody>
</table>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
TRANSACTION_DURATION,
METRIC_SYSTEM_CPU_PERCENT,
METRIC_SYSTEM_FREE_MEMORY,
METRIC_SYSTEM_TOTAL_MEMORY,
SERVICE_NODE_NAME
METRIC_SYSTEM_TOTAL_MEMORY
} from '../../../common/elasticsearch_fieldnames';
import { percentMemoryUsedScript } from '../metrics/by_agent/shared/memory';

Expand Down Expand Up @@ -56,22 +55,19 @@ export async function getServiceMapServiceNodeInfo({
errorMetrics,
transactionMetrics,
cpuMetrics,
memoryMetrics,
instanceMetrics
memoryMetrics
] = await Promise.all([
getErrorMetrics(taskParams),
getTransactionMetrics(taskParams),
getCpuMetrics(taskParams),
getMemoryMetrics(taskParams),
getNumInstances(taskParams)
getMemoryMetrics(taskParams)
]);

return {
...errorMetrics,
...transactionMetrics,
...cpuMetrics,
...memoryMetrics,
...instanceMetrics
...memoryMetrics
};
}

Expand Down Expand Up @@ -226,47 +222,3 @@ async function getMemoryMetrics({
avgMemoryUsage: response.aggregations?.avgMemoryUsage.value ?? null
};
}

async function getNumInstances({
setup,
filter
}: TaskParameters): Promise<{ numInstances: number }> {
const { client, indices } = setup;
const response = await client.search({
index: indices['apm_oss.transactionIndices'],
body: {
query: {
bool: {
filter: filter.concat([
{
term: {
[PROCESSOR_EVENT]: 'transaction'
}
},
{
exists: {
field: SERVICE_NODE_NAME
}
},
{
exists: {
field: METRIC_SYSTEM_TOTAL_MEMORY
}
}
])
}
},
aggs: {
instances: {
cardinality: {
field: SERVICE_NODE_NAME
}
}
}
}
});

return {
numInstances: response.aggregations?.instances.value || 1
};
}
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -4386,7 +4386,6 @@
"xpack.apm.serviceMap.emptyBanner.title": "単一のサービスしかないようです。",
"xpack.apm.serviceMap.focusMapButtonText": "焦点マップ",
"xpack.apm.serviceMap.invalidLicenseMessage": "サービスマップを利用するには、Elastic Platinum ライセンスが必要です。これにより、APM データとともにアプリケーションスタック全てを可視化することができるようになります。",
"xpack.apm.serviceMap.numInstancesMetric": "{numInstances}インスタンス",
"xpack.apm.serviceMap.serviceDetailsButtonText": "サービス詳細",
"xpack.apm.serviceMap.subtypePopoverMetric": "サブタイプ",
"xpack.apm.serviceMap.typePopoverMetric": "タイプ",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -4387,7 +4387,6 @@
"xpack.apm.serviceMap.emptyBanner.title": "似乎仅有一个服务。",
"xpack.apm.serviceMap.focusMapButtonText": "聚焦地图",
"xpack.apm.serviceMap.invalidLicenseMessage": "要访问服务地图,必须订阅 Elastic 白金级许可证。使用该许可证,您将能够可视化整个应用程序堆栈以及 APM 数据。",
"xpack.apm.serviceMap.numInstancesMetric": "{numInstances} 个实例",
"xpack.apm.serviceMap.serviceDetailsButtonText": "服务详情",
"xpack.apm.serviceMap.subtypePopoverMetric": "子类型",
"xpack.apm.serviceMap.typePopoverMetric": "类型",
Expand Down

0 comments on commit 41c8426

Please sign in to comment.