Skip to content

Commit

Permalink
[APM][Errors] Fix: Missing summary data in in error sample (elastic#2…
Browse files Browse the repository at this point in the history
…13430)

Closes elastic#213418
## Summary

This PR fixes the missing error sample summary by adding the missing
fields

Bug (Before) | Fix (After)
|-----------------------|-----------|
| <img width="1912" alt="image"
src="https://github.com/user-attachments/assets/f7a9b007-529d-422d-b0e2-eac2e06c26b1"
/> |
![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 36e930c)
  • Loading branch information
jennypavlova committed Mar 7, 2025
1 parent 0ae7625 commit 4531fef
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/kbn-apm-types/src/es_fields/apm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,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';
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,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;
Expand Down Expand Up @@ -248,9 +249,7 @@ export function ErrorSampleDetails({
errorUrl && method ? (
<HttpInfoSummaryItem url={errorUrl} method={method} status={status} />
) : null,
transaction && transaction.user_agent ? (
<UserAgentSummaryItem {...transaction.user_agent} />
) : null,
userAgent?.name ? <UserAgentSummaryItem {...userAgent} /> : null,
transaction && (
<EuiToolTip
content={i18n.translate('xpack.apm.errorSampleDetails.relatedTransactionSample', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ import {
ERROR_STACK_TRACE,
SPAN_ID,
SERVICE_LANGUAGE_NAME,
URL_FULL,
HTTP_REQUEST_METHOD,
HTTP_RESPONSE_STATUS_CODE,
TRANSACTION_PAGE_URL,
USER_AGENT_NAME,
USER_AGENT_VERSION,
} from '../../../../common/es_fields/apm';
import { environmentQuery } from '../../../../common/utils/environment_query';
import { ApmDocumentType } from '../../../../common/document_type';
Expand All @@ -42,6 +48,7 @@ export interface ErrorSampleDetailsResponse {
transaction: Transaction | undefined;
error: Omit<APMError, 'transaction' | 'error'> & {
transaction?: { id?: string; type?: string };
user_agent?: { name?: string; version?: string };
error: {
id: string;
} & Omit<APMError['error'], 'exception' | 'log'> & {
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 4531fef

Please sign in to comment.