Commit b80a55c
# Backport
This will backport the following commits from `main` to `8.19`:
- [Use RUM label for fatal react errors
(#218846)](#218846)
<!--- Backport version: 9.6.6 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT [{"author":{"name":"Maryam
Saeidi","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-04-29T08:14:48Z","message":"Use
RUM label for fatal react errors (#218846)\n\nCloses
https://github.com/elastic/observability-dev/issues/4463\n\n##
Summary\n\nSince we now have support for error labels in
RUM\n([PR](elastic/apm-agent-rum-js#1594)), this
PR\nchanges the way that we report rum errors to use labels similar to
what\nwe've done for toast
errors\n([PR](https://github.com/elastic/kibana/pull/217948)).\n\n\n\nhttps://github.com/user-attachments/assets/87a06ceb-705c-4c6e-ab26-d3e5874fe5ad\n\n\n###
⚠️ Note\n\nIn local development, the error is captured twice because
react bubbles\nup the error, but it does not happen in
production:\n([doc](https://react.dev/reference/react/Component#componentdidcatch-caveats))\n\n>
Production and development builds of React slightly differ in the
way\ncomponentDidCatch handles errors. In development, the errors will
bubble\nup to window, which means that any window.onerror
or\nwindow.addEventListener('error', callback) will intercept the
errors\nthat have been caught by componentDidCatch. In production,
instead, the\nerrors will not bubble up, which means any ancestor error
handler will\nonly receive errors not explicitly caught by
componentDidCatch.\n\n### 🧪 How to test\n\nAdd the following to your
kibana.yml file:\n\n```\nelastic.apm.active:
true\nelastic.apm.transactionSampleRate: 1.0\nelastic.apm.environment:
yourName <-- Change to your name\n```\n<details>\n<summary>Throw a fatal
react error</summary>\n\nThrow an error in the
[alerts\npage](https://github.com/elastic/kibana/blob/main/x-pack/solutions/observability/plugins/observability/public/pages/alerts/alerts.tsx)\nand
visit
http://localhost:5601/kibana/app/observability/alerts\n\n</details>\n\nThen
visit\n[kibana-cloud-apm.elastic.dev](https://kibana-cloud-apm.elastic.dev/app/apm/services/kibana-frontend/errors?comparisonEnabled=true&environment=ENVIRONMENT_ALL&kuery=&latencyAggregationType=avg&offset=1d&rangeFrom=now-1h&rangeTo=now&serviceGroup=&transactionType=page-load)\nfiltered
for `yourName` in the
environment.","sha":"cea253dcc67ed2cfb460a0707ac1e66cdb9180fa","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.1.0","v8.19.0"],"title":"Use
RUM label for fatal react
errors","number":218846,"url":"https://github.com/elastic/kibana/pull/218846","mergeCommit":{"message":"Use
RUM label for fatal react errors (#218846)\n\nCloses
https://github.com/elastic/observability-dev/issues/4463\n\n##
Summary\n\nSince we now have support for error labels in
RUM\n([PR](elastic/apm-agent-rum-js#1594)), this
PR\nchanges the way that we report rum errors to use labels similar to
what\nwe've done for toast
errors\n([PR](https://github.com/elastic/kibana/pull/217948)).\n\n\n\nhttps://github.com/user-attachments/assets/87a06ceb-705c-4c6e-ab26-d3e5874fe5ad\n\n\n###
⚠️ Note\n\nIn local development, the error is captured twice because
react bubbles\nup the error, but it does not happen in
production:\n([doc](https://react.dev/reference/react/Component#componentdidcatch-caveats))\n\n>
Production and development builds of React slightly differ in the
way\ncomponentDidCatch handles errors. In development, the errors will
bubble\nup to window, which means that any window.onerror
or\nwindow.addEventListener('error', callback) will intercept the
errors\nthat have been caught by componentDidCatch. In production,
instead, the\nerrors will not bubble up, which means any ancestor error
handler will\nonly receive errors not explicitly caught by
componentDidCatch.\n\n### 🧪 How to test\n\nAdd the following to your
kibana.yml file:\n\n```\nelastic.apm.active:
true\nelastic.apm.transactionSampleRate: 1.0\nelastic.apm.environment:
yourName <-- Change to your name\n```\n<details>\n<summary>Throw a fatal
react error</summary>\n\nThrow an error in the
[alerts\npage](https://github.com/elastic/kibana/blob/main/x-pack/solutions/observability/plugins/observability/public/pages/alerts/alerts.tsx)\nand
visit
http://localhost:5601/kibana/app/observability/alerts\n\n</details>\n\nThen
visit\n[kibana-cloud-apm.elastic.dev](https://kibana-cloud-apm.elastic.dev/app/apm/services/kibana-frontend/errors?comparisonEnabled=true&environment=ENVIRONMENT_ALL&kuery=&latencyAggregationType=avg&offset=1d&rangeFrom=now-1h&rangeTo=now&serviceGroup=&transactionType=page-load)\nfiltered
for `yourName` in the
environment.","sha":"cea253dcc67ed2cfb460a0707ac1e66cdb9180fa"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218846","number":218846,"mergeCommit":{"message":"Use
RUM label for fatal react errors (#218846)\n\nCloses
https://github.com/elastic/observability-dev/issues/4463\n\n##
Summary\n\nSince we now have support for error labels in
RUM\n([PR](elastic/apm-agent-rum-js#1594)), this
PR\nchanges the way that we report rum errors to use labels similar to
what\nwe've done for toast
errors\n([PR](https://github.com/elastic/kibana/pull/217948)).\n\n\n\nhttps://github.com/user-attachments/assets/87a06ceb-705c-4c6e-ab26-d3e5874fe5ad\n\n\n###
⚠️ Note\n\nIn local development, the error is captured twice because
react bubbles\nup the error, but it does not happen in
production:\n([doc](https://react.dev/reference/react/Component#componentdidcatch-caveats))\n\n>
Production and development builds of React slightly differ in the
way\ncomponentDidCatch handles errors. In development, the errors will
bubble\nup to window, which means that any window.onerror
or\nwindow.addEventListener('error', callback) will intercept the
errors\nthat have been caught by componentDidCatch. In production,
instead, the\nerrors will not bubble up, which means any ancestor error
handler will\nonly receive errors not explicitly caught by
componentDidCatch.\n\n### 🧪 How to test\n\nAdd the following to your
kibana.yml file:\n\n```\nelastic.apm.active:
true\nelastic.apm.transactionSampleRate: 1.0\nelastic.apm.environment:
yourName <-- Change to your name\n```\n<details>\n<summary>Throw a fatal
react error</summary>\n\nThrow an error in the
[alerts\npage](https://github.com/elastic/kibana/blob/main/x-pack/solutions/observability/plugins/observability/public/pages/alerts/alerts.tsx)\nand
visit
http://localhost:5601/kibana/app/observability/alerts\n\n</details>\n\nThen
visit\n[kibana-cloud-apm.elastic.dev](https://kibana-cloud-apm.elastic.dev/app/apm/services/kibana-frontend/errors?comparisonEnabled=true&environment=ENVIRONMENT_ALL&kuery=&latencyAggregationType=avg&offset=1d&rangeFrom=now-1h&rangeTo=now&serviceGroup=&transactionType=page-load)\nfiltered
for `yourName` in the
environment.","sha":"cea253dcc67ed2cfb460a0707ac1e66cdb9180fa"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Co-authored-by: Maryam Saeidi <[email protected]>
1 parent dcf064a commit b80a55c
File tree
9 files changed
+37
-57
lines changed9 files changed
+37
-57
lines changedLines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 45 | + | |
48 | 46 | | |
49 | 47 | | |
50 | 48 | | |
| |||
Lines changed: 3 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 137 | + | |
| 138 | + | |
146 | 139 | | |
147 | 140 | | |
148 | 141 | | |
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
Lines changed: 3 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 133 | + | |
| 134 | + | |
142 | 135 | | |
143 | 136 | | |
144 | 137 | | |
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
0 commit comments