Search before asking
Apache SkyWalking Component
OAP server (apache/skywalking)
What happened
In ContinuousProfilingMutationService.validatePolicyItem(), the validation condition uses < 0 but the error messages say "must bigger than zero".
|
if (threadCount < 0) { |
|
return "the process thread count must bigger than zero"; |
|
if (systemLoad < 0) { |
|
return "the system load must bigger than zero"; |
|
if (httpAvgResponseTime < 0) { |
|
return "the HTTP average response time must bigger than zero"; |
What you expected to happen
The validation condition should match the error message semantics. There are two possible fixes:
Option A - Fix the condition: Change < 0 to <= 0, since a threshold of 0 (e.g., 0 threads, 0 system load) has no practical meaning as a
profiling trigger (it would mean "always trigger").
Option B - Fix the message: Change the message to "must be equal to or bigger than zero" (i.e., "must not be negative"), if 0 is
intentionally allowed as a valid threshold.
I'd like to hear from the maintainers which direction is correct before submitting a PR.
How to reproduce
omit
Anything else
No response
Are you willing to submit a pull request to fix on your own?
Code of Conduct
Search before asking
Apache SkyWalking Component
OAP server (apache/skywalking)
What happened
In ContinuousProfilingMutationService.validatePolicyItem(), the validation condition uses < 0 but the error messages say "must bigger than zero".
skywalking/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/continuous/ContinuousProfilingMutationService.java
Lines 127 to 128 in 9e57d91
skywalking/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/continuous/ContinuousProfilingMutationService.java
Lines 133 to 134 in 9e57d91
skywalking/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/continuous/ContinuousProfilingMutationService.java
Lines 145 to 146 in 9e57d91
What you expected to happen
The validation condition should match the error message semantics. There are two possible fixes:
Option A - Fix the condition: Change < 0 to <= 0, since a threshold of 0 (e.g., 0 threads, 0 system load) has no practical meaning as a
profiling trigger (it would mean "always trigger").
Option B - Fix the message: Change the message to "must be equal to or bigger than zero" (i.e., "must not be negative"), if 0 is
intentionally allowed as a valid threshold.
I'd like to hear from the maintainers which direction is correct before submitting a PR.
How to reproduce
omit
Anything else
No response
Are you willing to submit a pull request to fix on your own?
Code of Conduct