Skip to content

Commit

Permalink
Merge pull request #358 from scouter-project/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
gunlee01 authored Aug 19, 2017
2 parents efa03c4 + ab93abf commit 3317830
Show file tree
Hide file tree
Showing 52 changed files with 1,873 additions and 583 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@
*/
package scouter.agent.batch;

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

import scouter.agent.util.JarUtil;
import scouter.lang.conf.ConfigDesc;
import scouter.lang.conf.ConfigValueType;
import scouter.lang.conf.ConfigValueUtil;
import scouter.lang.conf.ValueType;
import scouter.lang.counters.CounterConstants;
import scouter.lang.value.ListValue;
import scouter.lang.value.MapValue;
Expand All @@ -43,6 +34,17 @@
import scouter.util.SysJMX;
import scouter.util.SystemUtil;

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

public class Configure {
public static final String CONFIG_SCOUTER_ENABLED = "scouter_enabled";
public static final String VM_SCOUTER_ENABLED = "scouter.enabled";
Expand Down Expand Up @@ -89,10 +91,13 @@ public final static synchronized Configure getInstance() {
@ConfigDesc("SQL max count")
public int sql_max_count = 100;
@ConfigDesc("Method set for preparestatement hooking")
@ConfigValueType(ValueType.COMMA_SEPARATED_VALUE)
public String hook_jdbc_pstmt_classes = "";
@ConfigDesc("Method set for statement hooking")
@ConfigDesc("Method set for statement hooking")
@ConfigValueType(ValueType.COMMA_SEPARATED_VALUE)
public String hook_jdbc_stmt_classes = "";
@ConfigDesc("Method set for resultset hooking")
@ConfigDesc("Method set for resultset hooking")
@ConfigValueType(ValueType.COMMA_SEPARATED_VALUE)
public String hook_jdbc_rs_classes = "";

// SFA(Stack Frequency Analyzer) Thread Dump
Expand Down Expand Up @@ -506,7 +511,11 @@ public MapValue getKeyValueInfo() {

public StringKeyLinkedMap<String> getConfigureDesc() {
return ConfigValueUtil.getConfigDescMap(this);
}
}

public StringKeyLinkedMap<ValueType> getConfigureValueType() {
return ConfigValueUtil.getConfigValueTypeMap(this);
}

private static HashSet<String> ignoreSet = new HashSet<String>();
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@

package scouter.agent.batch.netio.request.handle;

import java.lang.instrument.ClassDefinition;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;

import scouter.agent.batch.Configure;
import scouter.agent.batch.JavaAgent;
import scouter.agent.netio.request.anotation.RequestHandler;
import scouter.lang.conf.ValueType;
import scouter.lang.pack.MapPack;
import scouter.lang.pack.Pack;
import scouter.lang.value.BooleanValue;
Expand All @@ -35,6 +31,11 @@
import scouter.util.StringKeyLinkedMap;
import scouter.util.StringKeyLinkedMap.StringKeyLinkedEntry;

import java.lang.instrument.ClassDefinition;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;

public class AgentConfigure {

@RequestHandler(RequestCmd.GET_CONFIGURE_WAS)
Expand Down Expand Up @@ -129,4 +130,16 @@ public Pack getConfigureDesc(Pack param) {
}
return pack;
}
}

@RequestHandler(RequestCmd.CONFIGURE_VALUE_TYPE)
public Pack getConfigureValueType(Pack param) {
StringKeyLinkedMap<ValueType> valueTypeMap = Configure.getInstance().getConfigureValueType();
MapPack pack = new MapPack();
Enumeration<StringKeyLinkedEntry<ValueType>> entries = valueTypeMap.entries();
while (entries.hasMoreElements()) {
StringKeyLinkedEntry<ValueType> entry = entries.nextElement();
pack.put(entry.getKey(), entry.getValue().getType());
}
return pack;
}
}
26 changes: 23 additions & 3 deletions scouter.agent.host/src/main/java/scouter/agent/Configure.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,29 @@
import scouter.agent.netio.data.DataProxy;
import scouter.lang.conf.ConfObserver;
import scouter.lang.conf.ConfigDesc;
import scouter.lang.conf.ConfigValueType;
import scouter.lang.conf.ConfigValueUtil;
import scouter.lang.conf.ValueType;
import scouter.lang.counters.CounterConstants;
import scouter.lang.value.ListValue;
import scouter.lang.value.MapValue;
import scouter.net.NetConstants;
import scouter.util.*;

import java.io.*;
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 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;
Expand Down Expand Up @@ -79,6 +94,7 @@ public final static synchronized Configure getInstance() {

//Manager
@ConfigDesc("")
@ConfigValueType(ValueType.COMMA_SEPARATED_VALUE)
public StringSet mgr_log_ignore_ids = new StringSet();

//Counter
Expand Down Expand Up @@ -423,6 +439,10 @@ public StringKeyLinkedMap<String> getConfigureDesc() {
return ConfigValueUtil.getConfigDescMap(this);
}

public StringKeyLinkedMap<ValueType> getConfigureValueType() {
return ConfigValueUtil.getConfigValueTypeMap(this);
}

public static void main(String[] args) {
Configure o = new Configure(true);
StringKeyLinkedMap<Object> defMap = ConfigValueUtil.getConfigDefault(o);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@

package scouter.agent.netio.request.handle;

import java.util.Enumeration;

import scouter.agent.Configure;
import scouter.agent.netio.request.anotation.RequestHandler;
import scouter.lang.conf.ValueType;
import scouter.lang.pack.MapPack;
import scouter.lang.pack.Pack;
import scouter.lang.value.MapValue;
import scouter.net.RequestCmd;
import scouter.util.StringKeyLinkedMap;
import scouter.util.StringKeyLinkedMap.StringKeyLinkedEntry;

import java.util.Enumeration;

public class HostAgentConfigure {

@RequestHandler(RequestCmd.GET_CONFIGURE_WAS)
Expand Down Expand Up @@ -79,4 +80,16 @@ public Pack getConfigureDesc(Pack param) {
}
return pack;
}
}

@RequestHandler(RequestCmd.CONFIGURE_VALUE_TYPE)
public Pack getConfigureValueType(Pack param) {
StringKeyLinkedMap<ValueType> valueTypeMap = Configure.getInstance().getConfigureValueType();
MapPack pack = new MapPack();
Enumeration<StringKeyLinkedEntry<ValueType>> entries = valueTypeMap.entries();
while (entries.hasMoreElements()) {
StringKeyLinkedEntry<ValueType> entry = entries.nextElement();
pack.put(entry.getKey(), entry.getValue().getType());
}
return pack;
}
}
Loading

0 comments on commit 3317830

Please sign in to comment.