Commit 66c66fd
committed
RUM-17867: Fixes wrong order setting up session sampler and calling
When a new RUM session is created, we are doing two things:
1. Copy the session sampler to the `_rumSessionSampler` variable, used by the WebViewTracking feature to obtain sampling information and properly feed it to the JS bridge, which the Browser SDK will use to decide if traces are sampled or not;
2. Call the user provided `onSessionStart` callback if not nil.
Right now, we are calling `onSessionStart` before we copy the sampler to `_rumSessionSampler.` This created a problem: when a WebView is created and a request issued, all at application launch, it’s possible the first requests issued by the page displayed in the WebView are not traced properly since the sampling information is not yet available. Even if the customer used `onSessionStart` to delay the WebView initialization, the sampling information wouldn’t be in place yet when the callback runs, so the problem remained.
This patch inverts the order, so `onSessionStart` will run only after `_rumSessionSampler` contains the session sampler.onSessionStart.1 parent c436a9a commit 66c66fd
2 files changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
1200 | 1201 | | |
1201 | 1202 | | |
1202 | 1203 | | |
| 1204 | + | |
1203 | 1205 | | |
1204 | 1206 | | |
1205 | 1207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
119 | | - | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
0 commit comments