Duansg opened a new pull request, #3821:
URL: https://github.com/apache/hertzbeat/pull/3821

   ## What's changed?
   
   Added JEXL basic validation and supplemented optimized keywords.
   
   For reference: [JEXL 
Syntax](https://commons.apache.org/proper/commons-jexl/reference/syntax.html) 
、[Api 
Docs](https://commons.apache.org/proper/commons-jexl/apidocs/org/apache/commons/jexl3/JexlContext.html)
   
   Therefore, it is not difficult to see that the following rules must be 
satisfied:
   1. Must start with a-z, A-Z, _ or $. 
   2. Whitespace is a separator and cannot appear within an identifier.
   3. Keywords are reserved characters and cannot be used as variable names or 
property names when performing operations.
   
   There are currently templates that do not match JEXL rules, which may cause 
threshold expressions to behave abnormally. For example:
   <img width="1508" height="530" alt="Snipaste_2025-10-16_16-38-03" 
src="https://github.com/user-attachments/assets/11896063-3e70-4a3c-a61a-a581d40360a7";
 />
   
   
   Modification details:
   1. Supplement and refine retained keyword information
   2. Added space validation
   3. Added initial character validation
   4. Refine the validation script and modify all existing templates containing 
erroneous fields.
   
   ## Checklist
   
   - [x]  I have read the [Contributing 
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
   - [x]  I have written the necessary doc or comment.
   - [x]  I have added the necessary unit tests and all cases have passed.
   
   ## Add or update API
   
   - [ ] I have added the necessary [e2e 
tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have 
passed.
   
   > app-kafka_client.yml
   
   <img width="1506" height="863" alt="Kafka" 
src="https://github.com/user-attachments/assets/912214ed-2008-4338-aca2-bbd1f196e7f9";
 />
   <img width="1507" height="660" alt="Kafka_threshold" 
src="https://github.com/user-attachments/assets/a84f5790-cb8d-4e32-8983-b6e009c210e5";
 />
   <img width="1509" height="713" alt="Kafka_threshold1" 
src="https://github.com/user-attachments/assets/0ff09492-3fd3-48df-b7fd-f29570a3cb3e";
 />
   
   
   > app-pulsar.yml
   
   <img width="1511" height="578" alt="Puslar" 
src="https://github.com/user-attachments/assets/75507b18-5a9f-4038-b14a-a394b64a6a50";
 />
   <img width="1507" height="621" alt="Puslar_1" 
src="https://github.com/user-attachments/assets/84930db0-98b1-4b81-8bf2-e6700cd1d69e";
 />
   <img width="1511" height="620" alt="Puslar_threshold" 
src="https://github.com/user-attachments/assets/576ad2a2-5c59-4ba1-972b-405763ca9389";
 />
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to