Skip to content

Commit ec58f93

Browse files
authored
Merge pull request #771 from scouter-project/develop
Develop
2 parents 7ad7efa + de59038 commit ec58f93

File tree

25 files changed

+170
-48
lines changed

25 files changed

+170
-48
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ SCOUTER can help you.
5959

6060
- **Server (Collector)** : save the performance metrics from scouter agents or telegraf. The data is streamed to scouter client.
6161

62-
- **Client (Viewer)** : client program based on RCP.
62+
- **Client (Viewer)** : client program based on RCP. (not support OSX Big Sur.)
6363

6464
- **Web API (Since @1.8.0)** : scouter web apis to get counters, XLogs, profiles and another performance metrics via HTTP protocol.
6565
- [Web API Guide](./scouter.document/tech/Web-API-Guide.md)

README_kr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
- **Server (Collector)** : Agent가 전송한 데이터를 저장하고 Client 요청시 Client에게 적절한 데이터를 전송
5858

59-
- **Client (Viewer)** : 수집된 데이터를 보기 위한 RCP 기반 Client 프로그램
59+
- **Client (Viewer)** : 수집된 데이터를 보기 위한 RCP 기반 Client 프로그램. (OSX Big Sur 미지원)
6060

6161
- **Web API (Since @1.8.0)** : 성능 카운터, XLog, 프로파일등의 정보를 HTTP 프로토콜을 통해 제공
6262
- [Web API Guide](./scouter.document/tech/Web-API-Guide_kr.md)

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>io.github.scouter-project</groupId>
66
<artifactId>scouter-parent</artifactId>
7-
<version>2.10.0</version>
7+
<version>2.10.2</version>
88
<packaging>pom</packaging>
99

1010
<name>SCOUTER APM</name>

scouter.agent.batch/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.github.scouter-project</groupId>
77
<artifactId>scouter-parent</artifactId>
8-
<version>2.10.0</version>
8+
<version>2.10.2</version>
99
</parent>
1010

1111
<artifactId>scouter-agent-batch</artifactId>

scouter.agent.host/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>io.github.scouter-project</groupId>
66
<artifactId>scouter-parent</artifactId>
7-
<version>2.10.0</version>
7+
<version>2.10.2</version>
88
</parent>
99

1010
<artifactId>scouter-agent-host</artifactId>

scouter.agent.java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>io.github.scouter-project</groupId>
66
<artifactId>scouter-parent</artifactId>
7-
<version>2.10.0</version>
7+
<version>2.10.2</version>
88
</parent>
99

1010
<artifactId>scouter-agent-java</artifactId>

scouter.agent.java/src/main/java/reactor/core/publisher/ScouterOptimizableOperatorProxy.java

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@
1919
package reactor.core.publisher;
2020

2121
import scouter.agent.Logger;
22+
import scouter.agent.util.Tuple;
2223

2324
/**
2425
* @author Gun Lee ([email protected]) on 2020/08/08
2526
*/
2627
public class ScouterOptimizableOperatorProxy {
2728

2829
public static final String EMPTY = "";
30+
public static final Tuple.StringLongPair EMPTYOBJ = new Tuple.StringLongPair("", 0);
2931
public static boolean accessible = false;
3032
public static boolean first = true;
3133

32-
public static String nameOnCheckpoint(Object candidate) {
34+
public static Tuple.StringLongPair nameOnCheckpoint(Object candidate, int maxScanDepth) {
3335
try {
3436
if (!accessible && first) {
3537
try {
@@ -42,34 +44,47 @@ public static String nameOnCheckpoint(Object candidate) {
4244
first = false;
4345
}
4446
if (!accessible) {
45-
return EMPTY;
47+
return EMPTYOBJ;
4648
}
4749

4850
if (candidate instanceof OptimizableOperator) {
49-
OptimizableOperator<?, ?> operator = ((OptimizableOperator<?, ?>) candidate).nextOptimizableSource();
50-
if (operator == null) {
51-
return EMPTY;
51+
OptimizableOperator<?, ?> closeAssembly = findCloseAssembly((OptimizableOperator<?, ?>) candidate, maxScanDepth);
52+
if (closeAssembly == null) {
53+
return EMPTYOBJ;
5254
}
53-
if (operator instanceof MonoOnAssembly) {
54-
FluxOnAssembly.AssemblySnapshot snapshot = ((MonoOnAssembly) operator).stacktrace;
55+
if (closeAssembly instanceof MonoOnAssembly) {
56+
FluxOnAssembly.AssemblySnapshot snapshot = ((MonoOnAssembly) closeAssembly).stacktrace;
5557
if (snapshot != null && snapshot.checkpointed) {
56-
return snapshot.cached;
58+
return new Tuple.StringLongPair(snapshot.cached, snapshot.hashCode());
5759
}
58-
} else if (operator instanceof FluxOnAssembly) {
59-
FluxOnAssembly.AssemblySnapshot snapshot = ((FluxOnAssembly) operator).snapshotStack;
60+
} else if (closeAssembly instanceof FluxOnAssembly) {
61+
FluxOnAssembly.AssemblySnapshot snapshot = ((FluxOnAssembly) closeAssembly).snapshotStack;
6062
if (snapshot != null && snapshot.checkpointed) {
61-
return snapshot.cached;
63+
return new Tuple.StringLongPair(snapshot.cached, snapshot.hashCode());
6264
}
6365
}
6466
}
65-
return EMPTY;
67+
return EMPTYOBJ;
6668
} catch (Throwable e) {
6769

68-
return EMPTY;
70+
return EMPTYOBJ;
6971
}
7072
}
7173

72-
public static void appendSources4Dump(Object candidate, StringBuilder builder) {
74+
public static OptimizableOperator<?, ?> findCloseAssembly(OptimizableOperator<?, ?> candidate, int maxScanDepth) {
75+
OptimizableOperator<?, ?> operator = candidate;
76+
for (int i = 0; i < maxScanDepth; i++) {
77+
operator = operator.nextOptimizableSource();
78+
if (operator == null) {
79+
return null;
80+
} else if (operator instanceof MonoOnAssembly || operator instanceof FluxOnAssembly) {
81+
return operator;
82+
}
83+
}
84+
return null;
85+
}
86+
87+
public static void appendSources4Dump(Object candidate, StringBuilder builder, int maxScanDepth) {
7388
try {
7489
if (!accessible && first) {
7590
try {
@@ -86,14 +101,14 @@ public static void appendSources4Dump(Object candidate, StringBuilder builder) {
86101
}
87102

88103
if (candidate instanceof OptimizableOperator) {
89-
OptimizableOperator<?, ?> operator = ((OptimizableOperator<?, ?>) candidate).nextOptimizableSource();
90-
if (operator == null) {
104+
OptimizableOperator<?, ?> closeAssembly = findCloseAssembly((OptimizableOperator<?, ?>) candidate, maxScanDepth);
105+
if (closeAssembly == null) {
91106
return;
92107
}
93-
String p1 = operator.toString();
108+
String p1 = closeAssembly.toString();
94109
builder.append(" (<-) ").append(p1);
95110
if (p1.startsWith("checkpoint")) {
96-
OptimizableOperator<?, ?> operator2 = operator.nextOptimizableSource();
111+
OptimizableOperator<?, ?> operator2 = closeAssembly.nextOptimizableSource();
97112
if (operator2 != null) {
98113
builder.append(" (<-) ").append(operator2.toString());
99114
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ public static final Configure getInstance() {
198198

199199
@ConfigDesc("profile reactor's important checkpoint")
200200
public boolean profile_reactor_checkpoint_enabled = true;
201+
@ConfigDesc("reactor's important checkpoint scan depth")
202+
public int profile_reactor_checkpoint_search_depth = 5;
201203
@ConfigDesc("profile reactor's another checkpoints")
202204
public boolean profile_reactor_more_checkpoint_enabled = false;
203205

@@ -597,6 +599,8 @@ public static final Configure getInstance() {
597599
public boolean hook_method_access_none_enabled = false;
598600
@ConfigDesc("Activating lambda Method hooking")
599601
public boolean hook_method_lambda_enable = true;
602+
@ConfigDesc("Activating anonymous Method hooking")
603+
public boolean hook_method_anonymous_enable = true;
600604

601605
@ConfigDesc("Method set for service hooking")
602606
@ConfigValueType(ValueType.COMMA_SEPARATED_VALUE)
@@ -989,6 +993,7 @@ private void apply() {
989993
this.hook_method_access_private_enabled = getBoolean("hook_method_access_private_enabled", false);
990994
this.hook_method_access_none_enabled = getBoolean("hook_method_access_none_enabled", false);
991995
this.hook_method_lambda_enable = getBoolean("hook_method_lambda_enable", true);
996+
this.hook_method_anonymous_enable = getBoolean("hook_method_anonymous_enable", true);
992997

993998
this.hook_method_ignore_prefixes = StringUtil.removeWhitespace(getValue("hook_method_ignore_prefixes", "get,set"));
994999
this._hook_method_ignore_prefix = StringUtil.split(this.hook_method_ignore_prefixes, ",");
@@ -1087,6 +1092,7 @@ private void apply() {
10871092
this.profile_elasticsearch_full_query_enabled = getBoolean("profile_elasticsearch_full_query_enabled", false);
10881093

10891094
this.profile_reactor_checkpoint_enabled = getBoolean("profile_reactor_checkpoint_enabled", true);
1095+
this.profile_reactor_checkpoint_search_depth = getInt("profile_reactor_checkpoint_search_depth", 5);
10901096
this.profile_reactor_more_checkpoint_enabled = getBoolean("profile_reactor_more_checkpoint_enabled", false);
10911097

10921098
this.net_udp_collection_interval_ms = getInt("net_udp_collection_interval_ms", 100);

scouter.agent.java/src/main/java/scouter/agent/asm/MethodASM.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public ClassVisitor transform(ClassVisitor cv, String className, ClassDesc class
7474
if (conf.isIgnoreMethodClass(className))
7575
return cv;
7676

77+
if (!conf.hook_method_anonymous_enable && classIsAnnon(className)) {
78+
return cv;
79+
}
80+
7781
for (int i = 0; i < target.size(); i++) {
7882
HookingSet mset = target.get(i);
7983
if (mset.classMatch.include(className)) {
@@ -82,6 +86,15 @@ public ClassVisitor transform(ClassVisitor cv, String className, ClassDesc class
8286
}
8387
return cv;
8488
}
89+
90+
private boolean classIsAnnon(String className) {
91+
int spIndex = className.lastIndexOf('$');
92+
if (spIndex > 0 && spIndex < className.length() - 1) {
93+
char dig = className.charAt(spIndex + 1);
94+
return dig >= 48 && dig <= 57;
95+
}
96+
return false;
97+
}
8598
}
8699

87100
class MethodCV extends ClassVisitor implements Opcodes {

scouter.agent.java/src/main/java/scouter/agent/proxy/HttpTraceFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public String getCookie(Object req, String key) {
4040
public String getRequestURI(Object req) {
4141
return null;
4242
}
43+
public String getRequestId(Object req) {
44+
return null;
45+
}
4346
public String getRemoteAddr(Object req) {
4447
return null;
4548
}

0 commit comments

Comments
 (0)