[UI Errors] Change errorType label to error_type (#224668)

## Summary

When checking the Overview cluster, I noticed that we previously had
`labels.error_type` in APM. In this PR, I changed the label that I've
added in the following PRs for fatal react errors and toast errors to
use `labels.error_type` instead of `labels.errorType` for consistency.

- Toast error: https://github.com/elastic/kibana/pull/217948
- Fatal react error: https://github.com/elastic/kibana/pull/218846
This commit is contained in:
Maryam Saeidi 2025-06-24 10:03:38 +02:00 committed by GitHub
parent 3cc4fb702d
commit 970cad1f18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 9 additions and 9 deletions

View file

@ -215,7 +215,7 @@ describe('#addDanger()', () => {
const toasts = new ToastsApi(toastDeps()); const toasts = new ToastsApi(toastDeps());
expect(toasts.addDanger({})).toHaveProperty('color', 'danger'); expect(toasts.addDanger({})).toHaveProperty('color', 'danger');
expect(apm.captureError).toBeCalledWith('No title or text is provided.', { expect(apm.captureError).toBeCalledWith('No title or text is provided.', {
labels: { errorType: 'ToastDanger' }, labels: { error_type: 'ToastDanger' },
}); });
}); });
@ -225,7 +225,7 @@ describe('#addDanger()', () => {
const currentToasts = await getCurrentToasts(toasts); const currentToasts = await getCurrentToasts(toasts);
expect(currentToasts[0]).toBe(toast); expect(currentToasts[0]).toBe(toast);
expect(apm.captureError).toBeCalledWith('No title or text is provided.', { expect(apm.captureError).toBeCalledWith('No title or text is provided.', {
labels: { errorType: 'ToastDanger' }, labels: { error_type: 'ToastDanger' },
}); });
}); });
@ -234,7 +234,7 @@ describe('#addDanger()', () => {
const toast = toasts.addDanger({ title: 'foo', toastLifeTimeMs: undefined }); const toast = toasts.addDanger({ title: 'foo', toastLifeTimeMs: undefined });
expect(toast.toastLifeTimeMs).toEqual(10000); expect(toast.toastLifeTimeMs).toEqual(10000);
expect(apm.captureError).toBeCalledWith('foo', { expect(apm.captureError).toBeCalledWith('foo', {
labels: { errorType: 'ToastDanger' }, labels: { error_type: 'ToastDanger' },
}); });
}); });
}); });
@ -248,7 +248,7 @@ describe('#addError', () => {
expect(toast).toHaveProperty('color', 'danger'); expect(toast).toHaveProperty('color', 'danger');
expect(toast).toHaveProperty('title', 'Something went wrong'); expect(toast).toHaveProperty('title', 'Something went wrong');
expect(apm.captureError).toBeCalledWith(error, { expect(apm.captureError).toBeCalledWith(error, {
labels: { errorType: 'ToastError' }, labels: { error_type: 'ToastError' },
}); });
}); });
@ -260,7 +260,7 @@ describe('#addError', () => {
const currentToasts = await getCurrentToasts(toasts); const currentToasts = await getCurrentToasts(toasts);
expect(currentToasts[0]).toBe(toast); expect(currentToasts[0]).toBe(toast);
expect(apm.captureError).toBeCalledWith(error, { expect(apm.captureError).toBeCalledWith(error, {
labels: { errorType: 'ToastError' }, labels: { error_type: 'ToastError' },
}); });
}); });
}); });

View file

@ -49,7 +49,7 @@ const getToastTitleOrText = (toastOrTitle: ToastInput): string => {
const getApmLabels = (errorType: 'ToastError' | 'ToastDanger') => { const getApmLabels = (errorType: 'ToastError' | 'ToastDanger') => {
return { return {
errorType, error_type: errorType,
}; };
}; };

View file

@ -11,6 +11,6 @@ export const getErrorBoundaryLabels = (
errorType: 'PageFatalReactError' | 'SectionFatalReactError' errorType: 'PageFatalReactError' | 'SectionFatalReactError'
) => { ) => {
return { return {
errorType, error_type: errorType,
}; };
}; };

View file

@ -135,7 +135,7 @@ describe('<KibanaErrorBoundary>', () => {
expect(apm.captureError).toHaveBeenCalledTimes(1); expect(apm.captureError).toHaveBeenCalledTimes(1);
expect(apm.captureError).toHaveBeenCalledWith( expect(apm.captureError).toHaveBeenCalledWith(
new Error('This is an error to show the test user!'), new Error('This is an error to show the test user!'),
{ labels: { errorType: 'PageFatalReactError' } } { labels: { error_type: 'PageFatalReactError' } }
); );
}); });
}); });

View file

@ -131,7 +131,7 @@ describe('<KibanaSectionErrorBoundary>', () => {
expect(apm.captureError).toHaveBeenCalledTimes(1); expect(apm.captureError).toHaveBeenCalledTimes(1);
expect(apm.captureError).toHaveBeenCalledWith( expect(apm.captureError).toHaveBeenCalledWith(
new Error('This is an error to show the test user!'), new Error('This is an error to show the test user!'),
{ labels: { errorType: 'SectionFatalReactError' } } { labels: { error_type: 'SectionFatalReactError' } }
); );
}); });
}); });