Passing external traceId for the root span

33 views
Skip to first unread message

Alex

unread,
Feb 14, 2020, 8:01:28 PM2/14/20
to OpenTracing
Hello,

Looking at C++ implementations of opentracing (https://github.com/opentracing/opentracing-cpp) and jaegertracing (https://github.com/jaegertracing/jaeger-client-cpp) and don't see a way to pass traceId for the root (the parentless) span.
We need this feature for our version of Jaeger client

Does opentracing allow it and it would be okay to add another StartSpanOption to pass outside traceId to tracer->StartSpanWIthOptions?

Or does opentracing forbid it?

- Alex

Yuri Shkuro

unread,
Feb 14, 2020, 9:54:13 PM2/14/20
to OpenTracing
Given OpenTracing's objective as a vendor-neutral API, it's not possible to support such functionality because it would impose a restriction on how the implementations represent the traceIDs.

However, concrete implementations like Jaeger may support such function via vendor-specific API. Some of Jaeger libraries support a SpanReference type "SELF", which allows you to do the following:
  1. instantiate JaegerSpanContext C1, either directly if the SDK allows it, or by encoding your desired trace ID into a fake 'request' and using tracer.extract()
  2. starting a new span = tracer.startSpan('rootSpanName', references=[(C1, SELF)])

Alex

unread,
Feb 15, 2020, 12:20:35 PM2/15/20
to OpenTracing
Do you mean that Opentracing API doesn't support it because "OpenTracing presently defines two types of references: ChildOf and FollowsFrom", but some implementations add a non-standard type of reference?

I think opentracing-cpp doesn't support it, and even if I create a pull request to add it, it will probably be declined because it's not a part of starndard.
Do you know if there are any plans to make the opentracing::SpanReferenceType::Self a part of standard?


(For now we managed to bypass this limitation by forking jaegertracing-cpp and adding a dirty hack in jaegertracing::Tracer implementation, but I hope it's a temporary solution)

Yuri Shkuro

unread,
Feb 15, 2020, 2:28:39 PM2/15/20
to OpenTracing
I was referring to the ability to provide external trace ID - it's not supported in OT because there is no way to ensure that the provided ID satisfies the different requirements on IDs imposed by different vendor implementations (even as basic as the bit length).

The SELF reference has been proposed (https://github.com/opentracing/specification/issues/81), but not formally accepted. Jaeger Go library implemented SELF reference as a custom/vendor extension (https://github.com/jaegertracing/jaeger-client-go/issues/397). If you want to make a PR for Jaeger CPP with similar support for SELF reference, it is likely to be accepted, given the precedent in Go.
Reply all
Reply to author
Forward
0 new messages