Commit c8686ff
authored
fix(core): Only start spans in
In our (still internal) `trace` function, we don't yet check if
`hasTracingEnabled` returns `true` before trying to start a span or a
transaction. This leads to the following problematic UX path that was
discovered
[here](#5838 (reply in thread)):
1. Users don't set `tracesSampleRate` (or `tracesSampler`), causing some
SDKs (NextJS, SvelteKit) to **not** add the `BrowserTracing`
integration, which in turn means that tracing extension methods are not
added/registered.
2. Users or, more likely, other parts of our SDK (e.g. SvelteKit's
wrappers/handlers) call `trace` which will still try to start a
span/txn.
3. Users will get a console warning that tracing extension methods were
not installed and they should manually call `addExtensionMethods` which
is completely misleading in this case.
This fix makes `trace` check for `hasTracingEnabled()` in which case it
will not start a span but just invoke the error callback if an error
occurred.trace if tracing is enabled (#8357)1 parent 9d8464b commit c8686ff
File tree
2 files changed
+41
-3
lines changed- packages/core
- src/tracing
- test/lib/tracing
2 files changed
+41
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
35 | 45 | | |
36 | 46 | | |
37 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
188 | 216 | | |
189 | 217 | | |
0 commit comments