Skip to content

Commit

Permalink
[server] tracing: fix creation of "FOLLOWS_FROM" reference
Browse files Browse the repository at this point in the history
  • Loading branch information
geropl authored and roboquat committed Dec 15, 2021
1 parent af13739 commit 38c3d8e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/gitpod-protocol/src/util/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ export type TraceContextWithSpan = TraceContext & {


export namespace TraceContext {
export function startSpan(operation: string, parentCtx?: TraceContext, ...referencedSpans: (opentracing.Span | opentracing.SpanContext | undefined)[]): opentracing.Span {
export function startSpan(operation: string, parentCtx?: TraceContext, ...referencedSpans: (opentracing.Span | undefined)[]): opentracing.Span {
const options: opentracing.SpanOptions = {};
if (parentCtx) {
options.childOf = parentCtx.span;
}
if (referencedSpans) {
options.references = referencedSpans.filter(s => s !== undefined).map(s => followsFrom(s!));
// note: allthough followsForm's type says it takes 'opentracing.Span | opentracing.SpanContext', it only works with SpanContext (typing mismatch)
options.references = referencedSpans.filter(s => s !== undefined).map(s => followsFrom(s!.context()));
}

return opentracing.globalTracer().startSpan(operation, options);
Expand Down

0 comments on commit 38c3d8e

Please sign in to comment.