Hi,
Use the below code changes first report in the list is able to send the span information to the collector it is configured for. The second reporter is unable to send span to the collector it is configured for. If I change the order of adding reporters then the first only seems to send spans to collectors.
public JaegerTracer jaegerTracer() {
// Get the Sampler configuration (one for all the reporters)
SamplerType samplerType = SamplerType.fromValue("const");
Number samplerParamNumber = getSamplerParamNumber(samplerType, "1");
Sampler sampler = getSampler(samplerType.getValue(), samplerParamNumber, "");
List<Reporter> reporters = new LinkedList<>();
if (logSpans) {
reporters.add(new LoggingReporter());
}
// reporters.addAll(getConfiguredReporters());
// Creating the CompositeReporter which holds all the other reporters
SenderConfiguration senderConfiguration = new SenderConfiguration();
metricsFactory = new InMemoryMetricsFactory();
metrics = new Metrics(metricsFactory);
RemoteReporter reporter1 = new RemoteReporter.Builder()
.withFlushInterval(flushInterval)
.withMaxQueueSize(maxQueueSize).withMetrics(new Metrics(metricsFactory)).build();
RemoteReporter reporter2 = new RemoteReporter.Builder()
.withFlushInterval(flushInterval)
.withMaxQueueSize(maxQueueSize).withMetrics(new Metrics(metricsFactory)).build();
reporters.add(reporter1);
reporters.add(reporter2);
reporter = new CompositeReporter(reporters.toArray(new Reporter[reporters.size()]));
System.out.println("Reporter reporter : " + reporter.toString());
final JaegerTracer.Builder builder = new JaegerTracer.Builder(serviceName).withReporter(reporter)
.withSampler(sampler);
return builder.build();
}
/// Generating Trace and Span object code
JaegerSpan span = null;
JaegerTracer tracer = jaegerTracer();
try {
JaegerSpanContext parentSpanCtx = tracer.extract(Format.Builtin.HTTP_HEADERS, new TextMapAdapter(headers));
if (parentSpanCtx == null) {
span = tracer.buildSpan(request.getRequestURI()).start();
} else {
span = tracer.buildSpan(request.getRequestURI()).asChildOf(parentSpanCtx).start();
}
} catch (IllegalArgumentException e) {
//span = tracer.buildSpan(request.getRequestURI()).start();
}
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER);
Tags.HTTP_METHOD.set(span, request.getMethod());
Tags.HTTP_URL.set(span, requestUri);
span.finish();
Thanks
Aruna