Commit 9f69185
authored
feat: add Sentry traces for Assets Health dashboard (#8310)
Add comprehensive tracing across AssetsController and balance selector
to power an Assets Health dashboard in Sentry. Traces cover data source
timing, errors, full fetch pipeline, update pipeline, subscription
failures, state size (once on app start), and aggregated balance
selector performance.
## Explanation
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:
* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->
## References
<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?
For example:
* Fixes #12345
* Related to #67890
-->
## Checklist
- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Primarily adds non-blocking telemetry (new Sentry trace emissions and
timing measurements) with an optional selector parameter; low functional
impact beyond minor timing/overhead changes.
>
> **Overview**
> Adds comprehensive Sentry tracing across `AssetsController` to power
an Assets Health dashboard, including per-middleware timings and
failures, end-to-end fetch timing, subscription failure reporting,
update/enrichment pipeline timing, and a once-per-session state size
snapshot.
>
> Updates timing measurement to use `performance.now()`, centralizes
trace emission via a safe `#emitTrace` helper, and adjusts tests for the
renamed `AssetsControllerFirstInitFetch` span. Also adds an optional
`trace` callback parameter to `getAggregatedBalanceForAccount` to
measure selector compute time and include asset/network/account counts.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8427f87. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 8c9574c commit 9f69185
4 files changed
Lines changed: 222 additions & 26 deletions
File tree
- packages/assets-controller
- src
- selectors
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
10 | 22 | | |
11 | 23 | | |
12 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1222 | 1222 | | |
1223 | 1223 | | |
1224 | 1224 | | |
1225 | | - | |
1226 | | - | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
1227 | 1232 | | |
1228 | | - | |
| 1233 | + | |
1229 | 1234 | | |
1230 | 1235 | | |
1231 | 1236 | | |
| |||
1271 | 1276 | | |
1272 | 1277 | | |
1273 | 1278 | | |
1274 | | - | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
1275 | 1285 | | |
1276 | 1286 | | |
1277 | 1287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
162 | 173 | | |
163 | 174 | | |
164 | 175 | | |
| |||
509 | 520 | | |
510 | 521 | | |
511 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
512 | 600 | | |
513 | 601 | | |
514 | 602 | | |
| |||
925 | 1013 | | |
926 | 1014 | | |
927 | 1015 | | |
928 | | - | |
| 1016 | + | |
929 | 1017 | | |
930 | 1018 | | |
931 | 1019 | | |
932 | | - | |
| 1020 | + | |
933 | 1021 | | |
934 | 1022 | | |
935 | 1023 | | |
936 | 1024 | | |
| 1025 | + | |
937 | 1026 | | |
938 | | - | |
| 1027 | + | |
939 | 1028 | | |
940 | 1029 | | |
941 | 1030 | | |
| |||
946 | 1035 | | |
947 | 1036 | | |
948 | 1037 | | |
| 1038 | + | |
| 1039 | + | |
949 | 1040 | | |
950 | 1041 | | |
951 | 1042 | | |
| |||
973 | 1064 | | |
974 | 1065 | | |
975 | 1066 | | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
976 | 1089 | | |
977 | 1090 | | |
978 | 1091 | | |
| |||
1008 | 1121 | | |
1009 | 1122 | | |
1010 | 1123 | | |
1011 | | - | |
| 1124 | + | |
1012 | 1125 | | |
1013 | 1126 | | |
1014 | 1127 | | |
| |||
1047 | 1160 | | |
1048 | 1161 | | |
1049 | 1162 | | |
1050 | | - | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
1051 | 1185 | | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
1069 | 1191 | | |
1070 | 1192 | | |
1071 | 1193 | | |
| |||
1669 | 1791 | | |
1670 | 1792 | | |
1671 | 1793 | | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
1672 | 1797 | | |
1673 | 1798 | | |
1674 | 1799 | | |
| |||
1879 | 2004 | | |
1880 | 2005 | | |
1881 | 2006 | | |
| 2007 | + | |
1882 | 2008 | | |
1883 | 2009 | | |
1884 | 2010 | | |
| |||
2099 | 2225 | | |
2100 | 2226 | | |
2101 | 2227 | | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
2102 | 2232 | | |
2103 | 2233 | | |
2104 | 2234 | | |
| |||
2293 | 2423 | | |
2294 | 2424 | | |
2295 | 2425 | | |
| 2426 | + | |
2296 | 2427 | | |
2297 | 2428 | | |
2298 | 2429 | | |
| |||
2318 | 2449 | | |
2319 | 2450 | | |
2320 | 2451 | | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
2321 | 2463 | | |
2322 | 2464 | | |
2323 | 2465 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| |||
394 | 400 | | |
395 | 401 | | |
396 | 402 | | |
| 403 | + | |
397 | 404 | | |
| 405 | + | |
398 | 406 | | |
399 | 407 | | |
400 | 408 | | |
| |||
468 | 476 | | |
469 | 477 | | |
470 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
471 | 503 | | |
472 | 504 | | |
473 | 505 | | |
| |||
0 commit comments