class JaegerTracerFactory extends TracerFactory {

	@Override
	public boolean isRoot(Span span) {
		// TODO replace with Span#unwrap once https://github.com/opentracing/opentracing-java/pull/211 is merged
		if (span instanceof SpanWrapper) {
			span = ((SpanWrapper) span).getDelegate();
		}
		if (span instanceof io.jaegertracing.internal.JaegerSpan) {
			final io.jaegertracing.internal.JaegerSpan jaegerSpan = (io.jaegertracing.internal.JaegerSpan) span;
			return jaegerSpan.context().getParentId() == 0;
		}
		return false;
	}

}