Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getOrInjectContext(
headerWrapper: HeaderWrapper
): context.SpanContext {
let spanContext = context.extract(headerWrapper);
if (spanContext) {
return spanContext;
}
// We were the first actor to detect lack of context. Establish context.
spanContext = context.generate();
context.inject(headerWrapper, spanContext);
return spanContext;
}