opencensus-node icon indicating copy to clipboard operation
opencensus-node copied to clipboard

span.end closes all child spans

Open cliedeman opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. I am attempting to integrate tracing with graphql but I have the issue parent spans end before the child spans. This was no an issue with opentracing but I am running into https://github.com/open-telemetry/opentelemetry-node/issues/4. I feel like this would also make a future open-telemetry migration easier

Describe the solution you'd like An extra config option on span.end that ignores if the parent span has started or ended.

Describe alternatives you've considered Opencensus Links - https://opencensus.io/tracing/span/link/. But this does not seem to cater for this use case.

Additional context Add any other context or screenshots about the feature request here.

cliedeman avatar Apr 07 '20 12:04 cliedeman

I have found a workable solution I think. Going to test it against jaeger and see

Instead of

    const span = this.tracer.startChildSpan({
       name,
       childOf: parentSpan,
     });

I am manually creating the link

    const span = this.tracer.startRootSpan({ name }, (span) => span);

    if (parentSpan) {
      span.addLink(
        parentSpan.traceId,
        parentSpan.id,
        LinkType.PARENT_LINKED_SPAN
      );
    }

cliedeman avatar Apr 07 '20 12:04 cliedeman