From a0dabcde4c705b3a9fc68fa3eb6b805f8e60a1bf Mon Sep 17 00:00:00 2001 From: Kate Patticha Date: Fri, 22 Jul 2022 10:17:55 +0200 Subject: [PATCH 1/3] [APM] Diplay logs only matching `trace.id` query --- .../waterfall_with_summary/transaction_tabs.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/transaction_tabs.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/transaction_tabs.tsx index bdef27722c2a0..d04609cd03e76 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/transaction_tabs.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/transaction_tabs.tsx @@ -128,7 +128,7 @@ function LogsTabContent({ transaction }: { transaction: Transaction }) { logView={{ type: 'log-view-reference', logViewId: 'default' }} startTimestamp={startTimestamp - framePaddingMs} endTimestamp={endTimestamp + framePaddingMs} - query={`trace.id:"${transaction.trace.id}" OR "${transaction.trace.id}"`} + query={`trace.id:"${transaction.trace.id}"`} height={640} columns={[ { type: 'timestamp' }, From 1585430244d3d047ea439564121a66648b451a07 Mon Sep 17 00:00:00 2001 From: Kate Patticha Date: Fri, 29 Jul 2022 14:44:40 +0200 Subject: [PATCH 2/3] Fix log stream query --- .../waterfall_with_summary/transaction_tabs.tsx | 2 +- .../components/shared/transaction_action_menu/sections.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/transaction_tabs.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/transaction_tabs.tsx index d04609cd03e76..44ac77180d67c 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/transaction_tabs.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/transaction_tabs.tsx @@ -128,7 +128,7 @@ function LogsTabContent({ transaction }: { transaction: Transaction }) { logView={{ type: 'log-view-reference', logViewId: 'default' }} startTimestamp={startTimestamp - framePaddingMs} endTimestamp={endTimestamp + framePaddingMs} - query={`trace.id:"${transaction.trace.id}"`} + query={`trace.id:"${transaction.trace.id}" OR (not trace.id:* AND "${transaction.trace.id})"`} height={640} columns={[ { type: 'timestamp' }, diff --git a/x-pack/plugins/apm/public/components/shared/transaction_action_menu/sections.ts b/x-pack/plugins/apm/public/components/shared/transaction_action_menu/sections.ts index 29db2d09b3bcf..144658746175f 100644 --- a/x-pack/plugins/apm/public/components/shared/transaction_action_menu/sections.ts +++ b/x-pack/plugins/apm/public/components/shared/transaction_action_menu/sections.ts @@ -168,7 +168,7 @@ export const getSections = ({ path: `/link-to/logs`, query: { time, - filter: `trace.id:"${transaction.trace.id}" OR "${transaction.trace.id}"`, + filter: `trace.id:"${transaction.trace.id}" OR (not trace.id:* AND "${transaction.trace.id}")`, }, }), condition: true, From 78d8e013cec59f684dd22f3990a04f8953d45f80 Mon Sep 17 00:00:00 2001 From: Kate Patticha Date: Mon, 1 Aug 2022 10:59:59 +0200 Subject: [PATCH 3/3] Update unit tests --- .../shared/transaction_action_menu/sections.test.ts | 6 +++--- .../transaction_action_menu.test.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/apm/public/components/shared/transaction_action_menu/sections.test.ts b/x-pack/plugins/apm/public/components/shared/transaction_action_menu/sections.test.ts index 2b3a08028ccec..c0b67dfc02e33 100644 --- a/x-pack/plugins/apm/public/components/shared/transaction_action_menu/sections.test.ts +++ b/x-pack/plugins/apm/public/components/shared/transaction_action_menu/sections.test.ts @@ -55,7 +55,7 @@ describe('Transaction action menu', () => { { key: 'traceLogs', label: 'Trace logs', - href: 'some-basepath/app/logs/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20%22123%22', + href: 'some-basepath/app/logs/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20(not%20trace.id:*%20AND%20%22123%22)', condition: true, }, ], @@ -122,7 +122,7 @@ describe('Transaction action menu', () => { { key: 'traceLogs', label: 'Trace logs', - href: 'some-basepath/app/logs/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20%22123%22', + href: 'some-basepath/app/logs/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20(not%20trace.id:*%20AND%20%22123%22)', condition: true, }, ], @@ -188,7 +188,7 @@ describe('Transaction action menu', () => { { key: 'traceLogs', label: 'Trace logs', - href: 'some-basepath/app/logs/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20%22123%22', + href: 'some-basepath/app/logs/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20(not%20trace.id:*%20AND%20%22123%22)', condition: true, }, ], diff --git a/x-pack/plugins/apm/public/components/shared/transaction_action_menu/transaction_action_menu.test.tsx b/x-pack/plugins/apm/public/components/shared/transaction_action_menu/transaction_action_menu.test.tsx index 9c5dd2bbe03b6..25e1277ebe0c3 100644 --- a/x-pack/plugins/apm/public/components/shared/transaction_action_menu/transaction_action_menu.test.tsx +++ b/x-pack/plugins/apm/public/components/shared/transaction_action_menu/transaction_action_menu.test.tsx @@ -88,7 +88,7 @@ describe('TransactionActionMenu component', () => { expect( (getByText('Trace logs').parentElement as HTMLAnchorElement).href ).toEqual( - 'http://localhost/basepath/app/logs/link-to/logs?time=1545092070952&filter=trace.id:%228b60bd32ecc6e1506735a8b6cfcf175c%22%20OR%20%228b60bd32ecc6e1506735a8b6cfcf175c%22' + 'http://localhost/basepath/app/logs/link-to/logs?time=1545092070952&filter=trace.id:%228b60bd32ecc6e1506735a8b6cfcf175c%22%20OR%20(not%20trace.id:*%20AND%20%228b60bd32ecc6e1506735a8b6cfcf175c%22)' ); });