Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
437a2765f0
|
|
@ -3,7 +3,7 @@
|
|||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
# Package Files
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
language: java
|
||||
install:
|
||||
- cd ci-dependencies
|
||||
- mvn install:install-file -Dfile=jmxtools-1.2.1.jar -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar
|
||||
- mvn install:install-file -Dfile=jmxri-1.2.1.jar -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar
|
||||
- mvn install:install-file -Dfile=dubbox-2.8.4.jar -DgroupId=com.alibaba -DartifactId=dubbox -Dversion=2.8.4 -Dpackaging=jar
|
||||
- cd ..
|
||||
|
||||
script:
|
||||
- mvn clean install -Dmaven.test.skip=true
|
||||
|
||||
after_success:
|
||||
- mvn clean cobertura:cobertura coveralls:report
|
||||
10
README.md
10
README.md
|
|
@ -1,5 +1,10 @@
|
|||
# Sky Walking
|
||||
Sky Walking
|
||||
==========
|
||||
|
||||
SkyWalking: Large-Scale Distributed Systems Tracing Infrastructure, 是一个对JAVA分布式应用程序集群的业务运行情况进行追踪、告警和分析的系统。
|
||||
|
||||
[](https://travis-ci.org/wu-sheng/sky-walking)
|
||||
|
||||
* 核心理论为[Google Dapper论文:Dapper, a Large-Scale Distributed Systems Tracing Infrastructure](http://research.google.com/pubs/pub36356.html),英语有困难的同学可参考[国内翻译](http://duanple.blog.163.com/blog/static/70971767201329113141336/)
|
||||
* 本分析系统能通过不修改或少量修改代码的模式,对现有的JAVA应用或J2EE应用进行监控和数据收集,并针对应用进场进行准实时告警。此外提供大量的调用性能分析功能,解决目前的监控系统主要监控进程、端口而非应用实际性能的问题。
|
||||
* 支持国内常用的dubbo以及dubbox等常见RPC框架,支持应用异常的邮件告警
|
||||
|
|
@ -12,8 +17,9 @@ SkyWalking: Large-Scale Distributed Systems Tracing Infrastructure, 是一个对
|
|||
|spring-plugin| spring配置文件 | - | - | - |
|
||||
|jdbc-plugin| jdbc配置文件 | - | - | - |
|
||||
|mysql-plugin| - | YES | - | - |
|
||||
|httpClient-4.x-plugin| - | YES | - | -
|
||||
|httpClient-4.x-plugin| - | YES | - | - |
|
||||
|httpClient-4.x-plugin-dubbox-rest-attachment| - | YES | - | 需引用httpClient-4.x-plugin |
|
||||
|jedis-2.x-plugin| - | YES | - | - |
|
||||
|httpclient-4.2.x-plugin| - | - | YES | 需要使用新提供的httpClient包装对象 |
|
||||
|httpclient-4.3.x-plugin| - | - | YES | 需要使用新提供的httpClient包装对象 |
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,74 @@
|
|||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<modules>
|
||||
<module>samples/skywalking-auth</module>
|
||||
<module>skywalking-protocol</module>
|
||||
<module>skywalking-api</module>
|
||||
<module>skywalking-sdk-plugin</module>
|
||||
<module>skywalking-server</module>
|
||||
<module>skywalking-alarm</module>
|
||||
<module>skywalking-analysis</module>
|
||||
<module>skywalking-webui</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>skywalking</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- plugin for coveralls.io -->
|
||||
<plugin>
|
||||
<groupId>org.eluder.coveralls</groupId>
|
||||
<artifactId>coveralls-maven-plugin</artifactId>
|
||||
<version>4.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
<configuration>
|
||||
<format>xml</format>
|
||||
<maxmem>256m</maxmem>
|
||||
<!-- aggregated reports for multi-module projects -->
|
||||
<aggregate>true</aggregate>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -1,180 +1,205 @@
|
|||
<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>
|
||||
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.ai.cloud</groupId>
|
||||
<artifactId>skywalking-alarm</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-alarm</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>skywalking-alarm</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<name>skywalking-alarm</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>1.5.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.23</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-framework</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.zookeeper</groupId>
|
||||
<artifactId>zookeeper</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-recipes</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.37</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>2.4.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/installer/config</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-start-script</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/installer/bin</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>bin</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/installer/lib</outputDirectory>
|
||||
<excludeTransitive>false</excludeTransitive>
|
||||
<stripVersion>true</stripVersion>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>*.properties</exclude>
|
||||
<exclude>*.xml</exclude>
|
||||
</excludes>
|
||||
<finalName>sky-alarm-server</finalName>
|
||||
<outputDirectory>${project.build.directory}/installer/lib</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>clean</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<mkdir dir="${project.build.directory}/installer/log"/>
|
||||
<mkdir dir="${project.build.directory}/installer/bin"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>1.5.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.23</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-framework</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.zookeeper</groupId>
|
||||
<artifactId>zookeeper</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-recipes</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.37</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>2.4.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/installer/config</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-start-script</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/installer/bin</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>bin</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/installer/lib</outputDirectory>
|
||||
<excludeTransitive>false</excludeTransitive>
|
||||
<stripVersion>true</stripVersion>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>*.properties</exclude>
|
||||
<exclude>*.xml</exclude>
|
||||
</excludes>
|
||||
<finalName>sky-alarm-server</finalName>
|
||||
<outputDirectory>${project.build.directory}/installer/lib</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>clean</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<mkdir dir="${project.build.directory}/installer/log" />
|
||||
<mkdir dir="${project.build.directory}/installer/bin" />
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>mvnrepository</id>
|
||||
<name>mvnrepository</name>
|
||||
<url>http://mvnrepository.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jbossrepository</id>
|
||||
<name>jboss repository</name>
|
||||
<url>http://repository.jboss.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@
|
|||
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>
|
||||
|
||||
<parent>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.ai.cloud.skywalking.plugin.interceptor;
|
||||
|
||||
public class InterceptorException extends RuntimeException {
|
||||
private static final long serialVersionUID = 7846035239994885019L;
|
||||
|
||||
public InterceptorException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InterceptorException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.ai.cloud.skywalking.plugin.interceptor.assist;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.EnhancedClassInstanceContext;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorException;
|
||||
|
||||
/**
|
||||
* 用于首次拦截方法调用,避免方法内部的方法调用被多次拦截。
|
||||
*
|
||||
* @author wusheng
|
||||
*
|
||||
*/
|
||||
public abstract class FirstInvokeInterceptor implements IAroundInterceptor {
|
||||
protected String invokeCounterKey = "__$invokeCounterKey";
|
||||
|
||||
protected Object invokeCounterInstLock = new Object();
|
||||
|
||||
public boolean isFirstBeforeMethod(EnhancedClassInstanceContext context) {
|
||||
if (!context.isContain(invokeCounterKey)) {
|
||||
synchronized (invokeCounterInstLock) {
|
||||
if (!context.isContain(invokeCounterKey)) {
|
||||
context.set(invokeCounterKey, new AtomicInteger(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
AtomicInteger counter = context.get(invokeCounterKey,
|
||||
AtomicInteger.class);
|
||||
return counter.incrementAndGet() == 1;
|
||||
}
|
||||
|
||||
public boolean isLastAfterMethod(EnhancedClassInstanceContext context) {
|
||||
if (!context.isContain(invokeCounterKey)) {
|
||||
throw new InterceptorException(
|
||||
"key=invokeCounterKey not found is context. unexpected failue.");
|
||||
}
|
||||
AtomicInteger counter = context.get(invokeCounterKey,
|
||||
AtomicInteger.class);
|
||||
return counter.decrementAndGet() == 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -35,9 +35,10 @@ public final class BuriedPointMachineUtil {
|
|||
if (StringUtil.isEmpty(IP)) {
|
||||
InetAddress netAddress = getInetAddress();
|
||||
if (null == netAddress) {
|
||||
return null;
|
||||
IP = "N/A";
|
||||
}else{
|
||||
IP = netAddress.getHostAddress(); //get the ip address
|
||||
}
|
||||
IP = netAddress.getHostAddress(); //get the ip address
|
||||
}
|
||||
return IP;
|
||||
}
|
||||
|
|
@ -46,9 +47,10 @@ public final class BuriedPointMachineUtil {
|
|||
if (StringUtil.isEmpty(hostName)) {
|
||||
InetAddress netAddress = getInetAddress();
|
||||
if (null == netAddress) {
|
||||
return null;
|
||||
hostName = "N/A";
|
||||
}else{
|
||||
hostName = netAddress.getHostName(); //get the host address
|
||||
}
|
||||
hostName = netAddress.getHostName(); //get the host address
|
||||
}
|
||||
return hostName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package test.ai.cloud.api;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ai.cloud.skywalking.buriedpoint.RPCBuriedPointSender;
|
||||
import com.ai.cloud.skywalking.model.Identification;
|
||||
import com.ai.cloud.skywalking.model.Identification.IdentificationBuilder;
|
||||
|
||||
public class TimeTest {
|
||||
@Test
|
||||
public void test(){
|
||||
RPCBuriedPointSender sender = new RPCBuriedPointSender();
|
||||
long start = System.currentTimeMillis();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
IdentificationBuilder builder = Identification
|
||||
.newBuilder()
|
||||
.viewPoint("1111");
|
||||
sender.beforeSend(builder.build());
|
||||
sender.afterSend();
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println(end - start + "ms");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,12 +2,9 @@ package test.ai.cloud.plugin;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.TracingBootstrap;
|
||||
|
||||
public class PluginMainTest {
|
||||
@Test
|
||||
public void testMain() throws IllegalAccessException,
|
||||
IllegalArgumentException, InvocationTargetException,
|
||||
NoSuchMethodException, SecurityException, ClassNotFoundException {
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@
|
|||
<artifactId>skywalking-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-auth</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-api</artifactId>
|
||||
|
|
@ -94,18 +88,20 @@
|
|||
<version>0.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbox</artifactId>
|
||||
<version>2.8.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.alibaba</groupId>-->
|
||||
<!--<artifactId>dubbox</artifactId>-->
|
||||
<!--<version>2.8.4</version>-->
|
||||
<!--<scope>compile</scope>-->
|
||||
<!--</dependency>-->
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbox</artifactId>
|
||||
<version>2.8.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@
|
|||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.3</version>
|
||||
<scope>test</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.2</version>
|
||||
<scope>test</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>2.8.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package org.skywalking.jedis.v2.plugin;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import redis.clients.jedis.JedisShardInfo;
|
||||
|
||||
import com.ai.cloud.skywalking.buriedpoint.RPCBuriedPointSender;
|
||||
import com.ai.cloud.skywalking.model.Identification;
|
||||
import com.ai.cloud.skywalking.model.Identification.IdentificationBuilder;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.ConstructorInvokeContext;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.EnhancedClassInstanceContext;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.MethodInvokeContext;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.assist.FirstInvokeInterceptor;
|
||||
|
||||
public class JedisInterceptor extends FirstInvokeInterceptor {
|
||||
private static final String REDIS_CONN_INFO_KEY = "redisConnInfo";
|
||||
|
||||
private static RPCBuriedPointSender sender = new RPCBuriedPointSender();
|
||||
|
||||
@Override
|
||||
public void onConstruct(EnhancedClassInstanceContext context,
|
||||
ConstructorInvokeContext interceptorContext) {
|
||||
String redisConnInfo = "";
|
||||
if (interceptorContext.allArguments().length > 0) {
|
||||
if (interceptorContext.allArguments()[0] instanceof String) {
|
||||
redisConnInfo = (String) interceptorContext.allArguments()[0];
|
||||
if (interceptorContext.allArguments().length > 1) {
|
||||
redisConnInfo += ":"
|
||||
+ (Integer) interceptorContext.allArguments()[1];
|
||||
}
|
||||
} else if (interceptorContext.allArguments()[0] instanceof JedisShardInfo) {
|
||||
JedisShardInfo shardInfo = (JedisShardInfo) interceptorContext
|
||||
.allArguments()[0];
|
||||
redisConnInfo = shardInfo.getHost() + ":" + shardInfo.getPort();
|
||||
} else if (interceptorContext.allArguments()[0] instanceof URI) {
|
||||
URI uri = (URI) interceptorContext.allArguments()[0];
|
||||
redisConnInfo = uri.getHost() + ":" + uri.getPort();
|
||||
}
|
||||
}
|
||||
context.set(REDIS_CONN_INFO_KEY, redisConnInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedClassInstanceContext context,
|
||||
MethodInvokeContext interceptorContext) {
|
||||
if (this.isFirstBeforeMethod(context)) {
|
||||
/**
|
||||
* redis server wouldn't process rpc context. ignore the
|
||||
* return(ContextData) of sender's beforeSend
|
||||
*/
|
||||
IdentificationBuilder builder = Identification
|
||||
.newBuilder()
|
||||
.viewPoint(
|
||||
context.get(REDIS_CONN_INFO_KEY, String.class)
|
||||
+ " " + interceptorContext.methodName())
|
||||
.spanType(RedisBuriedPointType.instance());
|
||||
if (interceptorContext.allArguments().length > 0
|
||||
&& interceptorContext.allArguments()[0] instanceof String) {
|
||||
builder.businessKey("key="
|
||||
+ interceptorContext.allArguments()[0]);
|
||||
}
|
||||
sender.beforeSend(builder.build());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedClassInstanceContext context,
|
||||
MethodInvokeContext interceptorContext, Object ret) {
|
||||
if (this.isLastAfterMethod(context)) {
|
||||
sender.afterSend();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Throwable t,
|
||||
EnhancedClassInstanceContext context,
|
||||
MethodInvokeContext interceptorContext, Object ret) {
|
||||
sender.handleException(t);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package org.skywalking.jedis.v2.plugin;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
|
||||
public class RedisBuriedPointType implements IBuriedPointType {
|
||||
private static RedisBuriedPointType redisBuriedPointType;
|
||||
|
||||
public static IBuriedPointType instance() {
|
||||
if (redisBuriedPointType == null) {
|
||||
redisBuriedPointType = new RedisBuriedPointType();
|
||||
}
|
||||
|
||||
return redisBuriedPointType;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return "Redis";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallType getCallType() {
|
||||
return CallType.SYNC;
|
||||
}
|
||||
|
||||
private RedisBuriedPointType(){}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package org.skywalking.jedis.v2.plugin;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.TracingBootstrap;
|
||||
|
||||
public class JedisTest {
|
||||
@Test
|
||||
public void test() throws IllegalAccessException, IllegalArgumentException,
|
||||
InvocationTargetException, NoSuchMethodException,
|
||||
SecurityException, ClassNotFoundException {
|
||||
TracingBootstrap
|
||||
.main(new String[] { "org.skywalking.jedis.v2.plugin.JedisTest" });
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ClassNotFoundException,
|
||||
SQLException, InterruptedException {
|
||||
try(Jedis jedis = new Jedis("10.1.241.18", 16379)){
|
||||
long start = System.currentTimeMillis();
|
||||
jedis.set("11111", "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
||||
for (int i = 0; i < 1; i++) {
|
||||
jedis.get("11111");
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println(end - start + "ms");
|
||||
jedis.del("11111");
|
||||
}
|
||||
}
|
||||
|
||||
public void testNormal() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException, InterruptedException{
|
||||
JedisTest.main(null);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="error">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d [%t](%F:%L) %-5level %logger{36} - %msg%n" />
|
||||
</Console>
|
||||
<Console name="Console2" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d [%t](%F:%L) %-5level %logger{36} - %msg%n" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="debug">
|
||||
<AppenderRef ref="Console" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
#skyWalking用户ID
|
||||
skywalking.user_id=123
|
||||
#skyWalking应用编码
|
||||
skywalking.application_code=test
|
||||
#skywalking auth的环境变量名字
|
||||
skywalking.auth_system_env_name=SKYWALKING_RUN
|
||||
#skywalking数据编码
|
||||
skywalking.charset=UTF-8
|
||||
|
||||
#是否打印数据
|
||||
buriedpoint.printf=true
|
||||
#埋点异常的最大长度
|
||||
buriedpoint.max_exception_stack_length=4000
|
||||
#业务字段的最大长度
|
||||
buriedpoint.businesskey_max_length=300
|
||||
#过滤异常
|
||||
buriedpoint.exclusive_exceptions=java.lang.RuntimeException
|
||||
|
||||
#最大发送者的连接数阀比例
|
||||
sender.connect_percent=100
|
||||
#发送服务端配置
|
||||
sender.servers_addr=127.0.0.1:34000
|
||||
#最大发送的副本数量
|
||||
sender.max_copy_num=2
|
||||
#发送的最大长度
|
||||
sender.max_send_length=20000
|
||||
#当没有Sender时,尝试获取sender的等待周期
|
||||
sender.retry_get_sender_wait_interval=2000
|
||||
#是否开启发送消息
|
||||
sender.is_off=false
|
||||
|
||||
|
||||
#最大消费线程数
|
||||
consumer.max_consumer=2
|
||||
#消费者最大等待时间
|
||||
consumer.max_wait_time=5
|
||||
#发送失败等待时间
|
||||
consumer.consumer_fail_retry_wait_interval=50
|
||||
|
||||
#每个Buffer的最大个数
|
||||
buffer.buffer_max_size=18000
|
||||
#Buffer池的最大长度
|
||||
buffer.pool_size=5
|
||||
|
||||
#发送检查线程检查周期
|
||||
senderchecker.check_polling_time=200
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package org.skywalking.jedis.v2.plugin;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.ConstructorInvokeContext;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.EnhancedClassInstanceContext;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
|
||||
import com.ai.cloud.skywalking.plugin.interceptor.MethodInvokeContext;
|
||||
|
||||
public class JedisInterceptor implements IAroundInterceptor{
|
||||
|
||||
@Override
|
||||
public void onConstruct(EnhancedClassInstanceContext context,
|
||||
ConstructorInvokeContext interceptorContext) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedClassInstanceContext context,
|
||||
MethodInvokeContext interceptorContext) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedClassInstanceContext context,
|
||||
MethodInvokeContext interceptorContext, Object ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Throwable t,
|
||||
EnhancedClassInstanceContext context,
|
||||
MethodInvokeContext interceptorContext, Object ret) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
package org.skywalking.jedis.v2.plugin;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ai.cloud.skywalking.plugin.TracingBootstrap;
|
||||
|
||||
public class JedisTest {
|
||||
|
||||
@Test
|
||||
public void test() throws IllegalAccessException,
|
||||
IllegalArgumentException, InvocationTargetException,
|
||||
NoSuchMethodException, SecurityException, ClassNotFoundException {
|
||||
TracingBootstrap
|
||||
.main(new String[] { "org.skywalking.jedis.v2.plugin.JedisTest" });
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ClassNotFoundException,
|
||||
SQLException, InterruptedException {}
|
||||
|
||||
}
|
||||
|
|
@ -35,9 +35,10 @@ public class MachineUtil {
|
|||
if (StringUtil.isEmpty(IP)) {
|
||||
InetAddress netAddress = getInetAddress();
|
||||
if (null == netAddress) {
|
||||
return null;
|
||||
IP = "N/A";
|
||||
}else{
|
||||
IP = netAddress.getHostAddress(); //get the ip address
|
||||
}
|
||||
IP = netAddress.getHostAddress(); //get the ip address
|
||||
}
|
||||
return IP;
|
||||
}
|
||||
|
|
@ -46,9 +47,10 @@ public class MachineUtil {
|
|||
if (StringUtil.isEmpty(hostName)) {
|
||||
InetAddress netAddress = getInetAddress();
|
||||
if (null == netAddress) {
|
||||
return null;
|
||||
hostName = "N/A";
|
||||
}else{
|
||||
hostName = netAddress.getHostName(); //get the host address
|
||||
}
|
||||
hostName = netAddress.getHostName(); //get the host address
|
||||
}
|
||||
return hostName;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue