This is an automated email from the ASF dual-hosted git repository.

wu-sheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e5cb0ca7f Fix continuous profiling policy validation: reject zero 
threshold/count (#13898)
3e5cb0ca7f is described below

commit 3e5cb0ca7fb6ea4cf1d9dcaceaa9d9c473e4f67b
Author: mrproliu <[email protected]>
AuthorDate: Tue Jun 9 13:12:32 2026 +0800

    Fix continuous profiling policy validation: reject zero threshold/count 
(#13898)
    
    * Fix continuous profiling policy validation to reject zero threshold/count
    
    The validation conditions used `< 0` while the error messages said
    "must bigger than zero". rover triggers profiling when `value >= threshold`
    (and `matchedCount >= count`), so a threshold/count of 0 always fires and is
    meaningless. Tighten the conditions to `<= 0`, align CPU percent / HTTP 
error
    rate to (0-100], and fix the message grammar.
---
 docs/en/changes/changes.md                         |  1 +
 .../ContinuousProfilingMutationService.java        | 28 +++++++++++-----------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index c52087517c..d548d25cd5 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -291,6 +291,7 @@
 * Add `@Stream(allowBootReshape = true)` opt-in for additive boot-time reshape 
of BanyanDB streams / measures. Code-defined stream classes (e.g. 
`AlarmRecord`) can now annotate their schema as eligible for in-place additive 
update at OAP boot — a new `@Column` is appended to the live tag-family / 
fields via `client.update` instead of being silently rejected with 
`SKIPPED_SHAPE_MISMATCH` (which previously forced operators to drop the measure 
/ stream and lose historical rows). Additive in [...]
 * Mask keywords `trustStorePass`, `keyStorePass` by default.
 * Bump up dependencies to clear CVE alerts on shipped OAP jars: log4j `2.25.3` 
→ `2.25.4`, jackson `2.18.5` → `2.18.6`, kafka-clients `3.4.0` → `3.9.2`, 
postgresql `42.4.4` → `42.7.11`, commons-compress `1.21` → `1.26.2`.
+* Fix: continuous profiling policy validation now rejects a threshold / count 
of `0` to match the error messages and rover's `value >= threshold` trigger 
semantics (a `0` threshold would always trigger). CPU percent and HTTP error 
rate are tightened from `[0-100]` to `(0-100]`.
 
 #### UI
 * Add mobile menu icon and i18n labels for the iOS layer.
diff --git 
a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/continuous/ContinuousProfilingMutationService.java
 
b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/continuous/ContinuousProfilingMutationService.java
index 752ea3d140..e7033cf21e 100644
--- 
a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/continuous/ContinuousProfilingMutationService.java
+++ 
b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/continuous/ContinuousProfilingMutationService.java
@@ -118,32 +118,32 @@ public class ContinuousProfilingMutationService 
implements Service {
             switch (item.getType()) {
                 case PROCESS_CPU:
                     final int cpuPercent = 
Integer.parseInt(item.getThreshold());
-                    if (cpuPercent < 0 || cpuPercent > 100) {
-                        return "the process CPU percent should in [0-100]";
+                    if (cpuPercent <= 0 || cpuPercent > 100) {
+                        return "the process CPU percent should be in (0-100]";
                     }
                     break;
                 case PROCESS_THREAD_COUNT:
                     final int threadCount = 
Integer.parseInt(item.getThreshold());
-                    if (threadCount < 0) {
-                        return "the process thread count must bigger than 
zero";
+                    if (threadCount <= 0) {
+                        return "the process thread count must be bigger than 
zero";
                     }
                     break;
                 case SYSTEM_LOAD:
                     final int systemLoad = 
Integer.parseInt(item.getThreshold());
-                    if (systemLoad < 0) {
-                        return "the system load must bigger than zero";
+                    if (systemLoad <= 0) {
+                        return "the system load must be bigger than zero";
                     }
                     break;
                 case HTTP_ERROR_RATE:
                     final int httpErrorRate = 
Integer.parseInt(item.getThreshold());
-                    if (httpErrorRate < 0 || httpErrorRate > 100) {
-                        return "the HTTP error rate should in [0-100]";
+                    if (httpErrorRate <= 0 || httpErrorRate > 100) {
+                        return "the HTTP error rate should be in (0-100]";
                     }
                     break;
                 case HTTP_AVG_RESPONSE_TIME:
                     final int httpAvgResponseTime = 
Integer.parseInt(item.getThreshold());
-                    if (httpAvgResponseTime < 0) {
-                        return "the HTTP average response time must bigger 
than zero";
+                    if (httpAvgResponseTime <= 0) {
+                        return "the HTTP average response time must be bigger 
than zero";
                     }
                     break;
             }
@@ -155,13 +155,13 @@ public class ContinuousProfilingMutationService 
implements Service {
 
     private String 
validatePolicyItemWindows(ContinuousProfilingPolicyItemCreation item) {
         if (item.getPeriod() <= 0) {
-            return "period must bigger than zero";
+            return "period must be bigger than zero";
         }
-        if (item.getCount() < 0) {
-            return "count must bigger than zero";
+        if (item.getCount() <= 0) {
+            return "count must be bigger than zero";
         }
         if (item.getCount() > item.getPeriod()) {
-            return "count must be small than period";
+            return "count must be equal to or smaller than period";
         }
         return null;
     }

Reply via email to