提交 99fd385c 编写于 作者: A ascrutae

修改pom,fix #76

上级 631494e5
......@@ -2,7 +2,7 @@ version: '2'
services:
skywalking-storage:
image: skywalking/skywalking-storage:2.0-2016
image: skywalking/skywalking-storage:2.1-2017
expose:
- "34000"
depends_on:
......@@ -13,7 +13,7 @@ services:
- REGISTRY_CENTER_URL=registry-center-server:2181
skywalking-alarm:
image: skywalking/skywalking-alarm:2.0-2016
image: skywalking/skywalking-alarm:2.1-2017
depends_on:
- alarm-coordinate-zk
- mysql-server
......@@ -34,7 +34,7 @@ services:
- MAIL_SENDER_MAIL=skywalking@mail.com
skywalking-routing:
image: skywalking/skywalking-routing:2.0-2016
image: skywalking/skywalking-routing:2.1-2017
expose:
- "23000"
ports:
......@@ -48,7 +48,7 @@ services:
- ALARM_REDIS_SERVER=redis-server:6379
skywalking-webui:
image: skywalking/skywalking-webui:2.0-2016
image: skywalking/skywalking-webui:2.1-2017
expose:
- "8080"
ports:
......
<?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"
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.a.eye</groupId>
<artifactId>skywalking</artifactId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
<modules>
<module>skywalking-commons</module>
......@@ -25,6 +26,7 @@
<compiler.version>1.8</compiler.version>
<powermock.version>1.6.4</powermock.version>
<docker.plugin.version>0.4.13</docker.plugin.version>
<skywalking.version>2.1-2017</skywalking.version>
</properties>
<dependencies>
......@@ -80,6 +82,21 @@
<skipDocker>true</skipDocker>
</configuration>
</plugin>
<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>
......
......@@ -4,7 +4,7 @@
<parent>
<artifactId>skywalking</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<artifactId>skywalking-alarm</artifactId>
......@@ -110,7 +110,7 @@
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
<imageName>skywalking/skywalking-alarm</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>${skywalking.version}</imageTag>
</imageTags>
<resources>
<resource>
......
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>skywalking-application-toolkit</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-application-toolkit</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-application-toolkit</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-application-toolkit</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -4,7 +4,7 @@
<parent>
<artifactId>skywalking-application-toolkit</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking-commons</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking-commons</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-logging</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-logging</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking-commons</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-logging-api</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
......
package com.a.eye.skywalking.registry.api;
/**
* Created by xin on 2016/12/19.
*/
public class RegistryNodeFailedException extends RuntimeException {
public RegistryNodeFailedException(String message) {
super(message);
}
}
......@@ -7,6 +7,7 @@ import com.a.eye.skywalking.registry.api.RegistryCenter;
import com.a.eye.skywalking.registry.api.RegistryNode;
import junit.framework.TestSuite;
import org.I0Itec.zkclient.ZkClient;
import org.I0Itec.zkclient.exception.ZkNodeExistsException;
import org.apache.curator.test.TestingServer;
import org.apache.zookeeper.KeeperException;
import org.junit.After;
......@@ -84,4 +85,11 @@ public class ZookeeperRegistryCenterTest extends TestSuite {
registryCenter.register("/skywalking/storage/test");
assertTrue(zkClient.exists("/skywalking/storage/test"));
}
@Test(expected =ZkNodeExistsException.class)
public void registryTwoTmpPath(){
zkClient.createEphemeral("/testa");
zkClient.createEphemeral("/testa");
}
}
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking-commons</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-network</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
</project>
package com.a.eye.skywalking.network.model;
/**
* Created by xin on 2016/12/22.
*/
public enum Tag {
VIEW_POINT("viewpoint", 1), BUSINESS_KEY("business_key", 2), CALL_TYPE("call.type", 3),
SPAN_TYPE("type", 4), CALL_DESC("call.desc", 5), USER_NAME("username", 6),
ADDRESS("hostname", 7), PROCESS_NO("process_no", 8), APPLICATION_CODE("application_code", 9),
STATUS("error.status", 10), EXCEPTION_STACK("error.exception_stack", 11);
private String keyName;
private int keyValue;
Tag(String keyName, int keyValue) {
this.keyName = keyName;
this.keyValue = keyValue;
}
public static Tag convert(String value) {
String[] valueSegment = value.split("_");
if (valueSegment.length != 2) {
throw new IllegalArgumentException("Failed to convert to tag[ " + value + "]");
}
switch (Integer.parseInt(valueSegment[1])) {
case 1:
return VIEW_POINT;
case 2:
return BUSINESS_KEY;
default:
throw new IllegalArgumentException("Cannot find the tag by keyValue[" + valueSegment[1] + "]");
}
}
public String toString() {
return keyName + "_" + keyValue;
}
public String key() {
return toString();
}
}
......@@ -8,31 +8,18 @@ message AckSpan {
string parentLevel = 2;
int32 levelId = 3;
int64 cost = 4;
int32 statusCode = 5;
string exceptionStack = 6;
string viewpointId = 7;
string username = 8;
string applicationCode = 9;
int32 routeKey = 10;
int32 routeKey = 5;
map<string, string> tags = 6;
}
message RequestSpan {
TraceId traceId = 1;
string parentLevel = 2;
int32 levelId = 3;
string viewPointId = 4;
int64 startDate = 5;
string spanTypeDesc = 6;
string callType = 7;
uint32 spanType = 8;
string applicationCode = 9;
string username = 10;
string businessKey = 11;
int32 processNo = 13;
string address = 14;
int32 routeKey = 15;
int64 startDate = 4;
int32 routeKey = 5;
map<string, string> tags = 6;
}
message TraceId {
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -27,7 +27,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-util</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
</project>
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking-sniffer</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>skywalking-agent</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-sniffer</artifactId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<artifactId>skywalking-agent</artifactId>
......@@ -30,57 +30,58 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-jedis-2.x-plugin</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-jdbc-plugin</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-httpClient-4.x-plugin</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-dubbo-plugin</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>tomcat-7.x-8.x-plugin</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>motan-plugin</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<!-- activation -->
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-toolkit-log4j-1.x-activation</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-toolkit-log4j-2.x-activation</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-toolkit-logback-1.x-activation</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-toolkit-trace-context-activation</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-sniffer</artifactId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
......@@ -29,7 +29,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-network</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
......
......@@ -9,8 +9,11 @@ import com.a.eye.skywalking.logging.api.LogManager;
import com.a.eye.skywalking.model.ContextData;
import com.a.eye.skywalking.model.Identification;
import com.a.eye.skywalking.model.Span;
import com.a.eye.skywalking.model.SpanTagBuilder;
import com.a.eye.skywalking.network.dependencies.com.google.protobuf.ByteString;
import com.a.eye.skywalking.network.grpc.AckSpan;
import com.a.eye.skywalking.network.grpc.RequestSpan;
import com.a.eye.skywalking.network.model.Tag;
import com.a.eye.skywalking.util.BuriedPointMachineUtil;
import java.util.HashSet;
......@@ -40,21 +43,19 @@ public abstract class BaseInvokeMonitor {
}
protected void sendRequestSpan(Span span, Identification id) {
RequestSpan.Builder requestSpanBuilder = span.buildRequestSpan(RequestSpan.newBuilder());
if (id.getBusinessKey() != null && id.getBusinessKey().length() > 0) {
requestSpanBuilder = requestSpanBuilder.setBusinessKey(id.getBusinessKey());
}
RequestSpan requestSpan = requestSpanBuilder
.setViewPointId(id.getViewPoint())
.setSpanTypeDesc(id.getSpanTypeDesc())
.setCallType(id.getCallType()).setProcessNo(BuriedPointMachineUtil.getProcessNo())
.setAddress(BuriedPointMachineUtil.getHostDesc()).build();
RequestSpan requestSpan= SpanTagBuilder.newBuilder(span)
.setBusinessKey(id.getBusinessKey())
.setSpanTypeDesc(id.getSpanTypeDesc()).setCallType(id.getCallType())
.setProcessNo(BuriedPointMachineUtil.getProcessNo())
.setAddress(BuriedPointMachineUtil.getHostDesc()).buildRequestSpan(RequestSpan.newBuilder());
RequestSpanDisruptor.INSTANCE.ready2Send(requestSpan);
}
protected void sendAckSpan(Span span) {
AckSpan ackSpan = span.buildAckSpan(AckSpan.newBuilder()).build();
AckSpan ackSpan = SpanTagBuilder.newBuilder(span)
.setStatusCode(span.getStatusCode())
.setExceptionStack(span.getExceptionStack()).buildAckSpan(AckSpan.newBuilder());
AckSpanDisruptor.INSTANCE.ready2Send(ackSpan);
}
......
......@@ -5,6 +5,7 @@ import com.a.eye.skywalking.context.CurrentThreadSpanStack;
import com.a.eye.skywalking.logging.api.ILog;
import com.a.eye.skywalking.logging.api.LogManager;
import com.a.eye.skywalking.model.*;
import com.a.eye.skywalking.network.model.Tag;
import com.a.eye.skywalking.util.ContextGenerator;
public class RPCClientInvokeMonitor extends BaseInvokeMonitor {
......@@ -16,7 +17,7 @@ public class RPCClientInvokeMonitor extends BaseInvokeMonitor {
try {
Span spanData = ContextGenerator.generateSpanFromThreadLocal(id);
//设置SpanType的类型
spanData.setSpanType(SpanType.RPC_CLIENT);
spanData.setTag(Tag.SPAN_TYPE, SpanType.RPC_CLIENT);
if (Config.BuriedPoint.PRINTF) {
logger.debug("TraceId:" + spanData.getTraceId() + "\tParentLevelId:" + spanData.getParentLevel()
......@@ -34,12 +35,12 @@ public class RPCClientInvokeMonitor extends BaseInvokeMonitor {
}
}
public void afterInvoke(){
public void afterInvoke() {
super.afterInvoke();
}
public void occurException(Throwable th){
public void occurException(Throwable th) {
super.occurException(th);
}
......
......@@ -6,6 +6,7 @@ import com.a.eye.skywalking.model.ContextData;
import com.a.eye.skywalking.model.Identification;
import com.a.eye.skywalking.model.Span;
import com.a.eye.skywalking.model.SpanType;
import com.a.eye.skywalking.network.model.Tag;
import com.a.eye.skywalking.util.ContextGenerator;
public class RPCServerInvokeMonitor extends BaseInvokeMonitor {
......@@ -18,7 +19,7 @@ public class RPCServerInvokeMonitor extends BaseInvokeMonitor {
Span spanData = ContextGenerator.generateSpanFromContextData(
context, id);
// 设置是否为接收端
spanData.setSpanType(SpanType.RPC_SERVER);
spanData.setTag(Tag.SPAN_TYPE, SpanType.RPC_SERVER);
super.beforeInvoke(spanData, id);
} catch (Throwable t) {
......
......@@ -5,18 +5,20 @@ import com.a.eye.skywalking.conf.Config;
import com.a.eye.skywalking.network.grpc.AckSpan;
import com.a.eye.skywalking.network.grpc.RequestSpan;
import com.a.eye.skywalking.network.grpc.TraceId;
import com.a.eye.skywalking.network.model.Tag;
import com.a.eye.skywalking.util.RoutingKeyGenerator;
import com.a.eye.skywalking.util.StringUtil;
import com.a.eye.skywalking.util.TraceIdGenerator;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Span {
private final static String INVOKE_RESULT_PARAMETER_KEY = "_ret";
private Logger logger = Logger.getLogger(Span.class.getName());
/**
......@@ -56,23 +58,24 @@ public class Span {
* 节点类型<br/>
* 如:RPC Client,RPC Server,Local
*/
private int spanType = SpanType.LOCAL;
private String spanType = SpanType.LOCAL;
/**
* 业务字段<br/>
*/
private String businessKey = "";
private String viewPointId;
private int routeKey;
private Map<String, String> tags = new HashMap<String, String>();
private String viewPoint;
public Span(String operationName) {
this(TraceIdGenerator.generate(), "", 0, operationName, RoutingKeyGenerator.generate(operationName));
}
public Span(Span parentSpan, String operationName) {
this(parentSpan.traceId, parentSpan.generateParentLevelId(), 0, operationName,parentSpan.getRouteKey());
this(parentSpan.traceId, parentSpan.generateParentLevelId(), 0, operationName, parentSpan.getRouteKey());
}
public Span(ContextData contextData, String operationName) {
......@@ -84,8 +87,11 @@ public class Span {
this.parentLevel = parentLevel;
this.levelId = levelId;
this.routeKey = routeKey;
this.viewPointId = operationName;
this.startDate = System.currentTimeMillis();
this.setTag(Tag.USER_NAME, Config.SkyWalking.USERNAME);
this.setTag(Tag.APPLICATION_CODE, Config.SkyWalking.APPLICATION_CODE);
this.setTag(Tag.VIEW_POINT, operationName);
}
public TraceId getTraceId() {
......@@ -108,14 +114,16 @@ public class Span {
this.levelId = levelId;
}
public void setSpanType(int spanType) {
this.spanType = spanType;
public String getSpanType() {
return spanType;
}
public int getSpanType() {
return spanType;
public void setTag(Tag key, String value) {
if (value != null)
this.tags.put(key.toString(), value);
}
public void handleException(Throwable e, Set<String> exclusiveExceptionSet, int maxExceptionStackLength) {
ByteArrayOutputStream buf = null;
StringBuilder expMessage = new StringBuilder();
......@@ -157,17 +165,13 @@ public class Span {
}
public RequestSpan.Builder buildRequestSpan(RequestSpan.Builder builder) {
builder.setTraceId(this.traceId).setParentLevel(this.parentLevel).setLevelId(this.levelId).setSpanType(this.spanType).setApplicationCode(Config.SkyWalking.APPLICATION_CODE)
.setStartDate(this.startDate).setUsername(Config.SkyWalking.USERNAME).setRouteKey(routeKey);
return builder;
return builder.setTraceId(this.traceId).setParentLevel(this.parentLevel).setLevelId(this.levelId)
.setStartDate(this.startDate).setRouteKey(routeKey).putAllTags(tags);
}
public AckSpan.Builder buildAckSpan(AckSpan.Builder builder) {
builder.setTraceId(this.traceId).setParentLevel(this.parentLevel).setLevelId(this.levelId)
.setCost(System.currentTimeMillis() - this.startDate).setStatusCode(this.statusCode)
.setExceptionStack(this.exceptionStack).setUsername(Config.SkyWalking.USERNAME).setApplicationCode(Config.SkyWalking.APPLICATION_CODE)
.setViewpointId(this.viewPointId).setRouteKey(routeKey);
return builder;
return builder.setTraceId(this.traceId).setParentLevel(this.parentLevel).setLevelId(this.levelId)
.setCost(System.currentTimeMillis() - this.startDate).setRouteKey(routeKey).putAllTags(tags);
}
public int getRouteKey() {
......@@ -181,4 +185,16 @@ public class Span {
return String.valueOf(this.getLevelId());
}
}
public String getViewPoint() {
return viewPoint;
}
public byte getStatusCode() {
return statusCode;
}
public String getExceptionStack() {
return exceptionStack;
}
}
package com.a.eye.skywalking.model;
import com.a.eye.skywalking.network.grpc.AckSpan;
import com.a.eye.skywalking.network.grpc.RequestSpan;
import com.a.eye.skywalking.network.model.Tag;
/**
* Created by xin on 2016/12/23.
*/
public class SpanTagBuilder {
private final Span span;
private SpanTagBuilder(Span span) {
this.span = span;
}
public static SpanTagBuilder newBuilder(Span span) {
return new SpanTagBuilder(span);
}
public SpanTagBuilder setSpanType(int spanType) {
span.setTag(Tag.SPAN_TYPE, spanType + "");
return this;
}
public Span build() {
return this.span;
}
public RequestSpan buildRequestSpan(RequestSpan.Builder builder) {
return span.buildRequestSpan(builder).build();
}
public AckSpan buildAckSpan(AckSpan.Builder builder){
return span.buildAckSpan(builder).build();
}
public SpanTagBuilder setBusinessKey(String businessKey) {
span.setTag(Tag.BUSINESS_KEY, businessKey);
return this;
}
public SpanTagBuilder setSpanTypeDesc(String spanTypeDesc) {
span.setTag(Tag.CALL_DESC, spanTypeDesc);
return this;
}
public SpanTagBuilder setCallType(String callType) {
span.setTag(Tag.CALL_TYPE, callType);
return this;
}
public SpanTagBuilder setProcessNo(int processNo) {
span.setTag(Tag.PROCESS_NO, processNo + "");
return this;
}
public SpanTagBuilder setAddress(String address) {
span.setTag(Tag.ADDRESS, address);
return this;
}
public SpanTagBuilder setStatusCode(int statusCode){
span.setTag(Tag.STATUS, statusCode + "");
return this;
}
public SpanTagBuilder setExceptionStack(String exceptionStack){
span.setTag(Tag.EXCEPTION_STACK, exceptionStack);
return this;
}
}
......@@ -4,7 +4,7 @@ package com.a.eye.skywalking.model;
* Created by wusheng on 2016/11/26.
*/
public interface SpanType {
int LOCAL = 0;
int RPC_CLIENT = 1;
int RPC_SERVER = 2;
String LOCAL = "0";
String RPC_CLIENT = "1";
String RPC_SERVER = "2";
}
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking-sdk-plugin</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-api</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-sdk-plugin</artifactId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<artifactId>skywalking-httpClient-4.x-plugin</artifactId>
......@@ -23,7 +23,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-api</artifactId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</dependency>
......
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking-sdk-plugin</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-api</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-sdk-plugin</artifactId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<artifactId>skywalking-jedis-2.x-plugin</artifactId>
......@@ -15,10 +15,6 @@
<name>jedis-2.x-plugin</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>redis.clients</groupId>
......
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking-sdk-plugin</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -13,10 +13,6 @@
<name>motan-plugin</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Motan -->
<dependency>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-sniffer</artifactId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<artifactId>skywalking-sdk-plugin</artifactId>
......@@ -17,6 +17,7 @@
<module>jedis-2.x-plugin</module>
<module>tomcat-7.x-8.x-plugin</module>
<module>motan-plugin</module>
<module>rmi-oracle-1.8-plugin</module>
</modules>
<packaging>pom</packaging>
......@@ -31,7 +32,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-api</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
......
<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-sdk-plugin</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>rmi-oracle-1.8-plugin</artifactId>
<packaging>jar</packaging>
<name>rmi-oracle-1.8-plugin</name>
<url>http://maven.apache.org</url>
</project>
package com.a.eye.skywalking.plugin.rmi.oracle18;
import com.a.eye.skywalking.api.IBuriedPointType;
/**
* Created by xin on 2016/12/22.
*/
public class RMIBuriedPointType implements IBuriedPointType{
public static RMIBuriedPointType INSTANCE = new RMIBuriedPointType();
private RMIBuriedPointType(){
}
@Override
public String getTypeName() {
return "R";
}
@Override
public CallType getCallType() {
return CallType.SYNC;
}
}
package com.a.eye.skywalking.plugin.rmi.oracle18;
import com.a.eye.skywalking.invoke.monitor.RPCClientInvokeMonitor;
import com.a.eye.skywalking.model.ContextData;
import com.a.eye.skywalking.model.Identification;
import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext;
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodInvokeContext;
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInterceptResult;
import java.lang.reflect.Method;
import java.util.Arrays;
/**
* Created by xin on 2016/12/22.
*/
public class RMIClientInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext, MethodInterceptResult result) {
Object[] arguments = (Object[]) interceptorContext.allArguments()[3];
ContextData contextData = new RPCClientInvokeMonitor()
.beforeInvoke(Identification.newBuilder().viewPoint(((Method) interceptorContext.
allArguments()[2]).getName()).spanType(RMIBuriedPointType.INSTANCE).build());
String contextDataStr = contextData.toString();
Object[] newArguments = Arrays.copyOf(arguments, arguments.length + 1);
newArguments[arguments.length] = contextDataStr;
interceptorContext.allArguments()[3] = newArguments;
}
@Override
public Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext, Object ret) {
new RPCClientInvokeMonitor().afterInvoke();
return ret;
}
@Override
public void handleMethodException(Throwable t, EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext) {
new RPCClientInvokeMonitor().occurException(t);
}
}
package com.a.eye.skywalking.plugin.rmi.oracle18.define;
import com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint;
import com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint;
import com.a.eye.skywalking.plugin.interceptor.MethodMatcher;
import com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import com.a.eye.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
/**
* Created by xin on 2016/12/22.
*/
public class RMIClientDefine extends ClassInstanceMethodsEnhancePluginDefine {
@Override
protected String enhanceClassName() {
return "java.rmi.serve.RemoteObjectInvocationHandler";
}
@Override
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
return new ConstructorInterceptPoint[0];
}
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
return new InstanceMethodsInterceptPoint[]{
new InstanceMethodsInterceptPoint() {
@Override
public MethodMatcher[] getMethodsMatchers() {
return new MethodMatcher[]{
new SimpleMethodMatcher("invokeRemoteMethod")
};
}
@Override
public String getMethodsInterceptor() {
return "com.a.eye.skywalking.plugin.rmi.oracle18.RMIClientInterceptor";
}
}
};
}
}
com.a.eye.skywalking.plugin.rmi.oracle18.define.RMIClientDefine
\ No newline at end of file
......@@ -3,7 +3,7 @@
<parent>
<artifactId>skywalking-sdk-plugin</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -14,7 +14,6 @@
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tomcat.version>8.0.36</tomcat.version>
</properties>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-sniffer</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
......@@ -22,7 +22,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-api</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
</project>
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-toolkit-activation</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-toolkit-activation</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-toolkit-activation</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -4,7 +4,7 @@
<parent>
<artifactId>skywalking-toolkit-activation</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -16,7 +16,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-api</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
</project>
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -22,7 +22,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-network</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
......@@ -32,17 +32,17 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-registry</artifactId>
<version>${project.parent.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-logging-impl-log4j2</artifactId>
<version>${project.parent.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-health-report</artifactId>
<version>${project.parent.version}</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
......
......@@ -4,7 +4,7 @@
<parent>
<artifactId>skywalking-storage-center</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -28,7 +28,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-util</artifactId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
......@@ -74,7 +74,7 @@
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
<imageName>skywalking/skywalking-routing</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>${skywalking.version}</imageTag>
</imageTags>
<resources>
<resource>
......
......@@ -37,6 +37,7 @@ public class Main {
logger.info("Skywalking routing service was started.");
Thread.currentThread().join();
} catch (Exception e) {
e.printStackTrace();
logger.error("Failed to start routing service.", e);
System.exit(-1);
} finally {
......
......@@ -22,7 +22,7 @@ public class SpanAlarmHandler implements EventHandler<AckSpanHolder> {
}
private String generateAlarmMessageKey(AckSpanHolder span, FatalReason reason) {
return span.getAckSpan().getUsername() + "-" + span.getAckSpan().getApplicationCode() + "-" + (System.currentTimeMillis() / (10000 * 6)) + reason.getDetail();
return span.getUserName() + "-" + span.getApplicationCode() + "-" + (System.currentTimeMillis() / (10000 * 6)) + reason.getDetail();
}
@Override
......
......@@ -7,9 +7,9 @@ public class ExceptionChecker implements ISpanChecker {
@Override
public CheckResult check(AckSpanHolder span) {
if (span.getAckSpan().getStatusCode() != 1)
if (span.getStatusCode() != 1)
return new CheckResult();
String exceptionStack = span.getAckSpan().getExceptionStack();
String exceptionStack = span.getExceptionStack();
if (exceptionStack == null) {
exceptionStack = "";
} else if (exceptionStack.length() > Config.Alarm.ALARM_EXCEPTION_STACK_LENGTH) {
......
package com.a.eye.skywalking.routing.alarm.checker;
import com.a.eye.skywalking.network.model.Tag;
import com.a.eye.skywalking.routing.disruptor.ack.AckSpanHolder;
/**
......@@ -22,7 +23,7 @@ public abstract class ExecuteTimeChecker implements ISpanChecker {
protected abstract FatalReason getFatalLevel();
protected String generateAlarmMessage(AckSpanHolder span) {
return span.getAckSpan().getViewpointId() + " cost " + span.getAckSpan().getCost() + " ms.";
return span.getViewPoint() + span.getAckSpan().getCost() + " ms.";
}
......
package com.a.eye.skywalking.routing.disruptor.ack;
import com.a.eye.skywalking.network.grpc.AckSpan;
import com.a.eye.skywalking.network.model.Tag;
/**
* Created by xin on 2016/11/27.
......@@ -22,4 +23,24 @@ public class AckSpanHolder {
public AckSpan getAckSpan() {
return ackSpan;
}
public String getViewPoint() {
return ackSpan.getTagsMap().get(Tag.VIEW_POINT.key());
}
public String getUserName() {
return ackSpan.getTagsMap().get(Tag.USER_NAME.key());
}
public String getApplicationCode() {
return ackSpan.getTagsMap().get(Tag.APPLICATION_CODE.key());
}
public int getStatusCode() {
return Integer.parseInt(ackSpan.getTagsMap().get(Tag.STATUS.key()));
}
public String getExceptionStack(){
return ackSpan.getTagsMap().get(Tag.EXCEPTION_STACK.key());
}
}
......@@ -6,6 +6,7 @@ import com.a.eye.skywalking.routing.alarm.SpanAlarmHandler;
import com.a.eye.skywalking.routing.alarm.sender.AlarmMessageSender;
import com.a.eye.skywalking.routing.alarm.sender.AlarmMessageSenderFactory;
import com.a.eye.skywalking.routing.disruptor.ack.AckSpanHolder;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -17,6 +18,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
import static com.a.eye.skywalking.network.model.Tag.*;
@RunWith(PowerMockRunner.class)
@PrepareForTest(AlarmMessageSenderFactory.class)
......@@ -36,15 +38,16 @@ public class SpanAlarmHandlerTest {
PowerMockito.mockStatic(AlarmMessageSenderFactory.class);
when(AlarmMessageSenderFactory.getSender()).thenReturn(messageHandler);
long startTime = System.currentTimeMillis();
AckSpan.Builder builder = AckSpan.newBuilder().setApplicationCode("test").setUsername("test").setCost(20)
.setStatusCode(0).setLevelId(0).setParentLevel("0.0").setTraceId(TraceId.newBuilder()
AckSpan.Builder builder = AckSpan.newBuilder().putTags(APPLICATION_CODE.key(), "test")
.putTags(USER_NAME.key(), "test").setCost(20)
.putTags(STATUS.key(), "0").setLevelId(0).setParentLevel("0.0").setTraceId(TraceId.newBuilder()
.addSegments(2016).addSegments(startTime).addSegments(2).addSegments(100).addSegments(30)
.addSegments(1).build());
normalAckSpan = new AckSpanHolder(builder.build());
costMuchSpan = new AckSpanHolder(builder.setCost(600).build());
costTooMuchSpan = new AckSpanHolder(builder.setCost(4000).build());
exceptionSpan = new AckSpanHolder(builder.setCost(20).setStatusCode(1).setExceptionStack("occur exception").build());
exceptionSpan = new AckSpanHolder(builder.setCost(20).putTags(STATUS.key(), "1").putTags(EXCEPTION_STACK.key(),"occur exception").build());
}
@Test
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>skywalking-storage-center</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<artifactId>skywalking-storage</artifactId>
......@@ -36,7 +36,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-util</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
......@@ -116,7 +116,7 @@
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
<imageName>skywalking/skywalking-storage</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>${skywalking.version}</imageTag>
</imageTags>
<resources>
<resource>
......
......@@ -41,7 +41,6 @@ public class Main {
public static void main(String[] args) {
try {
System.out.println(" =========== ::::::::::: {} " + System.getProperty("STORAGE_HOME") + File.separator );
initConfig();
HealthCollector.init(SERVER_REPORTER_NAME);
......
package com.a.eye.skywalking.storage.data.spandata;
import com.a.eye.skywalking.network.grpc.AckSpan;
import com.a.eye.skywalking.network.grpc.TraceId;
import com.a.eye.skywalking.network.model.Tag;
/**
* Created by xin on 2016/11/12.
......@@ -50,26 +50,16 @@ public class AckSpanData extends AbstractSpanData {
}
public String getExceptionStack() {
return ackSpan.getExceptionStack();
}
public int getStatusCode() {
return ackSpan.getStatusCode();
}
String exceptionStack = ackSpan.getTagsMap().get(Tag.EXCEPTION_STACK.key());
if (exceptionStack == null){
return "";
}
public String getViewPointId(){
return ackSpan.getViewpointId();
return exceptionStack;
}
public String getUserName(){
return ackSpan.getUsername();
}
public String getApplicationCode(){
return ackSpan.getApplicationCode();
public int getStatusCode() {
return Integer.parseInt(ackSpan.getTagsMap().get(Tag.STATUS.key()));
}
public TraceId getTraceId(){
return ackSpan.getTraceId();
}
}
package com.a.eye.skywalking.storage.data.spandata;
import com.a.eye.skywalking.network.grpc.RequestSpan;
import com.a.eye.skywalking.network.grpc.TraceId;
import com.a.eye.skywalking.network.model.Tag;
/**
* Created by xin on 2016/11/12.
......@@ -45,26 +45,25 @@ public class RequestSpanData extends AbstractSpanData {
return buildLevelId(requestSpan.getParentLevel(), requestSpan.getLevelId());
}
public String getParentLevelId(){
public String getParentLevelId() {
return requestSpan.getParentLevel();
}
public int getLevelId(){
public int getLevelId() {
return requestSpan.getLevelId();
}
public String getAddress() {
return requestSpan.getAddress();
return requestSpan.getTagsMap().get(Tag.ADDRESS.key());
}
public String getApplicationCode() {
return requestSpan.getApplicationCode();
return requestSpan.getTagsMap().get(Tag.APPLICATION_CODE.key());
}
public int getProcessNo() {
return requestSpan.getProcessNo();
return Integer.parseInt((requestSpan.getTagsMap().get(Tag.PROCESS_NO.key())));
}
public long getStartTime() {
......@@ -72,22 +71,27 @@ public class RequestSpanData extends AbstractSpanData {
}
public String getBusinessKey() {
return requestSpan.getBusinessKey();
String businessKey = requestSpan.getTagsMap().get(Tag.BUSINESS_KEY.key());
if (businessKey == null) {
return "";
}
return businessKey;
}
public String getCallType() {
return requestSpan.getCallType();
return requestSpan.getTagsMap().get(Tag.CALL_TYPE.key());
}
public int getType() {
return requestSpan.getSpanType();
return Integer.parseInt(requestSpan.getTagsMap().get(Tag.SPAN_TYPE.key()));
}
public String getViewPoint(){
return requestSpan.getViewPointId();
public String getViewPoint() {
return requestSpan.getTagsMap().get(Tag.VIEW_POINT.key());
}
public String getSpanTypeDesc() {
return requestSpan.getSpanTypeDesc();
return requestSpan.getTagsMap().get(Tag.CALL_DESC.key());
}
}
......@@ -4,6 +4,7 @@ import com.a.eye.skywalking.network.grpc.RequestSpan;
import com.a.eye.skywalking.network.grpc.TraceId;
import com.a.eye.skywalking.network.grpc.client.SpanStorageClient;
import com.a.eye.skywalking.network.listener.client.StorageClientListener;
import com.a.eye.skywalking.network.model.Tag;
import com.a.eye.skywalking.registry.assist.NetUtils;
import java.util.ArrayList;
......@@ -13,8 +14,8 @@ import java.util.concurrent.CountDownLatch;
public class StorageThread extends Thread {
private SpanStorageClient client;
private long count;
private CountDownLatch countDownLatch;
private long count;
private CountDownLatch countDownLatch;
private MyStorageClientListener listener;
private int index;
......@@ -35,14 +36,17 @@ public class StorageThread extends Thread {
for (int i = 0; i < count; i++) {
long value = System.currentTimeMillis();
RequestSpan requestSpan = RequestSpan.newBuilder().setSpanType(1).setAddress(NetUtils.getLocalAddress().toString()).setApplicationCode("1").setCallType("1").setLevelId(0)
.setProcessNo(19287).setStartDate(System.currentTimeMillis())
RequestSpan requestSpan = RequestSpan.newBuilder().putTags(Tag.SPAN_TYPE.toString(), "1")
.putTags(Tag.ADDRESS.toString(), NetUtils.getLocalAddress().toString())
.putTags(Tag.APPLICATION_CODE.toString(), "1")
.putTags(Tag.CALL_TYPE.toString(), "1").setLevelId(0)
.putTags(Tag.PROCESS_NO.toString(), "19287").setStartDate(System.currentTimeMillis())
.setTraceId(TraceId.newBuilder().addSegments(201611).addSegments(value).addSegments(8504828).addSegments(2277).addSegments(53).addSegments(3).build())
.setUsername("1").setViewPointId("http://localhost:8080/wwww/test/helloWorld").setRouteKey(i).build();
.putTags(Tag.USER_NAME.toString(), "1").putTags(Tag.VIEW_POINT.toString(), "http://localhost:8080/wwww/test/helloWorld").setRouteKey(i).build();
AckSpan ackSpan = AckSpan.newBuilder().setLevelId(0).setCost(10).setTraceId(
TraceId.newBuilder().addSegments(201611).addSegments(value).addSegments(8504828).addSegments(2277).addSegments(53).addSegments(3)
.build()).setStatusCode(0).setViewpointId("http://localhost:8080/wwww/test/helloWorld").setRouteKey(i).build();
.build()).putTags(Tag.STATUS.toString(), "0").putTags(Tag.VIEW_POINT.toString(), "http://localhost:8080/wwww/test/helloWorld").setRouteKey(i).build();
requestSpanList.add(requestSpan);
ackSpanList.add(ackSpan);
cycle++;
......@@ -71,7 +75,7 @@ public class StorageThread extends Thread {
countDownLatch.countDown();
}
public class MyStorageClientListener implements StorageClientListener{
public class MyStorageClientListener implements StorageClientListener {
volatile boolean isCompleted = false;
@Override
......@@ -84,7 +88,7 @@ public class StorageThread extends Thread {
isCompleted = true;
}
public void begin(){
public void begin() {
isCompleted = false;
}
}
......
package com.a.eye.skywalking.storage.data.file;
import com.a.eye.skywalking.network.grpc.RequestSpan;
import com.a.eye.skywalking.network.model.Tag;
import com.a.eye.skywalking.storage.data.index.IndexMetaInfo;
import com.a.eye.skywalking.storage.data.spandata.RequestSpanData;
import com.a.eye.skywalking.storage.data.spandata.SpanDataBuilder;
import org.junit.Assert;
import org.junit.Test;
......@@ -12,22 +14,20 @@ import org.junit.Test;
*/
public class DataFileTest {
@Test
public void testWriteFile(){
public void testWriteFile() {
DataFile dataFile = new DataFile();
IndexMetaInfo info = null;
for (int i = 0; i < 100; i++) {
RequestSpan span = RequestSpan.newBuilder().setUsername("1").setApplicationCode("app").build();
RequestSpan span = RequestSpan.newBuilder().putTags(Tag.USER_NAME.toString(), "1").putTags(Tag.APPLICATION_CODE.toString(), "app").build();
try {
info = dataFile.write(new RequestSpanData(span));
} finally {
dataFile.flush();
}
try {
info = dataFile.write(new RequestSpanData(span));
} finally {
dataFile.flush();
}
RequestSpan newSpan = SpanDataBuilder.buildRequestSpan(dataFile.read(info.getOffset(), info.getLength()));
RequestSpan newSpan = SpanDataBuilder.buildRequestSpan(dataFile.read(info.getOffset(), info.getLength()));
Assert.assertEquals("1", newSpan.getUsername());
}
Assert.assertEquals("1", newSpan.getTagsMap().get(Tag.USER_NAME.key()));
}
}
package com.a.eye.skywalking.storage.data.index;
import com.a.eye.skywalking.network.grpc.RequestSpan;
import com.a.eye.skywalking.network.grpc.TraceId;
import com.a.eye.skywalking.storage.data.file.DataFileNameDesc;
import com.a.eye.skywalking.storage.data.spandata.RequestSpanData;
import com.a.eye.skywalking.registry.assist.NetUtils;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* Created by wusheng on 2016/11/30.
*/
public class IndexOperatorTest {
public static void main(String[] args) {
try {
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("test_es"), 9300));
IndexOperator operator = new IndexOperator(client);
for (int i = 0; i < 1_000_000_000; i++) {
IndexMetaCollection collection = new IndexMetaCollection();
for (int j = 0; j < 100; j++) {
RequestSpan requestSpan =
RequestSpan.newBuilder().setSpanType(1).setAddress(NetUtils.getLocalAddress().toString()).setApplicationCode("1").setCallType("1").setLevelId(0)
.setProcessNo(19287).setStartDate(System.currentTimeMillis()).setTraceId(
TraceId.newBuilder().addSegments(201611).addSegments(j).addSegments(8504828).addSegments(2277).addSegments(53).addSegments(3).build())
.setUsername("1").setViewPointId("http://localhost:8080/wwww/test/helloWorld").setRouteKey(i).build();
IndexMetaInfo info = new IndexMetaInfo(new RequestSpanData(requestSpan), new DataFileNameDesc(), i, j);
collection.add(info);
}
operator.batchUpdate(collection);
if (i % 100 == 0) {
System.out.println(" num=" + i + " ");
}
}
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
......@@ -6,7 +6,7 @@
<parent>
<artifactId>skywalking</artifactId>
<groupId>com.a.eye</groupId>
<version>2.1-2017</version>
<version>${skywalking.version}</version>
</parent>
<artifactId>skywalking-webui</artifactId>
......@@ -20,7 +20,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-network</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
......@@ -111,7 +111,7 @@
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-util</artifactId>
<version>${project.version}</version>
<version>${skywalking.version}</version>
</dependency>
</dependencies>
......@@ -128,7 +128,7 @@
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
<imageName>skywalking/skywalking-webui</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>${skywalking.version}</imageTag>
</imageTags>
<resources>
<resource>
......
......@@ -27,35 +27,6 @@ public class TraceNodeDao implements ITraceNodeDao {
return new SearchClient().searchSpan(traceId);
}
// TODO: 2016/12/10
private Collection<TraceNodeInfo> generateTestData() {
long startTime = System.currentTimeMillis();
TraceId traceId = TraceId.newBuilder()
.addSegments(202016)
.addSegments(startTime)
.addSegments(-1)
.addSegments(1234)
.addSegments(1234)
.addSegments(1234).build();
Span rootSpan = Span.newBuilder().setSpanType(1).setAddress("127.0.0.1/ascrutae").setApplicationCode("test")
.setCallType("S").setCost(200).setLevelId(0).setViewpoint("provider://127.0.0.1:20880/com.a.eye.dubbo.provider.GreetService.sayHello()")
.setProcessNo(19872)
.setTraceId(traceId).setStartTime(startTime)
.setStatusCode(0).setUsername("test").build();
Span span = Span.newBuilder().setSpanType(1).setAddress("127.0.0.1/ascrutae").setApplicationCode("test")
.setCallType("S").setCost(100).setParentLevelId("0").setLevelId(0).setViewpoint("consumer://127.0.0.1:20880/com.a.eye.dubbo.provider.GreetService.sayHello()")
.setProcessNo(19872)
.setTraceId(traceId).setStartTime(startTime + 50)
.setStatusCode(0).setUsername("test").build();
List<TraceNodeInfo> nodeInfos = new ArrayList<>();
nodeInfos.add(new TraceNodeInfo(rootSpan));
nodeInfos.add(new TraceNodeInfo(span));
return nodeInfos;
}
private void computeRPCInfo(Map<String, TraceNodeInfo> rpcMap, Map<String, TraceNodeInfo> traceLogMap) {
// 合并处理
if (rpcMap.size() > 0) {
......
......@@ -12,7 +12,7 @@ public class FullSpan {
protected String traceId;
protected int levelId;
protected String viewPointId;
protected String applicationId;
protected String applicationCode;
protected String callType;
protected long cost;
protected String businessKey;
......@@ -37,7 +37,7 @@ public class FullSpan {
this.traceId = traceId.substring(0, traceId.length() - 1);
this.levelId = span.getLevelId();
this.parentLevelId = span.getParentLevelId();
this.applicationId = span.getApplicationCode();
this.applicationCode = span.getApplicationCode();
this.callType = span.getCallType();
this.businessKey = span.getBusinessKey();
this.spanTypeDesc = span.getSpanTypeDesc();
......@@ -65,8 +65,8 @@ public class FullSpan {
return viewPointId;
}
public String getApplicationId() {
return applicationId;
public String getApplicationCode() {
return applicationCode;
}
public String getCallType() {
......
......@@ -72,7 +72,7 @@ public class TraceNodeInfo extends FullSpan {
this.statusCodeStr = statusCodeStr;
this.statusCodeName = statusCodeName;
this.applicationIdStr = this.applicationId;
this.applicationIdStr = this.applicationCode;
if (!StringUtil.isEmpty(this.viewPointId) && this.viewPointId.length() > 60) {
this.viewPointIdSub = this.viewPointId.substring(0, 30) + "..." + this.viewPointId
.substring(this.viewPointId.length() - 30);
......@@ -137,7 +137,7 @@ public class TraceNodeInfo extends FullSpan {
+ ", viewPointId=" + viewPointId + ", startDate=" + startDate + ", cost=" + cost + ", address="
+ address + ", statusCode=" + statusCode + ", exceptionStack=" + exceptionStack + ", spanType="
+ spanType + ", businessKey=" + businessKey + ", processNo=" + processNo + ", applicationId="
+ applicationId + "]";
+ applicationCode + "]";
}
public List<TimeLineEntry> getTimeLineList() {
......
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/test
jdbc.url=jdbc:mysql://localhost:3307/test
jdbc.username=root
jdbc.password=root
jdbc.maxTotal=200
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册