Skip to content

Commit b4eb92d

Browse files
committed
add todo
1 parent 89d9878 commit b4eb92d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/tracing/src/browser/request.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ export function _fetchCallback(
159159

160160
const activeTransaction = getActiveTransaction();
161161
if (activeTransaction) {
162+
// TODO: If sampled = false, we're creating a span here merely to be able to use the toTraceparent method (the span
163+
// won't be stored anywhere, so it'll get garbage collected when it goes out of scope here). Further, that header is
164+
// going to contain a parentId for a span which won't exist past this moment, which feels like a little bit of a
165+
// lie. (If the sampling decision is inherited on the backend, it doesn't matter, but in case it isn't...) Perhaps
166+
// toTraceparent should be a function instead, and return a header w a traceId and sampling decision but no parentId
167+
// if the parent is unsampled? (The same thing applies to the XHR callback.)
162168
const span = activeTransaction.startChild({
163169
data: {
164170
...handlerData.fetchData,

0 commit comments

Comments
 (0)