lightstep / lightstep-tracer-javascript

Lightstep distributed tracing library for Node.js and the browser
https://lightstep.com
MIT License
77 stars 66 forks source link

Add B3 header support #175

Closed chadbrad closed 4 years ago

chadbrad commented 5 years ago

Please add B3 header support :)

Please see this doc for the problem statement and specifics: https://docs.google.com/document/d/1ukvnSoXkavcojlVXpCRzep8PS_guXly_NbbhHIDgbFY/edit

ledor473 commented 5 years ago

I'd like to know if this will be implemented similarly to how it was done in Java here: https://github.com/lightstep/lightstep-tracer-java-common/issues/56

Main things I'd like to see would be:

bg451 commented 5 years ago

@ledor473 here's the initial stab at B3 headers: https://github.com/lightstep/lightstep-tracer-javascript/pull/177

However, reading through the gotchas I think the custom propagators approach should be used here. I'll take another stab with that method.

ledor473 commented 5 years ago

@bg451 as you've said I think the _inject and _extract method should be configurable instead of adding a new Format.

Something like this would be very neat and allow to migrate from other platform (Jaeger instead of Zipkin):

class MyOwnPropagator {
   inject(spanContext, format, carrier) {
     // Do stuff
  }
   extract(format, carrier) {
    // Do stuff
    return spanContext;
  }
}

myOwnPropagator = new MyOwnPropagator();

var myPropagators = {};
myPropagators[opentracing.FORMAT_HTTP_HEADERS] = myOwnPropagator;
myPropagators[opentracing.FORMAT_TEXT_MAP] = myOwnPropagator;

opentracing.initGlobalTracer(new lightstep.Tracer({
    access_token   : '{your_access_token}',
    component_name : '{your_service_or_app_name}',
    propagators    : myPropagators,
}));
chadbrad commented 4 years ago

Think this was done in https://github.com/lightstep/lightstep-tracer-javascript/pull/177, closing this ticket out.