Skip to content

Commit

Permalink
SOLR-15283: fix tracing when cores is null
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmiley committed May 26, 2021
1 parent abc87c7 commit 42291b7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import io.opentracing.Tracer;
import io.opentracing.propagation.Format;
import io.opentracing.tag.Tags;
import io.opentracing.util.GlobalTracer;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHeaders;
import org.apache.http.client.HttpClient;
Expand Down Expand Up @@ -447,7 +448,7 @@ public void doFilter(ServletRequest _request, ServletResponse _response, FilterC
}
}

Tracer tracer = cores.getTracer();
Tracer tracer = cores == null ? GlobalTracer.get() : cores.getTracer();
String hostAndPort = request.getServerName() + "_" + request.getServerPort();
Span span = tracer.buildSpan(request.getMethod() + ":" + hostAndPort)
.asChildOf(tracer.extract(Format.Builtin.HTTP_HEADERS, new HttpServletCarrier(request)))
Expand Down

0 comments on commit 42291b7

Please sign in to comment.