emptyMap().entrySet()
+ : parentContext.baggageItems();
+ }
+}
diff --git a/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/main/java/com/a/eye/skywalking/toolkit/opentracing/SkyWalkingTracer.java b/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/main/java/com/a/eye/skywalking/toolkit/opentracing/SkyWalkingTracer.java
new file mode 100644
index 000000000..eb3f851be
--- /dev/null
+++ b/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/main/java/com/a/eye/skywalking/toolkit/opentracing/SkyWalkingTracer.java
@@ -0,0 +1,86 @@
+package com.a.eye.skywalking.toolkit.opentracing;
+
+import io.opentracing.SpanContext;
+import io.opentracing.Tracer;
+import io.opentracing.propagation.Format;
+import io.opentracing.propagation.TextMap;
+
+import java.nio.ByteBuffer;
+
+/**
+ * All source code in SkyWalkingTracer acts like an NoopTracer.
+ * Actually, it is NOT.
+ * The whole logic will be added after toolkit-activation.
+ *
+ * Created by wusheng on 2016/12/20.
+ */
+public class SkyWalkingTracer implements Tracer {
+ private static String TRACE_HEAD_NAME = "SkyWalking-TRACING-NAME";
+
+ public static Tracer INSTANCE = new SkyWalkingTracer();
+
+ @Override
+ public SpanBuilder buildSpan(String operationName) {
+ return new SkyWalkingSpanBuilder(operationName);
+ }
+
+ @Override
+ public void inject(SpanContext spanContext, Format format, C carrier) {
+ if (Format.Builtin.TEXT_MAP.equals(format) || Format.Builtin.HTTP_HEADERS.equals(format)) {
+ ((TextMap) carrier).put(TRACE_HEAD_NAME, formatCrossProcessPropagationContextData());
+ } else if (Format.Builtin.BINARY.equals(format)) {
+ byte[] key = TRACE_HEAD_NAME.getBytes(ByteBufferContext.CHARSET);
+ byte[] value = formatCrossProcessPropagationContextData().getBytes(ByteBufferContext.CHARSET);
+ ((ByteBuffer) carrier).put(ByteBufferContext.ENTRY);
+ ((ByteBuffer) carrier).putInt(key.length);
+ ((ByteBuffer) carrier).putInt(value.length);
+ ((ByteBuffer) carrier).put(key);
+ ((ByteBuffer) carrier).put(value);
+ } else {
+ throw new IllegalArgumentException("Unsupported format: " + format);
+ }
+ }
+
+ @Override
+ public SpanContext extract(Format format, C carrier) {
+ if (Format.Builtin.TEXT_MAP.equals(format) || Format.Builtin.HTTP_HEADERS.equals(format)) {
+ TextMap textMapCarrier = (TextMap) carrier;
+ extractCrossProcessPropagationContextData(textMapCarrier);
+ return new TextMapContext(textMapCarrier);
+ } else if (Format.Builtin.BINARY.equals(format)) {
+ ByteBuffer byteBufferCarrier = (ByteBuffer)carrier;
+ extractCrossProcessPropagationContextData(byteBufferCarrier);
+ return new ByteBufferContext((ByteBuffer)carrier);
+ } else {
+ throw new IllegalArgumentException("Unsupported format: " + format);
+ }
+ }
+
+
+ /**
+ * set context data in toolkit-opentracing-activation
+ *
+ * @return
+ */
+ private String formatCrossProcessPropagationContextData() {
+ return "";
+ }
+
+ /**
+ * read context data in toolkit-opentracing-activation
+ *
+ * @param textMapCarrier
+ */
+ private void extractCrossProcessPropagationContextData(TextMap textMapCarrier) {
+
+ }
+
+ /**
+ * read context data in toolkit-opentracing-activation
+ *
+ * @param byteBufferCarrier
+ */
+ private void extractCrossProcessPropagationContextData(ByteBuffer byteBufferCarrier) {
+
+ }
+}
diff --git a/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/main/java/com/a/eye/skywalking/toolkit/opentracing/TextMapContext.java b/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/main/java/com/a/eye/skywalking/toolkit/opentracing/TextMapContext.java
new file mode 100644
index 000000000..66d1f443b
--- /dev/null
+++ b/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/main/java/com/a/eye/skywalking/toolkit/opentracing/TextMapContext.java
@@ -0,0 +1,23 @@
+package com.a.eye.skywalking.toolkit.opentracing;
+
+import io.opentracing.SpanContext;
+import io.opentracing.propagation.TextMap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by wusheng on 2016/12/21.
+ */
+public class TextMapContext implements SpanContext {
+ private final TextMap textMap;
+
+ TextMapContext(TextMap textMap) {
+ this.textMap = textMap;
+ }
+
+ @Override
+ public Iterable> baggageItems() {
+ return new HashMap().entrySet();
+ }
+}
diff --git a/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/main/resources/META-INF.services/io.opentracing.Tracer b/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/main/resources/META-INF.services/io.opentracing.Tracer
new file mode 100644
index 000000000..728fcb10e
--- /dev/null
+++ b/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/main/resources/META-INF.services/io.opentracing.Tracer
@@ -0,0 +1 @@
+com.a.eye.skywalking.toolkit.opentracing.SkyWalkingTracer
diff --git a/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/test/java/com/a/eye/skywalking/toolkit/opentracing/SkyWalkingTracerTest.java b/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/test/java/com/a/eye/skywalking/toolkit/opentracing/SkyWalkingTracerTest.java
new file mode 100644
index 000000000..159e905aa
--- /dev/null
+++ b/skywalking-application-toolkit/skywalking-toolkit-opentracing/src/test/java/com/a/eye/skywalking/toolkit/opentracing/SkyWalkingTracerTest.java
@@ -0,0 +1,39 @@
+package com.a.eye.skywalking.toolkit.opentracing;
+
+import io.opentracing.Span;
+import io.opentracing.SpanContext;
+import io.opentracing.Tracer;
+import io.opentracing.propagation.TextMap;
+import org.junit.Test;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Created by wusheng on 2016/12/21.
+ */
+public class SkyWalkingTracerTest {
+ @Test
+ public void testBuildSpan(){
+ Tracer tracer = SkyWalkingTracer.INSTANCE;
+ Tracer.SpanBuilder spanBuilder = tracer.buildSpan("/http/serviceName");
+
+ SpanContext context = new TextMapContext(new TextMap() {
+
+ @Override
+ public Iterator> iterator() {
+ throw new UnsupportedOperationException(
+ "TextMapInjectAdapter should only be used with Tracer.inject()");
+ }
+
+ @Override
+ public void put(String key, String value) {
+
+ }
+ });
+ spanBuilder.asChildOf(context).withTag("example.tag", "testtag");
+ Span span = spanBuilder.start();
+
+ span.finish();
+ }
+}
diff --git a/skywalking-application-toolkit/skywalking-toolkit-trace-context/pom.xml b/skywalking-application-toolkit/skywalking-toolkit-trace-context/pom.xml
index dd14d276a..d82f4fd01 100644
--- a/skywalking-application-toolkit/skywalking-toolkit-trace-context/pom.xml
+++ b/skywalking-application-toolkit/skywalking-toolkit-trace-context/pom.xml
@@ -11,6 +11,33 @@
skywalking-toolkit-trace-context
jar
- skywalking-toolkit-trace-context
http://maven.apache.org
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+
+ attach-sources
+
+ jar
+
+
+
+ 2.4
+
+
+
+
+
+
+ bintray-wu-sheng-sky-walking-repository
+ wu-sheng-sky-walking-repository
+ https://api.bintray.com/maven/wu-sheng/skywalking/com.a.eye.skywalking-toolkit-trace-context/;publish=1
+
+
diff --git a/skywalking-sniffer/skywalking-agent/dependency-reduced-pom.xml b/skywalking-sniffer/skywalking-agent/dependency-reduced-pom.xml
index e54bf1c87..a597e2a39 100644
--- a/skywalking-sniffer/skywalking-agent/dependency-reduced-pom.xml
+++ b/skywalking-sniffer/skywalking-agent/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
skywalking-sniffer
com.a.eye
- ${skywalking.version}
+ 2.0-2016
4.0.0
skywalking-agent