-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Pagination of top 10 trace samples (#51911)
* adding trace pagination * adding trace pagination * refactoring * refactoring
- Loading branch information
1 parent
99c6396
commit a80366b
Showing
11 changed files
with
296 additions
and
207 deletions.
There are no files selected for viewing
54 changes: 0 additions & 54 deletions
54
...s/apm/public/components/app/TransactionDetails/Distribution/__jest__/distribution.test.js
This file was deleted.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
...s/apm/public/components/app/TransactionDetails/Distribution/__test__/distribution.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { getFormattedBuckets } from '../index'; | ||
import { IBucket } from '../../../../../../server/lib/transactions/distribution/get_buckets/transform'; | ||
|
||
describe('Distribution', () => { | ||
it('getFormattedBuckets', () => { | ||
const buckets = [ | ||
{ key: 0, count: 0, samples: [] }, | ||
{ key: 20, count: 0, samples: [] }, | ||
{ key: 40, count: 0, samples: [] }, | ||
{ | ||
key: 60, | ||
count: 5, | ||
samples: [ | ||
{ | ||
transactionId: 'someTransactionId' | ||
} | ||
] | ||
}, | ||
{ | ||
key: 80, | ||
count: 100, | ||
samples: [ | ||
{ | ||
transactionId: 'anotherTransactionId' | ||
} | ||
] | ||
} | ||
] as IBucket[]; | ||
expect(getFormattedBuckets(buckets, 20)).toEqual([ | ||
{ x: 20, x0: 0, y: 0, style: { cursor: 'default' }, samples: [] }, | ||
{ x: 40, x0: 20, y: 0, style: { cursor: 'default' }, samples: [] }, | ||
{ x: 60, x0: 40, y: 0, style: { cursor: 'default' }, samples: [] }, | ||
{ | ||
x: 80, | ||
x0: 60, | ||
y: 5, | ||
style: { cursor: 'pointer' }, | ||
samples: [ | ||
{ | ||
transactionId: 'someTransactionId' | ||
} | ||
] | ||
}, | ||
{ | ||
x: 100, | ||
x0: 80, | ||
y: 100, | ||
style: { cursor: 'pointer' }, | ||
samples: [ | ||
{ | ||
transactionId: 'anotherTransactionId' | ||
} | ||
] | ||
} | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...apm/public/components/app/TransactionDetails/WaterfallWithSummmary/MaybeViewTraceLink.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiButton, EuiFlexItem, EuiToolTip } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { Transaction as ITransaction } from '../../../../../typings/es_schemas/ui/Transaction'; | ||
import { TransactionDetailLink } from '../../../shared/Links/apm/TransactionDetailLink'; | ||
import { IWaterfall } from './WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers'; | ||
|
||
export const MaybeViewTraceLink = ({ | ||
transaction, | ||
waterfall | ||
}: { | ||
transaction: ITransaction; | ||
waterfall: IWaterfall; | ||
}) => { | ||
const viewFullTraceButtonLabel = i18n.translate( | ||
'xpack.apm.transactionDetails.viewFullTraceButtonLabel', | ||
{ | ||
defaultMessage: 'View full trace' | ||
} | ||
); | ||
|
||
// the traceroot cannot be found, so we cannot link to it | ||
if (!waterfall.traceRoot) { | ||
return ( | ||
<EuiFlexItem grow={false}> | ||
<EuiToolTip | ||
content={i18n.translate( | ||
'xpack.apm.transactionDetails.noTraceParentButtonTooltip', | ||
{ | ||
defaultMessage: 'The trace parent cannot be found' | ||
} | ||
)} | ||
> | ||
<EuiButton iconType="apmTrace" disabled={true}> | ||
{viewFullTraceButtonLabel} | ||
</EuiButton> | ||
</EuiToolTip> | ||
</EuiFlexItem> | ||
); | ||
} | ||
|
||
const isRoot = | ||
transaction.transaction.id === waterfall.traceRoot.transaction.id; | ||
|
||
// the user is already viewing the full trace, so don't link to it | ||
if (isRoot) { | ||
return ( | ||
<EuiFlexItem grow={false}> | ||
<EuiToolTip | ||
content={i18n.translate( | ||
'xpack.apm.transactionDetails.viewingFullTraceButtonTooltip', | ||
{ | ||
defaultMessage: 'Currently viewing the full trace' | ||
} | ||
)} | ||
> | ||
<EuiButton iconType="apmTrace" disabled={true}> | ||
{viewFullTraceButtonLabel} | ||
</EuiButton> | ||
</EuiToolTip> | ||
</EuiFlexItem> | ||
); | ||
|
||
// the user is viewing a zoomed in version of the trace. Link to the full trace | ||
} else { | ||
const traceRoot = waterfall.traceRoot; | ||
return ( | ||
<EuiFlexItem grow={false}> | ||
<TransactionDetailLink | ||
serviceName={traceRoot.service.name} | ||
transactionId={traceRoot.transaction.id} | ||
traceId={traceRoot.trace.id} | ||
transactionName={traceRoot.transaction.name} | ||
transactionType={traceRoot.transaction.type} | ||
> | ||
<EuiButton iconType="apmTrace">{viewFullTraceButtonLabel}</EuiButton> | ||
</TransactionDetailLink> | ||
</EuiFlexItem> | ||
); | ||
} | ||
}; |
Oops, something went wrong.