Commit 39b3602
committed
Track toast errors using apm-rum (elastic#217948)
Closes elastic/observability-dev#4022
## Summary
In this PR, we are capturing toast errors using apm-rum:
https://github.com/user-attachments/assets/b61529f9-ab8e-4171-9042-0884e11eb385
ErrorType is available in labels which this feature was added to the rum
agent in this
[PR](elastic/apm-agent-rum-js#1594).
### 🧪 How to test
Add the following to your kibana.yml file:
```
elastic.apm.active: true
elastic.apm.transactionSampleRate: 1.0
elastic.apm.environment: yourName <-- Change to your name
```
<details>
<summary>Throw a toast error</summary>
Add this code to a page as [alerts
page](https://github.com/elastic/kibana/blob/main/x-pack/solutions/observability/plugins/observability/public/pages/alerts/alerts.tsx)
and visit http://localhost:5601/kibana/app/observability/alerts
```
useEffect(() => {
const error = new Error('Mary test error > toasts.addError');
toasts.addError(error, { title: 'Testing error toast', toastMessage: error.message });
toasts.addDanger('Testing danger toast');
}, []);
```
</details>
Then visit
[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)
filtered for `yourName` in the environment.
(cherry picked from commit ae9e5d6)
# Conflicts:
# src/core/packages/notifications/browser-internal/src/toasts/toasts_api.tsx1 parent 3429d03 commit 39b3602
File tree
2 files changed
+52
-2
lines changed- src/core/packages/notifications/browser-internal/src/toasts
2 files changed
+52
-2
lines changedLines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| |||
213 | 220 | | |
214 | 221 | | |
215 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
216 | 226 | | |
217 | 227 | | |
218 | 228 | | |
219 | 229 | | |
220 | 230 | | |
221 | 231 | | |
222 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
223 | 236 | | |
224 | 237 | | |
225 | 238 | | |
226 | 239 | | |
227 | 240 | | |
228 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
229 | 245 | | |
230 | 246 | | |
231 | 247 | | |
232 | 248 | | |
233 | 249 | | |
234 | 250 | | |
235 | 251 | | |
236 | | - | |
| 252 | + | |
| 253 | + | |
237 | 254 | | |
238 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
239 | 259 | | |
240 | 260 | | |
241 | 261 | | |
242 | 262 | | |
243 | 263 | | |
244 | | - | |
| 264 | + | |
| 265 | + | |
245 | 266 | | |
246 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
247 | 271 | | |
248 | 272 | | |
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
40 | 59 | | |
41 | 60 | | |
42 | 61 | | |
| |||
158 | 177 | | |
159 | 178 | | |
160 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
161 | 184 | | |
162 | 185 | | |
163 | 186 | | |
| |||
175 | 198 | | |
176 | 199 | | |
177 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
178 | 204 | | |
179 | 205 | | |
180 | 206 | | |
| |||
0 commit comments