From 0a7d2338ba486543f674adc2a18ebe4b792dcb41 Mon Sep 17 00:00:00 2001 From: jennypavlova Date: Fri, 7 Mar 2025 15:08:39 +0100 Subject: [PATCH] [APM][Errors] Fix: Missing summary data in in error sample (#213430) Closes #213418 ## Summary This PR fixes the missing error sample summary by adding the missing fields Bug (Before) | Fix (After) |-----------------------|-----------| | image | ![image](https://github.com/user-attachments/assets/c31ef1f6-44fd-442f-a12e-d3df0790cdc5) | ## Testing - Find a service with errors (using edge oblt data or any data that includes the field values shown) - Click on the service and navigate to Errors tab - The Error sample should include the summary data ![image](https://github.com/user-attachments/assets/c86fdc3e-cd88-46b5-a59a-e1b8c7d44bef) (cherry picked from commit 36e930c27346b1a729bea7fc663b6934bbfca403) --- .../shared/kbn-apm-types/src/es_fields/apm.ts | 1 + .../es_fields/__snapshots__/es_fields.test.ts.snap | 6 ++++++ .../error_sampler/error_sample_detail.tsx | 5 ++--- .../get_error_groups/get_error_sample_details.ts | 13 +++++++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/x-pack/platform/packages/shared/kbn-apm-types/src/es_fields/apm.ts b/x-pack/platform/packages/shared/kbn-apm-types/src/es_fields/apm.ts index f3537e332a7e4..5fd1ff31c17ce 100644 --- a/x-pack/platform/packages/shared/kbn-apm-types/src/es_fields/apm.ts +++ b/x-pack/platform/packages/shared/kbn-apm-types/src/es_fields/apm.ts @@ -48,6 +48,7 @@ export const HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code'; export const USER_ID = 'user.id'; export const USER_AGENT_ORIGINAL = 'user_agent.original'; export const USER_AGENT_NAME = 'user_agent.name'; +export const USER_AGENT_VERSION = 'user_agent.version'; export const OBSERVER_VERSION = 'observer.version'; export const OBSERVER_VERSION_MAJOR = 'observer.version_major'; diff --git a/x-pack/solutions/observability/plugins/apm/common/es_fields/__snapshots__/es_fields.test.ts.snap b/x-pack/solutions/observability/plugins/apm/common/es_fields/__snapshots__/es_fields.test.ts.snap index f679686247007..c45bee0a51be0 100644 --- a/x-pack/solutions/observability/plugins/apm/common/es_fields/__snapshots__/es_fields.test.ts.snap +++ b/x-pack/solutions/observability/plugins/apm/common/es_fields/__snapshots__/es_fields.test.ts.snap @@ -372,6 +372,8 @@ exports[`Error USER_AGENT_NAME 1`] = `undefined`; exports[`Error USER_AGENT_ORIGINAL 1`] = `undefined`; +exports[`Error USER_AGENT_VERSION 1`] = `undefined`; + exports[`Error USER_ID 1`] = `undefined`; exports[`Error VALUE_OTEL_JVM_PROCESS_MEMORY_HEAP 1`] = `undefined`; @@ -733,6 +735,8 @@ exports[`Span USER_AGENT_NAME 1`] = `undefined`; exports[`Span USER_AGENT_ORIGINAL 1`] = `undefined`; +exports[`Span USER_AGENT_VERSION 1`] = `undefined`; + exports[`Span USER_ID 1`] = `undefined`; exports[`Span VALUE_OTEL_JVM_PROCESS_MEMORY_HEAP 1`] = `undefined`; @@ -1112,6 +1116,8 @@ exports[`Transaction USER_AGENT_NAME 1`] = `"Other"`; exports[`Transaction USER_AGENT_ORIGINAL 1`] = `"test original"`; +exports[`Transaction USER_AGENT_VERSION 1`] = `undefined`; + exports[`Transaction USER_ID 1`] = `"1337"`; exports[`Transaction VALUE_OTEL_JVM_PROCESS_MEMORY_HEAP 1`] = `undefined`; diff --git a/x-pack/solutions/observability/plugins/apm/public/components/app/error_group_details/error_sampler/error_sample_detail.tsx b/x-pack/solutions/observability/plugins/apm/public/components/app/error_group_details/error_sampler/error_sample_detail.tsx index d6f63c4ff77c6..4d147e78237cb 100644 --- a/x-pack/solutions/observability/plugins/apm/public/components/app/error_group_details/error_sampler/error_sample_detail.tsx +++ b/x-pack/solutions/observability/plugins/apm/public/components/app/error_group_details/error_sampler/error_sample_detail.tsx @@ -158,6 +158,7 @@ export function ErrorSampleDetails({ const errorUrl = error.error.page?.url || error.url?.full; const method = error.http?.request?.method; const status = error.http?.response?.status_code; + const userAgent = error?.user_agent; const environment = error.service.environment; const serviceVersion = error.service.version; const isUnhandled = error.error.exception?.[0]?.handled === false; @@ -249,9 +250,7 @@ export function ErrorSampleDetails({ errorUrl && method ? ( ) : null, - transaction && transaction.user_agent ? ( - - ) : null, + userAgent?.name ? : null, transaction && ( & { transaction?: { id?: string; type?: string }; + user_agent?: { name?: string; version?: string }; error: { id: string; } & Omit & { @@ -90,6 +97,12 @@ export async function getErrorSampleDetails({ ERROR_EXC_MESSAGE, ERROR_EXC_HANDLED, ERROR_EXC_TYPE, + URL_FULL, + HTTP_REQUEST_METHOD, + HTTP_RESPONSE_STATUS_CODE, + TRANSACTION_PAGE_URL, + USER_AGENT_NAME, + USER_AGENT_VERSION, ] as const); const params = {