Skip to content

Commit 06b1152

Browse files
committed
Add comments to shouldTrace method
1 parent 2783499 commit 06b1152

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/service/tracing/tracingMiddlewares.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ export const traceUserLandRemainingPipelineMiddleware = () => {
151151
}
152152
}
153153
function shouldTrace(ctx: ServiceContext, rootSpan: SpanContext | undefined) {
154-
// Should trace if path isnt blacklisted and tracing decision came from the edge
154+
/** Should trace if path isnt blacklisted and sampling decision came from the edge
155+
* ((rootSpan as any).isSampled. returns whether or not this span context was sampled
156+
* There is a cast to bypass opentracing typescript
157+
*/
155158
return !PATHS_BLACKLISTED_FOR_TRACING.includes(ctx.request.path) && ((rootSpan as any).isSampled?.() ?? false)
156159
}
157160

0 commit comments

Comments
 (0)