Search code examples
jaegeropentracing

No data when I convert from JaegerExporter to OTLPTraceExporter


JaegerExporter is no longer supported so I am attempting to convert to use OTLPTraceExporter ,from what I can tell I should be able to just configure it with the url and it should work, but clearly, I am missing something, any help even pointing in the right direction would be greatly appreciated.

Working Depricated code

const jaegerExporter = new JaegerExporter({
  endpoint: process.env.JAEGER_ENDPOINT, 
});

But when I convert it to, no tracing data comes through

const jaegerExporter = new OTLPTraceExporter({
  url: process.env.JAEGER_ENDPOINT,
}); 

my Tracing code

export const Tracer = new NodeSDK({
  resource: new Resource({
    [SemanticResourceAttributes.SERVICE_NAME]: process.env.JAEGER_SERVICE_NAME || 'node-be-unset',
  }),
  traceExporter: jaegerExporter,
  metricReader: prometheusExporter,
  contextManager: new AsyncLocalStorageContextManager(),
  
  textMapPropagator: new CompositePropagator({
    propagators: [
      new JaegerPropagator(),
      new W3CTraceContextPropagator(),
      new W3CBaggagePropagator(),
      new B3Propagator(),
      new B3Propagator({
        injectEncoding: B3InjectEncoding.MULTI_HEADER,
      }),
    ],
  }),
  instrumentations: [
    getNodeAutoInstrumentations(),
  ],
});

A bit more info, This is a node app using the nestjs framework


Solution

  • After some digging, I found I just need to remove the traceExporter option completly from nodeSdk, and then set the variables for jaeger in my enviroment

    
    OTEL_TRACES_EXPORTER=jaeger
    OTEL_EXPORTER_JAEGER_ENDPOINT=http://localhost:14268/api/traces
    
    

    based on https://github.com/open-telemetry/opentelemetry-specification/blob/6ce62202e5407518e19c56c445c13682ef51a51d/specification/sdk-environment-variables.md#jaeger-exporter