Commit fee86b0
authored
fix(browser): Ensure
This changes the behavior of `suppressTracing` to be less problematic
(or, problematic in a different way).
Today, because in the browser we do not have async context isolation,
there is only a single shared top scope. Because of this, if you have
code like this:
```js
const spanPromise = suppressTracing(async () => {
await new Promise(resolve => setTimeout(resolve, 100));
return startInactiveSpan({ name: 'span' });
});
const span = startInactiveSpan({ name: 'span2' });
```
The span2 will also be suppressed, because `suppressTracing` forks the
scope and sets data on it to ensure spans are not recorded. This is
problematic as that will result in completely unrelated spans, e.g.
pageload/navigation spans, being suppressed while e.g. an ongoing fetch
call that is suppressed happens.
This PR changes this to instead only suppress tracing synchronously in
the browser. This obviously is also not really ideal and can lead to
things _not_ being suppressed, but it feels like the better tradeoff for
now.suppressTracing does not leak when async (#16545)1 parent 91ee98d commit fee86b0
File tree
4 files changed
+83
-1
lines changed- packages
- cloudflare/src
- core
- src/tracing
- test/lib/tracing
- opentelemetry/test
4 files changed
+83
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
67 | 75 | | |
| 76 | + | |
68 | 77 | | |
69 | 78 | | |
70 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
256 | 261 | | |
257 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
258 | 265 | | |
259 | 266 | | |
260 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1975 | 1975 | | |
1976 | 1976 | | |
1977 | 1977 | | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
1978 | 2012 | | |
1979 | 2013 | | |
1980 | 2014 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1921 | 1921 | | |
1922 | 1922 | | |
1923 | 1923 | | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
1924 | 1956 | | |
1925 | 1957 | | |
1926 | 1958 | | |
| |||
0 commit comments