Merge remote-tracking branch 'origin/master'
# Conflicts: # skywalking-sniffer/skywalking-agent/dependency-reduced-pom.xml
This commit is contained in:
commit
e316eba139
|
|
@ -17,9 +17,10 @@ SkyWalking: Large-Scale Distributed Systems Tracing Infrastructure, also known D
|
|||
# Abstract
|
||||
* An open source Large-Scale Distributed Systems Tracing Infrastructure, also known a ditributed tracer.
|
||||
* Based on [Google Dapper Paper: Dapper, a Large-Scale Distributed Systems Tracing Infrastructure](http://research.google.com/pubs/pub36356.html), [read Simplified Chinese Version](http://duanple.blog.163.com/blog/static/70971767201329113141336/)
|
||||
* Support popular rpc frameworks, such as [dubbo](https://github.com/alibaba/dubbo), [dubbox](https://github.com/dangdangdotcom/dubbox), [motan](https://github.com/weibocom/motan) etc., trigger email-alert when application occurs unexpected exception。
|
||||
* Support popular rpc frameworks, such as [dubbo](https://github.com/alibaba/dubbo), [dubbox](https://github.com/dangdangdotcom/dubbox), [motan](https://github.com/weibocom/motan) etc., trigger email-alert when application occurs unexpected exception.
|
||||
* Auto-instrumentation mechenism, **no need to CHANGE any application source code**.
|
||||
* Easy to deploy, **even in product mode** (since 2.0) . No need of Hadoop, HBase, or Cassandra Cluster.
|
||||
* Pure Java server implements. provide gRPC (since 2.0) and HTTP (since 2.1) cross-platform spans collecting service.
|
||||
* Pure Java server implementation. provide gRPC (since 2.0) and HTTP (since 2.1) cross-platform spans collecting service.
|
||||
|
||||
|
||||
# Supported components
|
||||
|
|
|
|||
4
pom.xml
4
pom.xml
|
|
@ -105,9 +105,11 @@
|
|||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>DataCarrier</id>
|
||||
<id>bintray</id>
|
||||
<name>bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -18,5 +18,6 @@
|
|||
<module>skywalking-toolkit-log4j-2.x</module>
|
||||
<module>skywalking-toolkit-logback-1.x</module>
|
||||
<module>skywalking-toolkit-trace-context</module>
|
||||
<module>skywalking-toolkit-opentracing</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -20,4 +20,32 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- 源码插件 -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<!-- 发布时自动将源码同时发布的配置 -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>bintray-wu-sheng-sky-walking-repository</id>
|
||||
<name>wu-sheng-sky-walking-repository</name>
|
||||
<url>https://api.bintray.com/maven/wu-sheng/skywalking/com.a.eye.skywalking-toolkit-log4j-1.x/;publish=1</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,36 @@
|
|||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.7</version>
|
||||
<scope>compile</scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- 源码插件 -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<!-- 发布时自动将源码同时发布的配置 -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>bintray-wu-sheng-sky-walking-repository</id>
|
||||
<name>wu-sheng-sky-walking-repository</name>
|
||||
<url>https://api.bintray.com/maven/wu-sheng/skywalking/com.a.eye.skywalking-toolkit-log4j-2.x/;publish=1</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,36 @@
|
|||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- 源码插件 -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<!-- 发布时自动将源码同时发布的配置 -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>bintray-wu-sheng-sky-walking-repository</id>
|
||||
<name>wu-sheng-sky-walking-repository</name>
|
||||
<url>https://api.bintray.com/maven/wu-sheng/skywalking/com.a.eye.skywalking-toolkit-logback-1.x/;publish=1</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>skywalking-application-toolkit</artifactId>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<version>2.1-2017</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>skywalking-toolkit-opentracing</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.opentracing</groupId>
|
||||
<artifactId>opentracing-api</artifactId>
|
||||
<version>0.20.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.opentracing</groupId>
|
||||
<artifactId>opentracing-noop</artifactId>
|
||||
<version>0.20.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.a.eye.skywalking.toolkit.opentracing;
|
||||
|
||||
import io.opentracing.SpanContext;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 2016/12/21.
|
||||
*/
|
||||
public class ByteBufferContext implements SpanContext {
|
||||
static final Charset CHARSET = Charset.forName("UTF-8");
|
||||
|
||||
static final byte NO_ENTRY = 0;
|
||||
static final byte ENTRY = 1;
|
||||
|
||||
private final ByteBuffer byteBuffer;
|
||||
|
||||
ByteBufferContext(ByteBuffer byteBuffer) {
|
||||
this.byteBuffer = byteBuffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Map.Entry<String, String>> baggageItems() {
|
||||
return new HashMap<String, String>().entrySet();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
package com.a.eye.skywalking.toolkit.opentracing;
|
||||
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.SpanContext;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 2016/12/20.
|
||||
*/
|
||||
public class SkyWalkingSpan implements Span, SpanContext {
|
||||
private String operationName;
|
||||
|
||||
private long startTime;
|
||||
|
||||
private Map<String, String> tags;
|
||||
|
||||
private final Map<String, String> baggageItems;
|
||||
|
||||
SkyWalkingSpan(String operationName, long startTime, Map<String, String> tags){
|
||||
this.operationName = operationName;
|
||||
this.startTime = startTime;
|
||||
this.tags = tags;
|
||||
baggageItems = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpanContext context() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish(long finishMicros) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span setTag(String key, String value) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span setTag(String key, boolean value) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span setTag(String key, Number value) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span log(Map<String, ?> fields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span log(long timestampMicroseconds, Map<String, ?> fields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span log(String event) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span log(long timestampMicroseconds, String event) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span setBaggageItem(String key, String value) {
|
||||
baggageItems.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaggageItem(String key) {
|
||||
return baggageItems.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span setOperationName(String operationName) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span log(String eventName, Object payload) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span log(long timestampMicroseconds, String eventName, Object payload) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Map.Entry<String, String>> baggageItems() {
|
||||
return baggageItems.entrySet();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.a.eye.skywalking.toolkit.opentracing;
|
||||
|
||||
import io.opentracing.References;
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.SpanContext;
|
||||
import io.opentracing.Tracer;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* All source code in SkyWalkingSpanBuilder acts like an NoopSpanBuilder.
|
||||
* Actually, it is NOT.
|
||||
* The whole logic will be added after toolkit-activation.
|
||||
*
|
||||
* Created by wusheng on 2016/12/20.
|
||||
*/
|
||||
public class SkyWalkingSpanBuilder implements Tracer.SpanBuilder {
|
||||
private String operationName;
|
||||
|
||||
private long startTime = 0L;
|
||||
|
||||
private final Map<String, String> tags;
|
||||
|
||||
private SpanContext parentContext;
|
||||
|
||||
SkyWalkingSpanBuilder(String operationName){
|
||||
this.operationName = operationName;
|
||||
this.tags = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* In SkyWalkingTracer, SpanContext will not be used. Tracer will build reference by itself.
|
||||
*
|
||||
* @param spanContext
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Tracer.SpanBuilder asChildOf(SpanContext spanContext) {
|
||||
this.parentContext = spanContext;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* In SkyWalkingTracer, Parent Span will not be used. Tracer will build reference by itself.
|
||||
* @param span
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Tracer.SpanBuilder asChildOf(Span span) {
|
||||
asChildOf(span.context());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tracer.SpanBuilder addReference(String referenceType, SpanContext referencedContext) {
|
||||
if (referenceType.equals(References.CHILD_OF)) {
|
||||
return asChildOf(referencedContext);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tracer.SpanBuilder withTag(String key, String value) {
|
||||
if (key != null && value != null) {
|
||||
tags.put(key, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tracer.SpanBuilder withTag(String key, boolean value) {
|
||||
if (key != null) {
|
||||
tags.put(key, Boolean.toString(value));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tracer.SpanBuilder withTag(String key, Number value) {
|
||||
if (key != null && value != null) {
|
||||
tags.put(key, value.toString());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tracer.SpanBuilder withStartTimestamp(long startTime) {
|
||||
this.startTime = startTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span start() {
|
||||
return new SkyWalkingSpan(this.operationName, this.startTime, this.tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Map.Entry<String, String>> baggageItems() {
|
||||
return parentContext == null
|
||||
? Collections.<String, String>emptyMap().entrySet()
|
||||
: parentContext.baggageItems();
|
||||
}
|
||||
}
|
||||
|
|
@ -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.
|
||||
* <p>
|
||||
* 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 <C> void inject(SpanContext spanContext, Format<C> 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 <C> SpanContext extract(Format<C> 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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Map.Entry<String, String>> baggageItems() {
|
||||
return new HashMap<String, String>().entrySet();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
com.a.eye.skywalking.toolkit.opentracing.SkyWalkingTracer
|
||||
|
|
@ -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<Map.Entry<String, String>> 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();
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,33 @@
|
|||
<artifactId>skywalking-toolkit-trace-context</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>skywalking-toolkit-trace-context</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- 源码插件 -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<!-- 发布时自动将源码同时发布的配置 -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>bintray-wu-sheng-sky-walking-repository</id>
|
||||
<name>wu-sheng-sky-walking-repository</name>
|
||||
<url>https://api.bintray.com/maven/wu-sheng/skywalking/com.a.eye.skywalking-toolkit-trace-context/;publish=1</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<parent>
|
||||
<artifactId>skywalking-sniffer</artifactId>
|
||||
<groupId>com.a.eye</groupId>
|
||||
<version>${skywalking.version}</version>
|
||||
<version>2.0-2016</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>skywalking-agent</artifactId>
|
||||
|
|
|
|||
Loading…
Reference in New Issue