Repository navigation
Commit af75b2b
authored
feat: browser events in trace waterfall (#3443)
Closes HDX-5774 Stacks on #3440
## Summary
Newer OTel browser SDKs no longer put network timing on fetch and XHR spans. They send one `browser.resource_timing` log per request instead, and the click that started the request is a separate log with no trace id. This draws the timing logs as dots on their spans, like the old SDK's span events, and adds a "Triggered by" row for the click. Old-SDK and backend traces are unchanged.
### Changes
- **Gate** (`hooks/useBrowserTraceEvents.ts`, `utils/browserTraceContext.ts`): both queries run only for traces with a `browser.document.url.full` span, when the correlated log source has Event Name, Event Attributes, Trace Id and Span Id expressions. They start after the waterfall loads and fail quietly.
- **Timing dots** (`utils/resourceTimingMarkers.ts`): `browser.resource_timing` logs are read by TraceId and drawn on their span through the existing span event markers, named like sdk-trace-web's events. The last dot's tooltip shows duration, sizes and protocol, since new-SDK spans don't carry the response size. Dots follow the **Span events** chip.
- **Timing rows**: once the dots load, the log rows they replace leave the waterfall and the log count, so they show for about one round trip first. They stay when the dots aren't visible (**Spans** or **Span events** off, a logs filter) or when the row is selected.
- **Triggered by** (`utils/traceTriggerClick.ts`): the latest `browser.user_action.click` with the same `session.id` and service in the 250 ms before the first browser span, shown first as "Triggered by: Clicked … · 3ms before". Clicking it opens the click log. It doesn't match on page URL: the SDK records the click's URL before the handler changes the route or query string.
- **Shared code**: E2's session log query parts move to `getSessionLogEventQueryParts` (`utils/sessionLogEvents.ts`) for the trigger query. E2's SQL is unchanged.
### Screenshots
Example of a browser event triggering this trace, along with timing events on the span:
<img width="1418" height="411" alt="Example of a browser event triggering this trace, along with timing events on the span" src="https://github.com/user-attachments/assets/3433d341-2b0c-4fc6-b3dd-cf06ad8f9585" />1 parent 253a690 commit af75b2b
20 files changed
Lines changed: 2272 additions & 89 deletions
File tree
- .changeset
- packages/app
- src
- components
- TimelineChart
- __tests__
- hooks
- __fixtures__
- __tests__
- utils
- __tests__
- tests/e2e
- features
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| 112 | + | |
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| |||
785 | 788 | | |
786 | 789 | | |
787 | 790 | | |
788 | | - | |
| 791 | + | |
789 | 792 | | |
790 | 793 | | |
791 | 794 | | |
792 | 795 | | |
| 796 | + | |
793 | 797 | | |
794 | 798 | | |
795 | 799 | | |
| |||
816 | 820 | | |
817 | 821 | | |
818 | 822 | | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
819 | 845 | | |
820 | | - | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
821 | 850 | | |
822 | 851 | | |
823 | 852 | | |
| |||
833 | 862 | | |
834 | 863 | | |
835 | 864 | | |
836 | | - | |
| 865 | + | |
837 | 866 | | |
838 | 867 | | |
839 | 868 | | |
| |||
983 | 1012 | | |
984 | 1013 | | |
985 | 1014 | | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | 1015 | | |
990 | 1016 | | |
991 | 1017 | | |
| |||
1128 | 1154 | | |
1129 | 1155 | | |
1130 | 1156 | | |
| 1157 | + | |
| 1158 | + | |
1131 | 1159 | | |
1132 | 1160 | | |
1133 | 1161 | | |
| |||
1137 | 1165 | | |
1138 | 1166 | | |
1139 | 1167 | | |
1140 | | - | |
| 1168 | + | |
1141 | 1169 | | |
1142 | 1170 | | |
1143 | 1171 | | |
| |||
1178 | 1206 | | |
1179 | 1207 | | |
1180 | 1208 | | |
| 1209 | + | |
1181 | 1210 | | |
1182 | 1211 | | |
1183 | 1212 | | |
| |||
1193 | 1222 | | |
1194 | 1223 | | |
1195 | 1224 | | |
1196 | | - | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
1197 | 1230 | | |
1198 | 1231 | | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
1202 | 1235 | | |
1203 | 1236 | | |
1204 | 1237 | | |
1205 | 1238 | | |
1206 | 1239 | | |
1207 | 1240 | | |
1208 | 1241 | | |
1209 | | - | |
1210 | | - | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
1211 | 1253 | | |
1212 | 1254 | | |
1213 | 1255 | | |
| |||
1316 | 1358 | | |
1317 | 1359 | | |
1318 | 1360 | | |
1319 | | - | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
1320 | 1368 | | |
1321 | 1369 | | |
1322 | 1370 | | |
| |||
1327 | 1375 | | |
1328 | 1376 | | |
1329 | 1377 | | |
1330 | | - | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
1331 | 1382 | | |
1332 | 1383 | | |
1333 | 1384 | | |
| |||
1347 | 1398 | | |
1348 | 1399 | | |
1349 | 1400 | | |
1350 | | - | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
1351 | 1404 | | |
1352 | 1405 | | |
1353 | 1406 | | |
| |||
1373 | 1426 | | |
1374 | 1427 | | |
1375 | 1428 | | |
| 1429 | + | |
1376 | 1430 | | |
1377 | 1431 | | |
1378 | 1432 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
0 commit comments