Skip to content

Commit

Permalink
Add comments to shouldTrace method
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeymisson committed Sep 4, 2023
1 parent 2783499 commit 06b1152
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/service/tracing/tracingMiddlewares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ export const traceUserLandRemainingPipelineMiddleware = () => {
}
}
function shouldTrace(ctx: ServiceContext, rootSpan: SpanContext | undefined) {
// Should trace if path isnt blacklisted and tracing decision came from the edge
/** Should trace if path isnt blacklisted and sampling decision came from the edge
* ((rootSpan as any).isSampled. returns whether or not this span context was sampled
* There is a cast to bypass opentracing typescript
*/
return !PATHS_BLACKLISTED_FOR_TRACING.includes(ctx.request.path) && ((rootSpan as any).isSampled?.() ?? false)
}

0 comments on commit 06b1152

Please sign in to comment.