Created
November 19, 2017 20:23
-
-
Save fzakaria/c06f5a7fa17823ccf1c13402c6151634 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A very simple {@link Injector} and {@link Extractor} that use a {@link StringBuffer} as the transmission. | |
* This class <b>will only</b> transmit the {@link io.opentracing.SpanContext} without any baggage | |
* (that's why its simple). | |
*/ | |
public class SimpleStringCodec implements Injector<StringBuffer> , Extractor<StringBuffer> { | |
@Override | |
public void inject(SpanContext spanContext, StringBuffer carrier) { | |
carrier.append(spanContext.contextAsString()); | |
} | |
@Override | |
public SpanContext extract(StringBuffer carrier) { | |
return SpanContext.contextFromString(carrier.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment