Skip to content

Commit

Permalink
Add translations and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv committed Jun 18, 2020
1 parent 6dae0fc commit 491676e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { APIReturnType } from '../../../services/rest/createCallApmApi';

type TracesAPIResponse = APIReturnType<'/api/apm/traces'>;
const DEFAULT_RESPONSE: TracesAPIResponse = {
transactionGroups: [],
items: [],
isAggregationAccurate: true,
bucketSize: 0,
};
Expand Down Expand Up @@ -64,7 +64,7 @@ export function TraceOverview() {
<EuiFlexItem grow={7}>
<EuiPanel>
<TraceList
items={data.transactionGroups}
items={data.items}
isLoading={status === FETCH_STATUS.LOADING}
/>
</EuiPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {
EuiFlexItem,
EuiHorizontalRule,
EuiCallOut,
EuiLink,
EuiCode,
} from '@elastic/eui';
import { Location } from 'history';
import { FormattedMessage } from '@kbn/i18n/react';
import { first } from 'lodash';
import React, { useMemo } from 'react';
import { i18n } from '@kbn/i18n';
Expand All @@ -25,6 +25,7 @@ import { IUrlParams } from '../../../context/UrlParamsContext/types';
import { TransactionCharts } from '../../shared/charts/TransactionCharts';
import { TransactionBreakdown } from '../../shared/TransactionBreakdown';
import { TransactionList } from './List';
import { ElasticDocsLink } from '../../shared/Links/ElasticDocsLink';
import { useRedirect } from './useRedirect';
import { useFetcher } from '../../../hooks/useFetcher';
import { getHasMLJob } from '../../../services/rest/ml';
Expand Down Expand Up @@ -161,7 +162,7 @@ export function TransactionOverview() {
{!transactionListData.isAggregationAccurate && (
<EuiCallOut
title={i18n.translate(
'xpack.apm.transactionCardinalityWarning',
'xpack.apm.transactionCardinalityWarning.title',
{
defaultMessage:
'This view shows a subset of reported transactions.',
Expand All @@ -171,21 +172,32 @@ export function TransactionOverview() {
iconType="alert"
>
<p>
The number of unique transaction names exceeds the configured
value of {transactionListData.bucketSize}. Try reconfiguring
your agents to group similar transactions or increase the
value of
<EuiCode>
xpack.apm.ui.transactionGroupBucketSize
</EuiCode>.{' '}
<EuiLink href="#">Learn more in the docs.</EuiLink>.
<FormattedMessage
id="xpack.apm.transactionCardinalityWarning.body"
defaultMessage="The number of unique transaction names exceeds the configured value of {bucketSize}. Try reconfiguring your agents to group similar transactions or increase the value of {codeBlock}"
values={{
bucketSize: transactionListData.bucketSize,
codeBlock: (
<EuiCode>
xpack.apm.ui.transactionGroupBucketSize
</EuiCode>
),
}}
/>

<ElasticDocsLink section="/kibana" path="TODO">
{i18n.translate(
'xpack.apm.transactionCardinalityWarning.docsLink',
{ defaultMessage: 'Learn more in the docs' }
)}
</ElasticDocsLink>
</p>
</EuiCallOut>
)}
<EuiSpacer size="s" />
<TransactionList
isLoading={transactionListStatus === 'loading'}
items={transactionListData.transactionGroups}
items={transactionListData.items}
/>
</EuiPanel>
</EuiFlexItem>
Expand Down
8 changes: 3 additions & 5 deletions x-pack/plugins/apm/public/hooks/useTransactionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ type TransactionsAPIResponse = APIReturnType<
'/api/apm/services/{serviceName}/transaction_groups'
>;

function getWithRelativeImpact(
items: TransactionsAPIResponse['transactionGroups']
) {
function getWithRelativeImpact(items: TransactionsAPIResponse['items']) {
const impacts = items
.map(({ impact }) => impact)
.filter((impact) => impact !== null) as number[];
Expand All @@ -46,7 +44,7 @@ function getWithRelativeImpact(
}

const DEFAULT_RESPONSE: TransactionsAPIResponse = {
transactionGroups: [],
items: [],
isAggregationAccurate: true,
bucketSize: 0,
};
Expand Down Expand Up @@ -76,7 +74,7 @@ export function useTransactionList(urlParams: IUrlParams) {

const memoizedData = useMemo(
() => ({
transactionGroups: getWithRelativeImpact(data.transactionGroups),
items: getWithRelativeImpact(data.items),
isAggregationAccurate: data.isAggregationAccurate,
bucketSize: data.bucketSize,
}),
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/apm/server/lib/transaction_groups/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function transactionGroupsTransformer({
end: number;
bucketSize: number;
}): {
transactionGroups: ITransactionGroup[];
items: ITransactionGroup[];
isAggregationAccurate: boolean;
bucketSize: number;
} {
Expand All @@ -83,7 +83,7 @@ export function transactionGroupsTransformer({
);

return {
transactionGroups: transactionGroupsWithRelativeImpact,
items: transactionGroupsWithRelativeImpact,

// The aggregation is considered accurate if the configured bucket size is larger or equal to the number of buckets returned
// the actual number of buckets retrieved are `bucketsize + 1` to detect whether it's above the limit
Expand Down

0 comments on commit 491676e

Please sign in to comment.