Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRPC instrumentation doesn't extract from B3 multi propagator #2147

Closed
alokp opened this issue Apr 22, 2021 · 0 comments · Fixed by #2285
Closed

GRPC instrumentation doesn't extract from B3 multi propagator #2147

alokp opened this issue Apr 22, 2021 · 0 comments · Fixed by #2285
Labels
bug Something isn't working

Comments

@alokp
Copy link

alokp commented Apr 22, 2021

What version of OpenTelemetry are you using?

0.19.0

What version of Node are you using?

14

Please provide the code you used to setup the OpenTelemetry SDK

const provider = new NodeTracerProvider();
registerInstrumentations({
    instrumentations: [new GrpcInstrumentation()],
    tracerProvider: provider
});
const exporter = new ZipkinExporter({
    serviceName: serviceName,
    url: config.get("zipkin_exporter")
});
provider.addSpanProcessor(new BatchSpanProcessor(exporter));
provider.register({
    propagator: new B3Propagator({
      injectEncoding: B3InjectEncoding.MULTI_HEADER
    })
});
trace.setGlobalTracerProvider(provider);

What did you do?

I am running a GRPC server. My client sends zipkin tracing headers (x-b3-traceid, x-b3-spanid and x-b3-sampled)

What did you expect to see?

I was expecting the B3Propagator to extract the tracing info from the passed headers.

What did you see instead?

Tracing headers are not extracted.

Additional context

My hunch is that this is caused by the TextMapGetter passed by the GRPC instrumentation to B3Propagator. B3Propagator looks for the single b3 header to decide on which extractor to use.

extract(context: Context, carrier: unknown, getter: TextMapGetter): Context {
  if (getter.get(carrier, B3_CONTEXT_HEADER)) {
    return this._b3SinglePropagator.extract(context, carrier, getter);
  } else {
    return this._b3MultiPropagator.extract(context, carrier, getter);
  }
}

Here B3Propagator is expecting TextMapGetter to return a falsey value if the header is not present (defaultTextMapGetter returns undefined in this case) but the TextMapGetter instance passed by GRPC instrumentation returns an empty array instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant