Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d18c83f
bug fix
bill23-kim Dec 28, 2015
4253f3f
Update Quick-Start.md
gunlee01 Dec 28, 2015
3a2fe73
Merge pull request #87 from scouter-project/dev
gunlee01 Dec 28, 2015
9d01531
add read
bill23-kim Dec 28, 2015
fe45371
typo
bill23-kim Dec 28, 2015
55d60dd
add comment for javadoc
bill23-kim Dec 28, 2015
81bf62d
refactoring
bill23-kim Dec 28, 2015
11dc4cf
refactoring, documentation
gunlee01 Dec 28, 2015
0190efc
merge commit
gunlee01 Dec 28, 2015
73eed18
refactoring
bill23-kim Dec 29, 2015
786b5bc
add log
bill23-kim Dec 29, 2015
db4e268
commening
gunlee01 Dec 30, 2015
3b68444
fix the package names
sjokim Dec 30, 2015
41bb2b0
bug fix
bill23-kim Dec 30, 2015
5fd6a3e
Merge branch 'dev' of github.com:scouter-project/scouter into dev
gunlee01 Dec 30, 2015
556104d
consystency
gunlee01 Dec 31, 2015
041e865
add the update count by DML to the profile information.
sjokim Dec 31, 2015
1b2dd67
init issue88
gunlee01 Dec 31, 2015
ed51eee
add engineering option -> trace log
gunlee01 Jan 1, 2016
f2aecc2
deal with executeBatch, execute and getUpdateCount
gunlee01 Jan 1, 2016
6b7a115
formatting
gunlee01 Jan 2, 2016
379694f
add sqlstep3 with updated count
bill23-kim Jan 2, 2016
db71ab5
apply sql return count profile
bill23-kim Jan 3, 2016
aa94cfb
sql updated count - set minus value in the case of None-CUD
gunlee01 Jan 3, 2016
9961382
stmt method type
sjokim Jan 3, 2016
eee37e7
bugfix
sjokim Jan 3, 2016
6857017
apply sql method type
bill23-kim Jan 3, 2016
3d7b3bf
formatting
bill23-kim Jan 3, 2016
c8b929c
refactoring
gunlee01 Jan 3, 2016
c81ed9c
add engineering option -> trace log
gunlee01 Jan 1, 2016
cd1497a
deal with executeBatch, execute and getUpdateCount
gunlee01 Jan 1, 2016
7129319
add sqlstep3 with updated count
bill23-kim Jan 2, 2016
302243e
apply sql return count profile
bill23-kim Jan 3, 2016
1406899
sql updated count - set minus value in the case of None-CUD
gunlee01 Jan 3, 2016
b7b2884
stmt method type
sjokim Jan 3, 2016
1662ea3
bugfix
sjokim Jan 3, 2016
cd46b0a
apply sql method type
bill23-kim Jan 3, 2016
a16e43e
formatting
bill23-kim Jan 3, 2016
96f6f5d
view refactoring
bill23-kim Jan 4, 2016
9cac9a0
crlf fix
gunlee01 Jan 4, 2016
524edf0
crlf
gunlee01 Jan 4, 2016
ac51fc2
view refactoring
bill23-kim Jan 4, 2016
216141b
Merge branch 'issue88' of github.com:scouter-project/scouter into iss…
gunlee01 Jan 4, 2016
0d01e84
sqlstep3 refactoring
bill23-kim Jan 4, 2016
5abd1ad
Merge pull request #90 from scouter-project/issue88
bill23-kim Jan 4, 2016
264546c
profiletext refactoring
bill23-kim Jan 4, 2016
a4b02f8
minor version up
bill23-kim Jan 4, 2016
b7eaa07
Merge pull request #91 from scouter-project/dev
bill23-kim Jan 4, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified build_client.sh
100755 → 100644
Empty file.
Empty file modified build_package.sh
100755 → 100644
Empty file.
Empty file modified scouter.agent.host/scripts/readlink.sh
100755 → 100644
Empty file.
Empty file modified scouter.agent.host/scripts/sample2.host.sh
100755 → 100644
Empty file.
Empty file modified scouter.agent.host/scripts/sample2.stop.sh
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions scouter.agent.java/src/scouter/agent/AgentTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public byte[] transform(ClassLoader loader, String className, Class classBeingRe
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classDesc.set(version, access, name, signature, superName, interfaces);
super.visit(version, access, name, signature, superName, interfaces);
}

@Override
Expand Down
29 changes: 8 additions & 21 deletions scouter.agent.java/src/scouter/agent/Configure.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@
*/
package scouter.agent;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import scouter.Version;
import scouter.agent.netio.data.DataProxy;
import scouter.lang.conf.ConfObserver;
Expand All @@ -35,16 +24,10 @@
import scouter.lang.value.ListValue;
import scouter.lang.value.MapValue;
import scouter.net.NetConstants;
import scouter.util.DateUtil;
import scouter.util.FileUtil;
import scouter.util.HashUtil;
import scouter.util.StringEnumer;
import scouter.util.StringKeyLinkedMap;
import scouter.util.StringSet;
import scouter.util.StringUtil;
import scouter.util.SysJMX;
import scouter.util.SystemUtil;
import scouter.util.ThreadUtil;
import scouter.util.*;

import java.io.*;
import java.util.*;
public class Configure extends Thread {
public static boolean JDBC_REDEFINED = false;
private static Configure instance = null;
Expand Down Expand Up @@ -162,6 +145,8 @@ public final static synchronized Configure getInstance() {
public String log_dir ="";
public boolean log_rotation_enabled =true;
public int log_keep_days =7;
public boolean _log_trace_enabled = false;
public boolean _log_trace_use_logger = false;

//Hook
public String hook_args_patterns = "";
Expand Down Expand Up @@ -490,6 +475,8 @@ private void apply() {
this.log_dir = getValue("log_dir", "");
this.log_rotation_enabled = getBoolean("log_rotation_enabled", true);
this.log_keep_days = getInt("log_keep_days", 7);
this._log_trace_enabled = getBoolean("_log_trace_enabled", false);
this._log_trace_use_logger = getBoolean("_log_trace_use_logger", false);

this.enduser_trace_endpoint_url = getValue("enduser_trace_endpoint_url", "_scouter_browser.jsp");
this.enduser_perf_endpoint_hash = HashUtil.hash(this.enduser_trace_endpoint_url);
Expand Down
46 changes: 23 additions & 23 deletions scouter.agent.java/src/scouter/agent/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,16 @@
*/
package scouter.agent;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;

import scouter.util.CompareUtil;
import scouter.util.DateUtil;
import scouter.util.FileUtil;
import scouter.util.IClose;
import scouter.util.StringLongLinkedMap;
import scouter.util.StringUtil;
import scouter.util.ThreadUtil;
import scouter.util.*;

import java.io.*;

public class Logger {

private static StringLongLinkedMap lastLog = new StringLongLinkedMap().setMax(1000);
static Configure conf = Configure.getInstance();

public static void println(Object message) {
public static void println(Object message) {
println(build("SCOUTER", toString(message)), true);
}

Expand All @@ -45,6 +36,24 @@ public static void println(String id, Object message) {
println(build(id, toString(message)), true);
}

public static void println(String id, String message, Throwable t) {
if (checkOk(id, 10) == false) {
return;
}
println(build(id, message), true);
println(ThreadUtil.getStackTrace(t), true);
}

public static void trace(Object message) {
if(conf._log_trace_enabled) {
if(conf._log_trace_use_logger) {
println(build("SCOUTER-TRC", toString(message)), true);
} else {
System.out.println(build("SCOUTER-TRC", toString(message)));
}
}
}

private static String toString(Object message) {
return message == null ? "null" : message.toString();
}
Expand All @@ -55,14 +64,6 @@ private static String build(String id, String message) {
.append(message).toString();
}

public static void println(String id, String message, Throwable t) {
if (checkOk(id, 10) == false) {
return;
}
println(build(id, message), true);
println(ThreadUtil.getStackTrace(t), true);
}

public static String getCallStack(Throwable t) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
Expand Down Expand Up @@ -133,7 +134,6 @@ private static synchronized void openFile(String prefix) throws IOException {
}
}

static Configure conf = Configure.getInstance();
static Runnable initializer = new Runnable() {
long last = System.currentTimeMillis();
long lastDataUnit = DateUtil.getDateUnit();
Expand Down
13 changes: 5 additions & 8 deletions scouter.agent.java/src/scouter/agent/asm/JDBCDriverASM.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@
* limitations under the License.
*/
package scouter.agent.asm;
import java.util.Map;
import scouter.agent.ClassDesc;
import scouter.agent.Configure;
import scouter.agent.Logger;
import scouter.agent.asm.util.AsmUtil;
import scouter.agent.asm.util.HookingSet;
import scouter.agent.trace.TraceSQL;
import scouter.org.objectweb.asm.ClassVisitor;
import scouter.org.objectweb.asm.Label;
import scouter.org.objectweb.asm.MethodVisitor;
import scouter.org.objectweb.asm.Opcodes;
import scouter.org.objectweb.asm.Type;
import scouter.org.objectweb.asm.*;
import scouter.org.objectweb.asm.commons.LocalVariablesSorter;

import java.util.Map;
public class JDBCDriverASM implements IASM, Opcodes {
//user can define driver.connect()
private Map<String, HookingSet> reserved =HookingSet.getHookingSet(Configure.getInstance().hook_jdbc_wrapping_driver_patterns);
Expand All @@ -43,7 +40,7 @@ public ClassVisitor transform(ClassVisitor cv, String className, ClassDesc class
if (mset != null){
return new JDBCDriverCV(cv, mset, className);
}

return cv;
}
}
Expand All @@ -64,7 +61,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
if (AsmUtil.isSpecial(name)) {
return mv;
}
String fullname = AsmUtil.add(className, name, desc);
String fullname = AsmUtil.makeMethodFullName(className, name, desc);

Logger.println("A105", "jdbc db2 driver loaded: " + fullname);
return new JDBCDriverMV(access, desc, mv, fullname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,19 @@
* limitations under the License.
*/
package scouter.agent.asm;
import java.util.HashSet;
import scouter.agent.ClassDesc;
import scouter.agent.Configure;
import scouter.agent.Logger;
import scouter.agent.asm.jdbc.PsClearParametersMV;
import scouter.agent.asm.jdbc.PsExecuteMV;
import scouter.agent.asm.jdbc.PsInitMV;
import scouter.agent.asm.jdbc.PsSetMV;
import scouter.agent.asm.jdbc.StExecuteMV;
import scouter.agent.asm.jdbc.*;
import scouter.agent.asm.util.HookingSet;
import scouter.agent.trace.SqlParameter;
import scouter.agent.trace.TraceSQL;
import scouter.org.objectweb.asm.ClassVisitor;
import scouter.org.objectweb.asm.MethodVisitor;
import scouter.org.objectweb.asm.Opcodes;
import scouter.org.objectweb.asm.Type;

import java.util.HashSet;
public class JDBCPreparedStatementASM implements IASM, Opcodes {
public final HashSet<String> target = HookingSet.getHookingClassSet(Configure.getInstance().hook_jdbc_pstmt_classes);
public final HashSet<String> noField = new HashSet<String>();
Expand Down Expand Up @@ -85,6 +82,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
if ("<init>".equals(name)) {
return new PsInitMV(access, desc, mv, owner);

} else {
String targetDesc = PsSetMV.getSetSignature(name);
if (targetDesc != null) {
Expand All @@ -93,13 +91,16 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
}
} else if (PsExecuteMV.isTarget(name)) {
if (desc.startsWith("()")) {
return new PsExecuteMV(access, desc, mv, owner);
return new PsExecuteMV(access, desc, mv, owner, name);
} else if (desc.startsWith("(Ljava/lang/String;)")) {
return new StExecuteMV(access, desc, mv, owner);
return new StExecuteMV(access, desc, mv, owner, name);
}
} else if ("clearParameters".equals(name) && "()V".equals(desc)) {
return new PsClearParametersMV(access, desc, mv, owner);
}

} else if ("getUpdateCount".equals(name) && "()I".equals(desc)) {
return new PsUpdateCountMV(mv);
}
}
return mv;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
* limitations under the License.
*/
package scouter.agent.asm;
import java.util.HashSet;
import scouter.agent.ClassDesc;
import scouter.agent.Configure;
import scouter.agent.Logger;
import scouter.agent.asm.jdbc.PsUpdateCountMV;
import scouter.agent.asm.jdbc.StExecuteMV;
import scouter.agent.asm.util.HookingSet;
import scouter.org.objectweb.asm.ClassVisitor;
import scouter.org.objectweb.asm.MethodVisitor;
import scouter.org.objectweb.asm.Opcodes;

import java.util.HashSet;
public class JDBCStatementASM implements IASM, Opcodes {
public final HashSet<String> target = HookingSet.getHookingClassSet(Configure.getInstance().hook_jdbc_stmt_classes);
public JDBCStatementASM() {
Expand Down Expand Up @@ -65,8 +67,10 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
if (StExecuteMV.isTarget(name)) {
if (desc.startsWith("(Ljava/lang/String;)")) {
return new StExecuteMV(access, desc, mv, owner);
return new StExecuteMV(access, desc, mv, owner, name);
}
} else if ("getUpdateCount".equals(name) && "()I".equals(desc)) {
return new PsUpdateCountMV(mv);
}
return mv;
}
Expand Down
12 changes: 4 additions & 8 deletions scouter.agent.java/src/scouter/agent/asm/MethodASM.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@

package scouter.agent.asm;

import java.util.List;

import scouter.agent.ClassDesc;
import scouter.agent.Configure;
import scouter.agent.asm.util.AsmUtil;
import scouter.agent.asm.util.HookingSet;
import scouter.agent.netio.data.DataProxy;
import scouter.agent.trace.TraceMain;
import scouter.org.objectweb.asm.ClassVisitor;
import scouter.org.objectweb.asm.Label;
import scouter.org.objectweb.asm.MethodVisitor;
import scouter.org.objectweb.asm.Opcodes;
import scouter.org.objectweb.asm.Type;
import scouter.org.objectweb.asm.*;
import scouter.org.objectweb.asm.commons.LocalVariablesSorter;

import java.util.List;

public class MethodASM implements IASM, Opcodes {

private List<HookingSet> target = HookingSet.getHookingMethodSet(Configure.getInstance().hook_method_patterns);
Expand Down Expand Up @@ -106,7 +102,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
if (conf.isIgnoreMethodPrefix(name))
return mv;

String fullname = AsmUtil.add(className, name, desc);
String fullname = AsmUtil.makeMethodFullName(className, name, desc);
int fullname_hash = DataProxy.sendMethodName(fullname);

return new MethodMV(access, desc, mv, fullname, fullname_hash);
Expand Down
30 changes: 21 additions & 9 deletions scouter.agent.java/src/scouter/agent/asm/ServiceASM.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@

package scouter.agent.asm;

import java.util.List;

import scouter.agent.ClassDesc;
import scouter.agent.Configure;
import scouter.agent.asm.util.AsmUtil;
import scouter.agent.asm.util.HookingSet;
import scouter.agent.trace.TraceMain;
import scouter.lang.pack.XLogTypes;
import scouter.org.objectweb.asm.ClassVisitor;
import scouter.org.objectweb.asm.Label;
import scouter.org.objectweb.asm.MethodVisitor;
import scouter.org.objectweb.asm.Opcodes;
import scouter.org.objectweb.asm.Type;
import scouter.org.objectweb.asm.*;
import scouter.org.objectweb.asm.commons.LocalVariablesSorter;

import java.util.List;

public class ServiceASM implements IASM, Opcodes {
private List<HookingSet> target = HookingSet.getHookingMethodSet(Configure.getInstance().hook_service_patterns);

Expand Down Expand Up @@ -67,8 +63,24 @@ public ServiceCV(ClassVisitor cv, HookingSet mset, String className,byte xType)
this.xType=xType;
}

@Override
/**
* @param access the method's access flags (see {@link Opcodes}). This
* parameter also indicates if the method is synthetic and/or
* deprecated.
* @param name the method's name.
* @param desc the method's descriptor (see {@link Type Type}). (ex) (Ljava/lang/String;)Lorg/mybatis/jpetstore/domain/Category;
* @param signature the method's signature. May be <tt>null</tt> if the method
* parameters, return type and exceptions do not use generic
* types.
* @param exceptions the internal names of the method's exception classes (see
* {@link Type#getInternalName() getInternalName}). May be
* <tt>null</tt>.
* @return
*/
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
//System.out.println("access = [" + access + "], name = [" + name + "], desc = [" + desc + "], signature = [" + signature + "], exceptions = [" + exceptions + "]");

MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
if (mv == null || mset.isA(name, desc) == false) {
return mv;
Expand All @@ -77,7 +89,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
return mv;
}

String fullname = AsmUtil.add(className, name, desc);
String fullname = AsmUtil.makeMethodFullName(className, name, desc);
return new ServiceMV(access, desc, mv, fullname,Type.getArgumentTypes(desc),(access & ACC_STATIC) != 0,xType,className,
name, desc);
}
Expand Down
Loading