Skip to content

Commit 9543477

Browse files
authored
Merge pull request #853 from scouter-project/develop
Develop
2 parents 018cfab + 6ccb929 commit 9543477

71 files changed

Lines changed: 1576 additions & 571 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ scouter.server.boot/database/*
4141

4242
scouter.document/.project
4343

44+
build_client_local.sh
45+
build_package_local.sh
46+
47+
4448
### Vim template
4549
[._]*.s[a-w][a-z]
4650
[._]s[a-w][a-z]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ SCOUTER can help you.
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)
66+
- **Weaver (Since @2.17.0)** : Provides the ability to directly control Scouter XLog and Profiles at the code level of Java applications.
67+
- [Scouter Weaver Guide](./scouter.document/weaver/Weaver-Guide.md)
6668

6769
### 3rd-party UIs
6870
- **scouter paper** : [scouter paper homepage](https://scouter-contrib.github.io/scouter-paper/)

README_kr.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
- **Web API (Since @1.8.0)** : 성능 카운터, XLog, 프로파일등의 정보를 HTTP 프로토콜을 통해 제공
6262
- [Web API Guide](./scouter.document/tech/Web-API-Guide_kr.md)
63+
- **Weaver (Since @2.17.0)** : Java 애플리케이션의 코드 수준에서 Scouter XLog와 Profile을 직접 제어하는 기능 제공
6364

6465
### 3rd-party UIs
6566
- **scouter paper** : [scouter-paper homepage](https://scouter-contrib.github.io/scouter-paper/)

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.17.0-SNAPSHOT</version> <!--scouter-->
7+
<version>2.17.1</version> <!--scouter-->
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.17.0-SNAPSHOT</version> <!--scouter-->
8+
<version>2.17.1</version> <!--scouter-->
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.17.0-SNAPSHOT</version> <!--scouter-->
7+
<version>2.17.1</version> <!--scouter-->
88
</parent>
99

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,8 @@ public StringKeyLinkedMap<ValueType> getConfigureValueType() {
504504
}
505505

506506
private boolean isKube() {
507-
Properties properties = System.getProperties();
508-
return !StringUtil.isEmpty(properties.getProperty("KUBERNETES_SERVICE_HOST"));
507+
Map<String, String> env = System.getenv();
508+
return !StringUtil.isEmpty(env.get("KUBERNETES_SERVICE_HOST"));
509509
}
510510

511511
public static void main(String[] args) {

scouter.agent.host/src/main/java/scouter/agent/counter/task/AgentHeartBeat.java

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,49 @@ public void writeHostNameForKube(CounterBasket pw) {
7575
File dir = new File(conf.counter_object_registry_path);
7676
File file = new File(dir, seqNoForKube + ".scouterkubeseq");
7777
if (dir.canWrite()) {
78+
deleteAllHostNameFileWithIgnore(dir, seqNoForKube);
7879
FileUtil.save(file, conf.obj_name.getBytes());
7980
}
8081

8182
} else {
8283
File dir = new File(conf.counter_object_registry_path);
83-
if (dir == null)
84-
return;
85-
86-
File[] files = dir.listFiles();
87-
for (int i = 0; i < files.length; i++) {
88-
if (files[i].isDirectory())
89-
continue;
90-
String name = files[i].getName();
91-
if (!name.endsWith(".scouterkubeseq")) {
92-
continue;
93-
}
94-
if (files[i].canWrite()) {
95-
files[i].delete();
96-
}
84+
deleteAllHostNameFileWithIgnore(dir, -1);
85+
}
86+
}
87+
88+
private void deleteAllHostNameFileWithIgnore(File dir, long ignoreSeq) {
89+
if (dir == null)
90+
return;
91+
92+
File[] files = dir.listFiles();
93+
for (int i = 0; i < files.length; i++) {
94+
if (files[i].isDirectory())
95+
continue;
96+
String name = files[i].getName();
97+
if (!name.endsWith(".scouterkubeseq")) {
98+
continue;
99+
}
100+
101+
int kubeSeq = cintErrorMinusOne(name.substring(0, name.lastIndexOf(".")));
102+
if (kubeSeq < 0)
103+
continue;
104+
if (kubeSeq == ignoreSeq) {
105+
continue;
106+
}
107+
if (files[i].canWrite()) {
108+
files[i].delete();
109+
}
110+
}
111+
}
112+
113+
public static int cintErrorMinusOne(String value) {
114+
if (value == null) {
115+
return -1;
116+
} else {
117+
try {
118+
return Integer.parseInt(value);
119+
} catch (Exception e) {
120+
return -1;
97121
}
98122
}
99123
}

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.17.0-SNAPSHOT</version> <!--scouter-->
7+
<version>2.17.1</version> <!--scouter-->
88
</parent>
99

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

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,13 @@ public static final Configure getInstance() {
323323
@ConfigDesc("")
324324
public int autodump_stuck_check_interval_ms = 10000;
325325

326+
@ConfigDesc("ends sxlog profile when it exceeds profile_force_end_stuck_millis.")
327+
public boolean profile_force_end_stuck_service = true;
328+
@ConfigDesc("alert when forcibly ends xlog profile.")
329+
public boolean profile_force_end_stuck_alert = true;
330+
@ConfigDesc("stuck service millis for forcibly ends xlog profile")
331+
public int profile_force_end_stuck_millis = 300000;
332+
326333
//Auto dump options on exceeded process cpu
327334
@ConfigDesc("Enable the function to generate dump file when this process cpu is over than the set threshold")
328335
public boolean autodump_cpu_exceeded_enabled = false;
@@ -974,6 +981,10 @@ private void apply() {
974981
this.autodump_stuck_thread_ms = getInt("autodump_stuck_thread_ms", 0);
975982
this.autodump_stuck_check_interval_ms = getInt("autodump_stuck_check_interval_ms", 10000);
976983

984+
this.profile_force_end_stuck_service = getBoolean("profile_force_end_stuck_service", false);
985+
this.profile_force_end_stuck_alert = getBoolean("profile_force_end_stuck_alert", true);
986+
this.profile_force_end_stuck_millis = getInt("profile_force_end_stuck_millis", 300000);
987+
977988
this.autodump_cpu_exceeded_enabled = getBoolean("autodump_cpu_exceeded_enabled", false);
978989
this.autodump_cpu_exceeded_threshold_pct = getInt("autodump_cpu_exceeded_threshold_pct", 90);
979990
this.autodump_cpu_exceeded_duration_ms = getInt("autodump_cpu_exceeded_duration_ms", 30000);
@@ -1627,8 +1638,8 @@ public void initTmpDir() {
16271638
}
16281639

16291640
private boolean isKube() {
1630-
Properties properties = System.getProperties();
1631-
return !StringUtil.isEmpty(properties.getProperty("KUBERNETES_SERVICE_HOST"));
1641+
Map<String, String> env = System.getenv();
1642+
return !StringUtil.isEmpty(env.get("KUBERNETES_SERVICE_HOST"));
16321643
}
16331644

16341645
private String readHostNameFromHostAgent() {

0 commit comments

Comments
 (0)