This is an automated email from the ASF dual-hosted git repository.
cyyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/master by this push:
new b5ce5c9e9d [fix] refactor system built-in labels validation logic
(#3946)
b5ce5c9e9d is described below
commit b5ce5c9e9d3271dc83497331dbe530d11c58b3bc
Author: Yang Chen <[email protected]>
AuthorDate: Tue Jan 6 15:47:25 2026 +0800
[fix] refactor system built-in labels validation logic (#3946)
---
.../hertzbeat/alert/service/impl/AlertDefineServiceImpl.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git
a/hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/service/impl/AlertDefineServiceImpl.java
b/hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/service/impl/AlertDefineServiceImpl.java
index 22340def60..e720cfb427 100644
---
a/hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/service/impl/AlertDefineServiceImpl.java
+++
b/hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/service/impl/AlertDefineServiceImpl.java
@@ -90,6 +90,15 @@ public class AlertDefineServiceImpl implements
AlertDefineService {
private static final String CONTENT_TYPE =
MediaType.APPLICATION_OCTET_STREAM_VALUE + SignConstants.SINGLE_MARK +
"charset=" + StandardCharsets.UTF_8;
+ private static final Set<String> SYSTEM_BUILT_IN_LABELS = Set.of(
+ CommonConstants.LABEL_INSTANCE,
+ CommonConstants.LABEL_DEFINE_ID,
+ CommonConstants.LABEL_ALERT_NAME,
+ CommonConstants.LABEL_INSTANCE_NAME,
+ CommonConstants.LABEL_ALERT_SEVERITY,
+ CommonConstants.ALERT_MODE_LABEL
+ );
+
public AlertDefineServiceImpl(List<AlertDefineImExportService>
alertDefineImExportServiceList, DataSourceService dataSourceService) {
alertDefineImExportServiceList.forEach(it ->
alertDefineImExportServiceMap.put(it.type(), it));
this.dataSourceService = dataSourceService;
@@ -148,7 +157,7 @@ public class AlertDefineServiceImpl implements
AlertDefineService {
}
private boolean isSystemBuiltInLabel(String labelKey) {
- return CommonConstants.ALERT_MODE_LABEL.equals(labelKey) ||
CommonConstants.LABEL_ALERT_SEVERITY.contains(labelKey);
+ return SYSTEM_BUILT_IN_LABELS.contains(labelKey);
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]