File tree Expand file tree Collapse file tree
hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/service/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,6 +90,15 @@ public class AlertDefineServiceImpl implements AlertDefineService {
9090
9191 private static final String CONTENT_TYPE = MediaType .APPLICATION_OCTET_STREAM_VALUE + SignConstants .SINGLE_MARK + "charset=" + StandardCharsets .UTF_8 ;
9292
93+ private static final Set <String > SYSTEM_BUILT_IN_LABELS = Set .of (
94+ CommonConstants .LABEL_INSTANCE ,
95+ CommonConstants .LABEL_DEFINE_ID ,
96+ CommonConstants .LABEL_ALERT_NAME ,
97+ CommonConstants .LABEL_INSTANCE_NAME ,
98+ CommonConstants .LABEL_ALERT_SEVERITY ,
99+ CommonConstants .ALERT_MODE_LABEL
100+ );
101+
93102 public AlertDefineServiceImpl (List <AlertDefineImExportService > alertDefineImExportServiceList , DataSourceService dataSourceService ) {
94103 alertDefineImExportServiceList .forEach (it -> alertDefineImExportServiceMap .put (it .type (), it ));
95104 this .dataSourceService = dataSourceService ;
@@ -148,7 +157,7 @@ private void saveNewCustomLabel(AlertDefine alertDefine) {
148157 }
149158
150159 private boolean isSystemBuiltInLabel (String labelKey ) {
151- return CommonConstants . ALERT_MODE_LABEL . equals ( labelKey ) || CommonConstants . LABEL_ALERT_SEVERITY .contains (labelKey );
160+ return SYSTEM_BUILT_IN_LABELS .contains (labelKey );
152161 }
153162
154163 @ Override
You can’t perform that action at this time.
0 commit comments