Opentelemetry-java: Configure Multiple JaegerGrpcSpanExporter to spring boot application

Created on 27 Jul 2020  路  4Comments  路  Source: open-telemetry/opentelemetry-java

I tried to configure multiple JaegerGrpcExpanExporter in my application to fulfill below use case:

JaegerGrpcExpanExporter with service name "controller", JaegerGrpcExpanExporter with service name "service" and JaegerGrpcExpanExporter with service name "util" and registered them to OpenTelemetrySdk.
So, that the spans with kind 'controller' should exporter to exporter configured with "controller" service name not to others, similar process should be followed for util and service.

But it is not behaving as expected, i.e. spans with "controller", "service" and "util" has been exported to all the JaegerGrpcExpanExporter registered in parallel.

Below is my configuration, Do you provide me any suggestion to achieve the same.

`public BatchSpansProcessor getJaegerSpanProcessor(String serviceName) {
return BatchSpansProcessor.newBuilder(
JaegerGrpcSpanExporter.newBuilder().setServiceName(serviceName).
setChannel(ManagedChannelBuilder.forAddress(localhost,14250).usePlaintext(). build()
).build();
}

public void addJaegereProcessorToSdk(){
String[] serviceName={"controller", "service", "util"};
TracerSdkProvider tracerSdkProvider=OpenTelemetrySdk.getTracerProvider;
for(String service:serviceName)
tracerSdkProvider.addSpanProcessor(getJaegerSpanProcessor(service));
}`

Most helpful comment

@jkwatson I have used your idea of Custom Exporter but I did slight modification in that.

Instead of delegating the request to JaegerGrpcSpanExporter after filtering, I have created multiple JaegerGrpcSpanExporters after implementing SpanExporter interface after overriding exporter method while all other behavior will be same as of JaegerGrpcSpanExporter and resgistered them to OpenTelemetrySdk.

It is fulfilling my scenario, So we can close this issue.

All 4 comments

Hello there,

Even I am planning for the similar implementation. Any suggestion/solution would be highly appreciated.

I recommend writing a custom exporter that will wrap the multiple Jaeger exporters, delegating to the exporter you desire, based on your criteria. The Jaeger exporter doesn't do any filtering itself, but you can filter and dispatch as required in your own custom way.

@poogurgaon can we close this? Is my suggestion workable?

@jkwatson I have used your idea of Custom Exporter but I did slight modification in that.

Instead of delegating the request to JaegerGrpcSpanExporter after filtering, I have created multiple JaegerGrpcSpanExporters after implementing SpanExporter interface after overriding exporter method while all other behavior will be same as of JaegerGrpcSpanExporter and resgistered them to OpenTelemetrySdk.

It is fulfilling my scenario, So we can close this issue.

Was this page helpful?
0 / 5 - 0 ratings