wdengw opened a new issue #886: Got IllegalArgumentExceptions when calling SpanBuilder.asChildOf() URL: https://github.com/apache/incubator-skywalking/issues/886 Please answer these questions before submitting your issue. - Why do you submit this issue? - [ ] Question or discussion - [X ] Bug - [ ] Requirement - [ ] Feature or performance improvement ___ ### Bug - Which version of SkyWalking, OS and JRE? version 3.2.6, JRE 1.8, Mac OS X - What happen? When I intrumented my code to use skywalking open tracing implementation, I got an IllegalArgumentException thrown by SkywalkingSpanBuilder.asChildOf(?) method. Mar 05, 2018 12:22:35 PM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet [dispatcherServlet] threw exception java.lang.IllegalArgumentException: parent must be type of SpanContext at org.skywalking.apm.toolkit.opentracing.SkywalkingSpanBuilder.asChildOf(SkywalkingSpanBuilder.java:54) at com.walmart.strati.telemetry.system.tracing.poc.tracer.opentracing.OpenTracingUtils.startServiceTracing(OpenTracingUtils.java:112) The code in my OpenTracingUtils is like 1. Tracer tracer = new org.skywalking.apm.toolkit.opentracing.SkywalkingTracer(); ? 2. TextMap httpHeadersCarrier = new HttpServletRequestExtractAdapter(request); 3. SpanContext spanCtx = tracer.extract(Format.Builtin.HTTP_HEADERS, httpHeadersCarrier); 4. Tracer.SpanBuilder spanBuilder = tracer.buildSpan(operator(category, svc)) 5. .asChildOf(spanCtx); At line 3, Skywalking tracer returns a org.skywalking.apm.toolkit.opentracing.TextMapContext. However, at line 5, org.skywalking.apm.toolkit.opentracing.SkywalkingSpanBuilder.asChildOf(?) complains about the passed in org.skywalking.apm.toolkit.opentracing.TextMapContext is not a SpanContext. Actually the TextMapContext is an SpanContext. The issue is in org.skywalking.apm.toolkit.opentracing.TextMapContext.asChildOf method where it is checking: if (parent instanceof SkywalkingContext) { return this; } throw new IllegalArgumentException("parent must be type of SpanContext"); Is this a bug? BTW, the same code that I have, if I replace SkywalkingTracer() with either Zipkin tracer or Jaeger tracer, it works.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services