Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
03fc96e
process cpu use avg value
bill23-kim May 16, 2016
65467ed
add option cpu value avg sec
bill23-kim May 16, 2016
d6fd65c
change tomcat ds name rule
bill23-kim May 16, 2016
ab00fd6
alert delayed service
bill23-kim May 16, 2016
867b760
bug fix
bill23-kim May 16, 2016
fa72b4e
change log interval
bill23-kim May 16, 2016
42b0d9b
change resend alert interval
bill23-kim May 17, 2016
e4598c3
translation - by holdenkim - manunally merged
gunlee01 May 18, 2016
c8b05f5
add net disk io description
bill23-kim May 19, 2016
5bcfa4a
change sys/user display name
bill23-kim May 19, 2016
2467d8d
base dir . -> agent dir
bill23-kim May 19, 2016
d9aaf94
ldap option add
May 19, 2016
89520d5
division for password encrypt
May 20, 2016
5c9f712
Merge pull request #174 from 23king/dev
bill23-kim May 20, 2016
d7bf0a2
Create scouter-batch.mf
KwonMunsoo May 20, 2016
5d67e54
Create build-agent.batch.xml
KwonMunsoo May 20, 2016
b9480db
배치생성
KwonMunsoo May 20, 2016
bf16b6e
make configure
KwonMunsoo May 20, 2016
a5a1059
read batch id
KwonMunsoo May 20, 2016
846be05
start and end
KwonMunsoo May 20, 2016
4b54b9a
control trace(scouter_enabled)
KwonMunsoo May 20, 2016
b4e50cd
add sql structure
KwonMunsoo May 21, 2016
525b8ec
add agent.batch
KwonMunsoo May 21, 2016
33bcb6f
develop
KwonMunsoo May 21, 2016
e703180
continue...
KwonMunsoo May 22, 2016
0d3be2e
add util
bill23-kim May 23, 2016
884828c
bug fix - client reconnection
bill23-kim May 23, 2016
11b102f
bug fix
bill23-kim May 24, 2016
3a1c891
add sha256 hash
gunlee01 May 25, 2016
fa13f09
bug fix
bill23-kim May 26, 2016
6b15d0f
bug fix - for dst
bill23-kim May 27, 2016
432b9df
create stack dump file
KwonMunsoo May 28, 2016
77b7b85
remove a test program
KwonMunsoo May 29, 2016
94e0cb6
asm preparedstatement
KwonMunsoo May 29, 2016
8f4c83e
.
KwonMunsoo May 29, 2016
c44824b
bug fix - typo
bill23-kim May 30, 2016
509308f
add properties
bill23-kim May 30, 2016
36eb329
check session key at first connection
bill23-kim May 30, 2016
0c90fb2
add free cmd
bill23-kim May 30, 2016
38def2f
bug fix
bill23-kim May 30, 2016
1a90c64
Tycho Maven Plugin Version Upgrade.
kukgini May 31, 2016
3b084c3
Merge pull request #181 from kukgini/dev
bill23-kim May 31, 2016
a6937e1
add opal project
bill23-kim May 31, 2016
7bd4942
change expression whether hash or not
bill23-kim May 31, 2016
e7818e9
bug fix
bill23-kim May 31, 2016
26d1158
sql popup
bill23-kim May 31, 2016
258c409
loose xlog bug fix when service error full stack enabled
gunlee01 Jun 1, 2016
e5e7160
handle invalid session key
bill23-kim Jun 2, 2016
e8cff20
close conn
bill23-kim Jun 2, 2016
c73a0d8
Merge branch 'dev' of github.com:scouter-project/scouter into dev
gunlee01 Jun 2, 2016
6b39dbb
SQL execution time(nanoTime), Statement ASM Hooking
KwonMunsoo Jun 2, 2016
df35b5d
Merge branch 'dev' of https://github.com/scouter-project/scouter into…
KwonMunsoo Jun 2, 2016
090a819
bug fix
bill23-kim Jun 3, 2016
0962b85
asm hooking resultset
KwonMunsoo Jun 3, 2016
79be6c3
bug fix
KwonMunsoo Jun 3, 2016
cc3d515
asm update count (partly)
KwonMunsoo Jun 3, 2016
35e7dd4
modify processed rows
KwonMunsoo Jun 4, 2016
97bcedf
^^
KwonMunsoo Jun 4, 2016
af3ba8d
arrange configuration
KwonMunsoo Jun 4, 2016
56fc20b
keep a last stack
KwonMunsoo Jun 5, 2016
a26a1a3
add standalone mode to run alone without scouter server
KwonMunsoo Jun 5, 2016
2fd95c4
no message
KwonMunsoo Jun 6, 2016
aee161e
typo
bill23-kim Jun 6, 2016
9bbc2d8
Merge branch 'dev' of https://github.com/scouter-project/scouter into…
bill23-kim Jun 6, 2016
d59bbc9
profile throwable class name
bill23-kim Jun 8, 2016
5d4ff84
engineer option - sql parameter max count
bill23-kim Jun 9, 2016
6f06ca2
bug fix
bill23-kim Jun 9, 2016
c3f2b2a
bug fix
bill23-kim Jun 10, 2016
1944128
Merge pull request #183 from scouter-project/dev
bill23-kim Jun 12, 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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
scouter.agent.batch/bin/*
scouter.agent.java/bin/*
scouter.client/bin/*
scouter.common/bin/*
Expand Down Expand Up @@ -98,3 +99,7 @@ dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

scouter.client.build/.settings/org.eclipse.core.resources.prefs
scouter.common/.settings/org.eclipse.core.resources.prefs
scouter.agent.host/.settings/org.eclipse.core.resources.prefs
scouter.agent.batch/.settings/org.eclipse.core.resources.prefs
4 changes: 2 additions & 2 deletions README_kr.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![scouter](./scouter.document/img/main/scouter-logo-w200.png)
![scouter](./scouter.document/img/main/scouter-logo-w200.png)

[![Englsh](https://img.shields.io/badge/language-English-red.svg)](README.md) ![Korean](https://img.shields.io/badge/language-Korean-blue.svg)

Expand Down Expand Up @@ -53,7 +53,7 @@ APM은 Application performance montoring 또는 application performance manageme
<br>

- **Server (Collector)** : Agent가 전송한 데이터를 저장하고 Client 요청시 Client에게 적절한 데이터를 전송
- **Scala** : Written in Scala. It will provide a variety of features and performance scalability that can not be written in Java.
- **Scala** : Scala를 사용하여 개발하였음으로, 자바 코딩으로는 제공하기 어려운 성능 확장성 및 여러가지 기능들을 제공 할수 있음.
- **HASH FILE** : 고속의 자체 개발한 Hash 인덱스 방식의 파일 Repository 사용으로 최상의 속도를 동작하며 추가적인 DB 및 라이브러리의 설치가 불필요하여 압축 해제만으로 쉽게 설치 가능.
- **GZIP** : 압축 옵션을 통해 저장 공간을 절약하도록 개발됨.
<br>
Expand Down
8 changes: 8 additions & 0 deletions scouter.agent.batch/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry combineaccessrules="false" kind="src" path="/scouter.common"/>
<classpathentry combineaccessrules="false" kind="src" path="/scouter.agent.java"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions scouter.agent.batch/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>scouter.agent.batch</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions scouter.agent.batch/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
144 changes: 144 additions & 0 deletions scouter.agent.batch/src/scouter/agent/batch/AgentTransformer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* Copyright 2016 the original author or authors.
* @https://github.com/scouter-project/scouter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package scouter.agent.batch;

import scouter.agent.batch.asm.JDBCPreparedStatementASM;
import scouter.agent.batch.asm.JDBCStatementASM;
import scouter.agent.batch.asm.JDBCResultSetASM;

import scouter.agent.asm.ScouterClassWriter;
import scouter.agent.asm.IASM;
import scouter.agent.ClassDesc;
import scouter.agent.ObjTypeDetector;
import scouter.agent.asm.util.AsmUtil;
import scouter.org.objectweb.asm.*;
import scouter.util.FileUtil;

import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.List;

public class AgentTransformer implements ClassFileTransformer {
private static List<String> filters = new ArrayList<String>();
private static List<IASM> asms = new ArrayList<IASM>();
// hook 관련 설정이 변경되면 자동으로 변경된다.

static {
asms.add(new JDBCPreparedStatementASM());
asms.add(new JDBCStatementASM());
asms.add(new JDBCResultSetASM());

filters.add("Statement");
filters.add("ResultSet");
}

private Configure conf = Configure.getInstance();
private Logger.FileLog bciOut;

public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined,
ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
try {
if(!conf.sql_enabled || className == null){
return null;
}

if (className.startsWith("scouter/") || !filter(className)) {
return null;
}

//classfileBuffer = DirectPatch.patch(className, classfileBuffer);
ObjTypeDetector.check(className);
final ClassDesc classDesc = new ClassDesc();
ClassReader cr = new ClassReader(classfileBuffer);
cr.accept(new ClassVisitor(Opcodes.ASM4) {
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
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
classDesc.anotation += desc;
return super.visitAnnotation(desc, visible);
}
}, 0);
if (AsmUtil.isInterface(classDesc.access)) {
return null;
}
classDesc.classBeingRedefined = classBeingRedefined;
ClassWriter cw = getClassWriter(classDesc);
ClassVisitor cv = cw;
List<IASM> workAsms = asms;
for (int i = 0, max = workAsms.size(); i < max; i++) {
cv = workAsms.get(i).transform(cv, className, classDesc);
if (cv != cw) {
cr = new ClassReader(classfileBuffer);
cr.accept(cv, ClassReader.EXPAND_FRAMES);
classfileBuffer = cw.toByteArray();
cv = cw = getClassWriter(classDesc);
if (conf._log_asm_enabled) {
if (this.bciOut == null) {
this.bciOut = new Logger.FileLog("./scouter.bci");
}
this.bciOut.println(className + "\t\t[" + loader + "]");
dump(className, classfileBuffer);
}
}
}
return classfileBuffer;
} catch (Throwable t) {
Logger.println("A101", "Transformer Error", t);
t.printStackTrace();
}
return null;
}

private ClassWriter getClassWriter(final ClassDesc classDesc) {
ClassWriter cw;
switch (classDesc.version) {
case Opcodes.V1_1:
case Opcodes.V1_2:
case Opcodes.V1_3:
case Opcodes.V1_4:
case Opcodes.V1_5:
case Opcodes.V1_6:
cw = new ScouterClassWriter(ClassWriter.COMPUTE_MAXS);
break;
default:
cw = new ScouterClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
}
return cw;
}

private boolean filter(String className){
for(String name: filters){
if(className.indexOf(name) >= 0){
return true;
}
}
return false;
}

private void dump(String className, byte[] bytes) {
String fname = "./dump/" + className.replace('/', '_') + ".class";
FileUtil.save(fname, bytes);
}
}
80 changes: 80 additions & 0 deletions scouter.agent.batch/src/scouter/agent/batch/BatchMonitor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright 2016 Scouter Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package scouter.agent.batch;

import java.io.File;
import java.io.FileWriter;

import scouter.agent.batch.dump.ThreadDumpHandler;
import scouter.agent.batch.trace.TraceContext;
import scouter.util.ThreadUtil;

public class BatchMonitor extends Thread {
private static BatchMonitor instance = null;
public Configure config = null;

static public BatchMonitor getInstance(){
if(instance == null){
instance = new BatchMonitor();
instance.setDaemon(true);
instance.setName(ThreadUtil.getName(instance));

TraceContext.getInstance();
Runtime.getRuntime().addShutdownHook(new ResultSender());
instance.start();
}
return instance;
}

public void run() {
FileWriter stackWriter = null;
FileWriter indexWriter = null;
try {
File stackFile = null;
config = Configure.getInstance();
TraceContext traceContext = TraceContext.getInstance();
if(config.sfa_dump_enabled){
File indexFile = null;

stackFile = new File(traceContext.getLogFilename() + ".log");
if(stackFile.exists()){
stackFile = null;
}else{
traceContext.stackLogFile = stackFile.getAbsolutePath();

stackWriter = new FileWriter(stackFile);
indexWriter = new FileWriter(new File(traceContext.getLogFilename() + ".inx"));
}
}
if(stackWriter != null){
while(!config.scouter_stop){
ThreadDumpHandler.processDump(stackFile, stackWriter, indexWriter, config.sfa_dump_filter, config.sfa_dump_header_exists);
traceContext.checkThread();
Thread.sleep(config.sfa_dump_interval_ms);
}
}
}catch(Throwable ex){
Logger.println("ERROR: " + ex.getMessage());
}finally{
if(stackWriter != null){
try{ stackWriter.close(); }catch(Exception ex){}
}
if(indexWriter != null){
try{ indexWriter.close(); }catch(Exception ex){}
}
}
}
}
Loading