Skip to content

Commit f570239

Browse files
committed
Merge pull request #98 from scouter-project/dev
Dev
2 parents d7b7a14 + 41cd901 commit f570239

File tree

24 files changed

+120
-195
lines changed

24 files changed

+120
-195
lines changed

scouter.agent.java/src/scouter/agent/AgentTransformer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
148148
cr.accept(cv, ClassReader.EXPAND_FRAMES);
149149
classfileBuffer = cw.toByteArray();
150150
cv = cw = getClassWriter(classDesc);
151-
if (conf.log_asm_enabled) {
151+
if (conf._log_asm_enabled) {
152152
if (this.bciOut == null) {
153153
this.bciOut = new Logger.FileLog("./scouter.bci");
154154
}

scouter.agent.java/src/scouter/agent/Configure.java

Lines changed: 61 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@
1616
*/
1717
package scouter.agent;
1818

19+
import java.io.File;
20+
import java.io.FileInputStream;
21+
import java.io.FileOutputStream;
22+
import java.io.InputStream;
23+
import java.io.OutputStream;
24+
import java.util.HashMap;
25+
import java.util.HashSet;
26+
import java.util.Map;
27+
import java.util.Properties;
28+
import java.util.Set;
29+
1930
import scouter.Version;
2031
import scouter.agent.netio.data.DataProxy;
2132
import scouter.lang.conf.ConfObserver;
@@ -24,10 +35,16 @@
2435
import scouter.lang.value.ListValue;
2536
import scouter.lang.value.MapValue;
2637
import scouter.net.NetConstants;
27-
import scouter.util.*;
28-
29-
import java.io.*;
30-
import java.util.*;
38+
import scouter.util.DateUtil;
39+
import scouter.util.FileUtil;
40+
import scouter.util.HashUtil;
41+
import scouter.util.StringEnumer;
42+
import scouter.util.StringKeyLinkedMap;
43+
import scouter.util.StringSet;
44+
import scouter.util.StringUtil;
45+
import scouter.util.SysJMX;
46+
import scouter.util.SystemUtil;
47+
import scouter.util.ThreadUtil;
3148
public class Configure extends Thread {
3249
public static boolean JDBC_REDEFINED = false;
3350
private static Configure instance = null;
@@ -51,14 +68,13 @@ public final static synchronized Configure getInstance() {
5168
public int net_collector_tcp_so_timeout_ms = 60000;
5269
public int net_collector_tcp_connection_timeout_ms = 3000;
5370
public int net_udp_packet_max_bytes = 60000;
54-
public long udp_udp_collection_interval_ms = 100;
71+
public long net_udp_collection_interval_ms = 100;
5572

5673
//Object
5774
public String obj_type = "";
5875
public String obj_name = "";
5976
public String obj_host_type = "";
6077
public String obj_host_name = "";
61-
public boolean obj_host_enabled = false;
6278
public boolean obj_name_auto_pid_enabled = false;
6379
public boolean obj_type_inherit_to_child_enabled = false;
6480

@@ -96,10 +112,10 @@ public final static synchronized Configure getInstance() {
96112
public long trace_activeservice_red_time = 8000;
97113
public String trace_http_client_ip_header_key = "";
98114
public boolean trace_interservice_enabled = false;
99-
public String trace_interservice_gxid_header_key = "X-Scouter-Gxid";
115+
public String _trace_interservice_gxid_header_key = "X-Scouter-Gxid";
100116
public boolean trace_response_gxid_enabled = false;
101-
public String trace_interservice_callee_header_key = "X-Scouter-Callee";
102-
public String trace_interservice_caller_header_key = "X-Scouter-Caller";
117+
public String _trace_interservice_callee_header_key = "X-Scouter-Callee";
118+
public String _trace_interservice_caller_header_key = "X-Scouter-Caller";
103119
public String trace_user_session_key = "JSESSIONID";
104120
public boolean _trace_auto_service_enabled = false;
105121
public boolean _trace_auto_service_backstack_enabled = true;
@@ -111,7 +127,7 @@ public final static synchronized Configure getInstance() {
111127

112128
//Dir
113129
public File plugin_dir = new File("./plugin");
114-
public File dump_dir = new File(".");
130+
public File dump_dir = new File("./dump");
115131
//public File mgr_agent_lib_dir = new File("./_scouter_");
116132

117133
//Manager
@@ -134,14 +150,13 @@ public final static synchronized Configure getInstance() {
134150
public int alert_message_length = 3000;
135151
public long alert_send_interval_ms = 3000;
136152
public int alert_perm_warning_pct = 90;
137-
public long alert_perm_interval_ms = 30000;
138153

139154
//Log
140-
public boolean log_asm_enabled;
141-
public boolean log_udp_xlog_enabled;
142-
public boolean log_udp_object_enabled;
143-
public boolean log_datasource_lookup_enabled = true;
144-
public boolean log_background_sql = false;
155+
public boolean _log_asm_enabled;
156+
public boolean _log_udp_xlog_enabled;
157+
public boolean _log_udp_object_enabled;
158+
public boolean _log_datasource_lookup_enabled = true;
159+
public boolean _log_background_sql = false;
145160
public String log_dir ="";
146161
public boolean log_rotation_enabled =true;
147162
public int log_keep_days =7;
@@ -201,16 +216,16 @@ public final static synchronized Configure getInstance() {
201216

202217
//Summary
203218
public boolean summary_enabled = true;
204-
public boolean summary_connection_leak_fullstack_enabled = false;
205-
public int summary_service_max_count = 5000;
206-
public int summary_sql_max_count = 5000;
207-
public int summary_api_max_count = 5000;
208-
public int summary_ip_max_count = 5000;
209-
public int summary_useragent_max_count = 5000;
210-
public int summary_error_max_count = 500;
211-
public int summary_enduser_nav_max_count = 5000;
212-
public int summary_enduser_ajax_max_count = 5000;
213-
public int summary_enduser_error_max_count = 5000;
219+
public boolean _summary_connection_leak_fullstack_enabled = false;
220+
public int _summary_service_max_count = 5000;
221+
public int _summary_sql_max_count = 5000;
222+
public int _summary_api_max_count = 5000;
223+
public int _summary_ip_max_count = 5000;
224+
public int _summary_useragent_max_count = 5000;
225+
public int _summary_error_max_count = 500;
226+
public int _summary_enduser_nav_max_count = 5000;
227+
public int _summary_enduser_ajax_max_count = 5000;
228+
public int _summary_enduser_error_max_count = 5000;
214229

215230
//EndUser
216231
public String enduser_trace_endpoint_url = "/_scouter_browser.jsp";
@@ -306,7 +321,7 @@ private void apply() {
306321
this.trace_service_name_header_key = getValue("trace_service_name_header_key", null);
307322
this.trace_service_name_get_key = getValue("trace_service_name_get_key");
308323
this.trace_service_name_post_key = getValue("trace_service_name_post_key");
309-
this.dump_dir = new File(getValue("dump_dir", "."));
324+
this.dump_dir = new File(getValue("dump_dir", "./dump"));
310325
try {
311326
this.dump_dir.mkdirs();
312327
} catch (Exception e) {
@@ -341,8 +356,8 @@ private void apply() {
341356
this.trace_activeservice_red_time = getLong("trace_activeservice_red_time", 8000);
342357
this.mgr_log_ignore_ids = getValue("mgr_log_ignore_ids", "");
343358
this.log_ignore_set = getStringSet("mgr_log_ignore_ids", ",");
344-
this.log_udp_xlog_enabled = getBoolean("log_udp_xlog_enabled", false);
345-
this.log_udp_object_enabled = getBoolean("log_udp_object_enabled", false);
359+
this._log_udp_xlog_enabled = getBoolean("_log_udp_xlog_enabled", false);
360+
this._log_udp_object_enabled = getBoolean("_log_udp_object_enabled", false);
346361
this.net_local_udp_ip = getValue("net_local_udp_ip");
347362
this.net_local_udp_port = getInt("net_local_udp_port", 0);
348363
this.net_collector_ip = getValue("net_collector_ip", "127.0.0.1");
@@ -357,9 +372,9 @@ private void apply() {
357372
this.hook_constructor_patterns = getValue("hook_constructor_patterns", "");
358373
this.hook_connection_open_patterns = getValue("hook_connection_open_patterns", "");
359374

360-
this.log_datasource_lookup_enabled = getBoolean("log_datasource_lookup_enabled", true);
375+
this._log_datasource_lookup_enabled = getBoolean("_log_datasource_lookup_enabled", true);
361376
this.profile_connection_open_enabled = getBoolean("profile_connection_open_enabled", true);
362-
this.summary_connection_leak_fullstack_enabled = getBoolean("summary_connection_leak_fullstack_enabled", false);
377+
this._summary_connection_leak_fullstack_enabled = getBoolean("_summary_connection_leak_fullstack_enabled", false);
363378
this.hook_method_patterns = getValue("hook_method_patterns", "");
364379
this.hook_method_access_public_enabled = getBoolean("hook_method_access_public_enabled", true);
365380
this.hook_method_access_protected_enabled = getBoolean("hook_method_access_protected_enabled", false);
@@ -404,26 +419,25 @@ private void apply() {
404419
this.profile_step_max_count = getInt("profile_step_max_count", 1024);
405420
if (this.profile_step_max_count < 100)
406421
this.profile_step_max_count = 100;
407-
this.log_background_sql = getBoolean("log_background_sql", false);
422+
this._log_background_sql = getBoolean("_log_background_sql", false);
408423
this.profile_fullstack_service_error_enabled = getBoolean("profile_fullstack_service_error_enabled", false);
409424
this.profile_fullstack_apicall_error_enabled = getBoolean("profile_fullstack_apicall_error_enabled", false);
410425
this.profile_fullstack_sql_error_enabled = getBoolean("profile_fullstack_sql_error_enabled", false);
411426
this.profile_fullstack_sql_commit_enabled = getBoolean("profile_fullstack_sql_commit_enabled", false);
412427
this.profile_fullstack_max_lines = getInt("profile_fullstack_max_lines", 0);
413-
this.udp_udp_collection_interval_ms = getInt("udp_udp_collection_interval_ms", 100);
428+
this.net_udp_collection_interval_ms = getInt("net_udp_collection_interval_ms", 100);
414429
this.profile_http_parameter_url_prefix = getValue("profile_http_parameter_url_prefix", "/");
415430
this.profile_http_header_url_prefix = getValue("profile_http_header_url_prefix", "/");
416431
this.trace_http_client_ip_header_key = getValue("trace_http_client_ip_header_key", "");
417432
this.trace_interservice_enabled = getBoolean("trace_interservice_enabled", false);
418433
this.trace_response_gxid_enabled = getBoolean("trace_response_gxid_enabled", false);
419-
this.trace_interservice_gxid_header_key = getValue("trace_interservice_gxid_header_key", "X-Scouter-Gxid");
420-
this.trace_interservice_callee_header_key = getValue("trace_interservice_callee_header_key", "X-Scouter-Callee");
421-
this.trace_interservice_caller_header_key = getValue("trace_interservice_caller_header_key", "X-Scouter-Caller");
434+
this._trace_interservice_gxid_header_key = getValue("_trace_interservice_gxid_header_key", "X-Scouter-Gxid");
435+
this._trace_interservice_callee_header_key = getValue("_trace_interservice_callee_header_key", "X-Scouter-Callee");
436+
this._trace_interservice_caller_header_key = getValue("_trace_interservice_caller_header_key", "X-Scouter-Caller");
422437
this.profile_connection_open_fullstack_enabled = getBoolean("profile_connection_open_fullstack_enabled", false);
423438
this.profile_connection_autocommit_status_enabled = getBoolean("profile_connection_autocommit_status_enabled", false);
424439
this.trace_user_mode = getInt("trace_user_mode", 2);
425440
this.trace_user_session_key = getValue("trace_user_session_key", "JSESSIONID");
426-
this.obj_host_enabled = getBoolean("obj_host_enabled", false);
427441
this._trace_auto_service_enabled = getBoolean("_trace_auto_service_enabled", false);
428442
this._trace_auto_service_backstack_enabled = getBoolean("_trace_auto_service_backstack_enabled", true);
429443
this.counter_enabled = getBoolean("counter_enabled", true);
@@ -449,26 +463,25 @@ private void apply() {
449463
this.trace_webserver_time_header_key = getValue("trace_webserver_time_header_key", "X-Forwarded-Time");
450464
// SUMMARY최대 갯수를 관리한다.
451465
this.summary_enabled = getBoolean("summary_enabled", true);
452-
this.summary_sql_max_count = getInt("summary_sql_max_count", 5000);
453-
this.summary_api_max_count = getInt("summary_api_max_count", 5000);
454-
this.summary_service_max_count = getInt("summary_service_max_count", 5000);
455-
this.summary_ip_max_count = getInt("summary_ip_max_count", 5000);
456-
this.summary_useragent_max_count = getInt("summary_useragent_max_count", 5000);
457-
this.summary_error_max_count = getInt("summary_error_max_count", 500);
466+
this._summary_sql_max_count = getInt("_summary_sql_max_count", 5000);
467+
this._summary_api_max_count = getInt("_summary_api_max_count", 5000);
468+
this._summary_service_max_count = getInt("_summary_service_max_count", 5000);
469+
this._summary_ip_max_count = getInt("_summary_ip_max_count", 5000);
470+
this._summary_useragent_max_count = getInt("_summary_useragent_max_count", 5000);
471+
this._summary_error_max_count = getInt("_summary_error_max_count", 500);
458472

459-
this.summary_enduser_nav_max_count = getInt("summary_enduser_nav_max_count", 5000);
460-
this.summary_enduser_ajax_max_count = getInt("summary_enduser_ajax_max_count", 5000);
461-
this.summary_enduser_error_max_count = getInt("summary_enduser_error_max_count", 5000);
473+
this._summary_enduser_nav_max_count = getInt("_summary_enduser_nav_max_count", 5000);
474+
this._summary_enduser_ajax_max_count = getInt("_summary_enduser_ajax_max_count", 5000);
475+
this._summary_enduser_error_max_count = getInt("_summary_enduser_error_max_count", 5000);
462476

463477

464-
this.alert_perm_interval_ms = getLong("alert_perm_interval_ms", 30000);
465478
this.alert_perm_warning_pct = getInt("alert_perm_warning_pct", 90);
466479
this._hook_spring_rest_enabled = getBoolean("_hook_spring_rest_enabled", false);
467480
this.alert_message_length = getInt("alert_message_length", 3000);
468481
this.alert_send_interval_ms = getInt("alert_send_interval_ms", 3000);
469482
this.xlog_error_jdbc_fetch_max = getInt("xlog_error_jdbc_fetch_max", 10000);
470483
this.xlog_error_sql_time_max_ms = getInt("xlog_error_sql_time_max_ms", 30000);
471-
this.log_asm_enabled = getBoolean("log_asm_enabled", false);
484+
this._log_asm_enabled = getBoolean("_log_asm_enabled", false);
472485
this.obj_type_inherit_to_child_enabled = getBoolean("obj_type_inherit_to_child_enabled", false);
473486
this._profile_fullstack_sql_connection_enabled = getBoolean("_profile_fullstack_sql_connection_enabled", false);
474487
this._trace_fullstack_socket_open_port = getInt("_trace_fullstack_socket_open_port", 0);

scouter.agent.java/src/scouter/agent/counter/task/HostPerf.java

Lines changed: 0 additions & 72 deletions
This file was deleted.

scouter.agent.java/src/scouter/agent/counter/task/PermGen.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import scouter.agent.counter.CounterBasket;
2727
import scouter.agent.counter.anotation.Counter;
2828
import scouter.agent.counter.meter.MeterResource;
29-
import scouter.agent.netio.data.DataProxy;
29+
import scouter.agent.trace.AlertProxy;
3030
import scouter.lang.AlertLevel;
3131
import scouter.lang.TimeTypeEnum;
3232
import scouter.lang.counters.CounterConstants;
@@ -64,24 +64,18 @@ public void getPermGen(CounterBasket pw) {
6464
p.put(CounterConstants.JAVA_PERM_USED, new FloatValue(usedM));
6565
p.put(CounterConstants.JAVA_PERM_PERCENT, new FloatValue(usedM * 100 / max));
6666

67-
long now = System.currentTimeMillis();
6867
Configure conf = Configure.getInstance();
6968
float rate = used * 100 / usage.getMax();
7069

7170
// /////////////////////////////////////////////////
7271
// PermGen Warning
7372
if (rate >= conf.alert_perm_warning_pct) {
74-
if (now >= heap_perm_last_warning + conf.alert_perm_interval_ms) {
75-
DataProxy.sendAlert(AlertLevel.WARN, "WARNING_MEMORY_HIGH", "warning perm usage used="
76-
+ (used / 1024 / 1024) + "MB rate=" + rate + "%", null);
77-
heap_perm_last_warning = now;
78-
}
73+
AlertProxy.sendAlert(AlertLevel.WARN, "WARNING_MEMORY_HIGH", "warning perm usage used="
74+
+ (used / 1024 / 1024) + "MB rate=" + rate + "%");
7975
}
8076
// /////////////////////////////////////////////////
8177

8278
p = pw.getPack(TimeTypeEnum.FIVE_MIN);
8379
p.put(CounterConstants.JAVA_PERM_USED, new FloatValue((float) (meter.getAvg(300) / 1024.f / 1024.f)));
8480
}
85-
86-
long heap_perm_last_warning;
8781
}

scouter.agent.java/src/scouter/agent/netio/data/DataProxy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public static void reset() {
163163
public static void sendXLog(XLogPack p) {
164164
p.objHash = conf.getObjHash();
165165
sendDirect(p);
166-
if (conf.log_udp_xlog_enabled) {
166+
if (conf._log_udp_xlog_enabled) {
167167
Logger.println(p.toString());
168168
}
169169
}
@@ -233,7 +233,7 @@ public static void sendCounter(PerfCounterPack[] p) {
233233
}
234234
public static void sendHeartBeat(ObjectPack p) {
235235
udpCollect.add(p);
236-
if (conf.log_udp_object_enabled) {
236+
if (conf._log_udp_object_enabled) {
237237
Logger.println(p.toString());
238238
}
239239
}

scouter.agent.java/src/scouter/agent/netio/data/UDPDataSendThread.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void run() {
7777
int size = queue.size();
7878
switch (size) {
7979
case 0:
80-
ThreadUtil.sleep(conf.udp_udp_collection_interval_ms);
80+
ThreadUtil.sleep(conf.net_udp_collection_interval_ms);
8181
break;
8282
case 1:
8383
udp.write(queue.pop());

0 commit comments

Comments
 (0)