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

   ## What's changed?
   
   Fixes #4256.
   
   Exported alert rules (JSON / YAML / Excel) dropped the `datasource` field 
(the "Query Language" selected in the UI, `promql` / `sql`), so re-imported 
periodic rules had an empty query language and could not execute. Root cause: 
`AlertDefineDTO` lacked the field, and `BeanUtils.copyProperties` silently 
dropped it in both directions.
   
   This adds `datasource` to `AlertDefineDTO` (JSON / YAML pick it up 
automatically) and appends a `Datasource` column to the Excel export. The 
column is appended last so Excel files exported before this fix still import 
correctly.
   
   Export of the same periodic rule, before and after (verified on a local 
instance):
   
   ```diff
        "alertDefine": {
   +        "datasource": "promql",
            "enable": true,
            "expr": "cpu_usage{instance=\"server1\"} > 80",
            "name": "test",
            "period": 300,
            ...
        }
   ```
   
   ## Checklist
   
   - [x]  I have read the [Contributing 
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
   - [ ]  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.
   


-- 
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