[BUG] In Inhibit rules, Target Labels cannot be assigned labels with the same name but different values.
Is there an existing issue for this?
- [x] I have searched the existing issues
Current Behavior
I tried to assign two labels with same name but different values in the target labels, but the system only retained the last value entered.
Expected Behavior
No response
Steps To Reproduce
No response
Environment
HertzBeat version(s):v1.7.2
Debug logs
No response
Anything else?
No response
I noticed that the same phenomenon occurs in notification policies as well, where it is impossible to add labels with the same name but different values. This issue might appear across all label assignment fields in the system.
Hi, @Kylin-Guo Thank you for your feedback. Within the system's label management functionality, does a label with an empty value exist?
Hi, @Kylin-Guo Thank you for your feedback. Within the system's label management functionality, does a label with an empty value exist?
Hi @delei Regardless of whether it is in the system's Labels page or the labels bound in Threshold Rules, I have assigned values to all labels.
This does appear to be an issue, and we will reproduce it in the latest version.
The issue has been reproduced and confirmed to be a issue. and the same issue does indeed occur on other pages.
Steps To Reproduce
- add a new inhibit rule
- submit this form data
As there are many pages involved, and I'm not a professional front-end developer, I will make a preliminary attempt and assess this issue.
My preliminary assessment suggests this relates to the front-end label selector component. We should employ the web-app/src/app/shared/components/label-selector component to address this issue, and investigate whether modifications to the back-end API logic are required.
I raised a PR to improve the experience of selecting tags, but it did not resolve this issue.
I believe that selecting the same key is currently not permitted.
Based on my understanding of the code logic, the frontend use a Record<String, String> type to store the selected tag values, while the backend use a Map<String, String> object to receive this parameter value. Neither of these types permits duplicate keys.
We require further suggestions. Should my understanding be incorrect or should there be a better solution, Please feel free to comment and provide a detailed description of your implementation approach.