[Logs + Metrics UI] Use getTraceURL
for APM trace links (#52875)
* Use `getTraceURL` for APM trace links * Fix tests * Check for the presence of APM links Since now we use a helper provided by APM it no longer makes sense to test for the actual URL (because that only tests the function). Instead just test that the link exists and that it has an `href`.
This commit is contained in:
parent
bb98e9a2b8
commit
3137b07b57
|
@ -188,11 +188,7 @@ describe('LogEntryActionsMenu component', () => {
|
|||
|
||||
expect(
|
||||
elementWrapper.find(`a${testSubject('~apmLogEntryActionsMenuItem')}`).prop('href')
|
||||
).toMatchInlineSnapshot(
|
||||
`"/app/apm#/traces?kuery=${encodeURIComponent(
|
||||
'trace.id:1234567'
|
||||
)}&rangeFrom=now-1y&rangeTo=now"`
|
||||
);
|
||||
).toBeDefined();
|
||||
});
|
||||
|
||||
it('renders with a trace id filter and timestamp when present in log entry', () => {
|
||||
|
@ -224,11 +220,7 @@ describe('LogEntryActionsMenu component', () => {
|
|||
|
||||
expect(
|
||||
elementWrapper.find(`a${testSubject('~apmLogEntryActionsMenuItem')}`).prop('href')
|
||||
).toMatchInlineSnapshot(
|
||||
`"/app/apm#/traces?kuery=${encodeURIComponent(
|
||||
'trace.id:1234567'
|
||||
)}&rangeFrom=2019-06-27T17:34:08.693Z&rangeTo=2019-06-27T17:54:08.693Z"`
|
||||
);
|
||||
).toBeDefined();
|
||||
});
|
||||
|
||||
it('renders as disabled when no supported field is present in log entry', () => {
|
||||
|
|
|
@ -12,6 +12,7 @@ import url from 'url';
|
|||
import chrome from 'ui/chrome';
|
||||
import { InfraLogItem } from '../../../graphql/types';
|
||||
import { useVisibilityState } from '../../../utils/use_visibility_state';
|
||||
import { getTraceUrl } from '../../../../../apm/public/components/shared/Links/apm/ExternalLinks';
|
||||
|
||||
const UPTIME_FIELDS = ['container.id', 'host.ip', 'kubernetes.pod.uid'];
|
||||
|
||||
|
@ -123,8 +124,6 @@ const getAPMLink = (logItem: InfraLogItem) => {
|
|||
|
||||
return url.format({
|
||||
pathname: chrome.addBasePath('/app/apm'),
|
||||
hash: `/traces?kuery=${encodeURIComponent(
|
||||
`trace.id:${traceIdEntry.value}`
|
||||
)}&rangeFrom=${rangeFrom}&rangeTo=${rangeTo}`,
|
||||
hash: getTraceUrl({ traceId: traceIdEntry.value, rangeFrom, rangeTo }),
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue