Skip to content

a java agent to collect every single sql operation from the target application

License

Notifications You must be signed in to change notification settings

bugVanisher/noslowq-java-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

newsql-agent

慢查询系统客户端, 采集基于jdbc的java应用产生sql的信息

Build Setup

step 1
# Clone project
git clone [email protected]:gannicus-yu/newsql-agent.git

# package
mvn assemly:assemly

# archive the jar file
ls /target/newsql-agent-${version}-SNAPSHOT.jar
step 2

因为执行SQL被组装成了一个异步消息,如果没有部署rocketmq,请自行安装部署消息中间件mq,得到地址 ${namesever地址}

Run

# 下载最新版本的JVM-SANDBOX,https://github.com/alibaba/jvm-sandbox
wget http://ompc.oss-cn-hangzhou.aliyuncs.com/jvm-sandbox/release/sandbox-stable-bin.zip

# 找个地方解压,得到${jvm-sanbox路径}
unzip sandbox-stable-bin.zip

# 添加自定义module, newsql-agent
将newsql-agent-${version}-SNAPSHOT.jar添加到${jvm-sanbox路径}/example

# 修改${jvm-sanbox路径}/cfg/sandbox.properties
system_module = ${jvm-sanbox路径}/module;
user_module = ${jvm-sanbox路径}/example;

# 应用启动参数添加javaagent
-javaagent: ${jvm-sanbox路径}/sandbox-agent.jar -DLABEL=标识符 -DAPPNAME=应用名 -Drocketmq.namesrv.domain=${namesever地址}

Check

# 查看${user.home}/logs/sandbox/sandbox.log
# 类似以下输出则说明加载成功,agent已成功注入应用
2019-03-02 15:09:39 default INFO  active module, module=mbappe-mysql-logger;class=com.alibaba.jvm.sandbox.module.JdbcLoggerModule;module-jar=/Users/gannicus/Downloads/sandbox/example/newsql-agent-1.0.jar;
2019-03-02 15:09:39 default INFO  firing module-event: event=ACTIVE;module=mbappe-mysql-logger;
2019-03-02 15:09:39 default INFO  module[id:mbappe-mysql-logger;class:class com.alibaba.jvm.sandbox.module.JdbcLoggerModule;] watch[id:1000] found classes:0 in loaded for watch(ing).
2019-03-02 15:09:39 default INFO  activated listener[id=1;target=com.alibaba.jvm.sandbox.api.listener.ext.AdviceAdapterListener@f5ac9e4;] event=BEFORE,RETURN,THROWS,IMMEDIATELY_RETURN,IMMEDIATELY_THROWS
2019-03-02 15:09:39 default INFO  firing module-event: event=LOAD_COMPLETED;module=mbappe-mysql-logger;
2019-03-02 15:09:39 default INFO  loaded module-jar completed, loaded 1 module in module-jar=/Users/gannicus/Downloads/sandbox/example/newsql-agent-1.0.jar, modules=[mbappe-mysql-logger]

About

a java agent to collect every single sql operation from the target application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages