census-instrumentation/opencensus-node

span.end closes all child spans

cliedeman opened this issue · 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 open-telemetry/opentelemetry-js#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.

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
      );
    }