Skip to content

Commit

Permalink
mess with tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev committed Apr 13, 2022
1 parent 1a4d2fb commit 8470ee7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/gitpod-protocol/src/util/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ export type TraceContextWithSpan = TraceContext & {
export namespace TraceContext {
export function startSpan(operation: string, parentCtx?: TraceContext): opentracing.Span {
const options: opentracing.SpanOptions = {};
if (parentCtx && parentCtx.span && !!parentCtx.span.context().toSpanId()) {
options.childOf = parentCtx.span;

// try out: https://github.com/jaegertracing/jaeger-client-node/issues/432
if (!!parentCtx?.span) {
options.references = [opentracing.followsFrom(parentCtx?.span)];
}

// if (parentCtx && parentCtx.span && !!parentCtx.span.context().toSpanId()) {
// options.childOf = parentCtx.span;
// }

// TODO(gpl) references lead to a huge amount of errors in prod logs. Avoid those until we have time to figure out how to fix it.
// if (referencedSpans) {
// // note: allthough followsForm's type says it takes 'opentracing.Span | opentracing.SpanContext', it only works with SpanContext (typing mismatch)
Expand Down

0 comments on commit 8470ee7

Please sign in to comment.