Browse Source

[REV] 调整guage key

pujielan 2 months ago
parent
commit
0601b8af87
1 changed files with 4 additions and 2 deletions
  1. 4 2
      handler/events.go

+ 4 - 2
handler/events.go

@@ -190,7 +190,8 @@ func (e *EventHandler) JudgeInterval(chdb *gorm.DB) *EventHandler {
 
 func (e *EventHandler) SetUID() *EventHandler {
 	// logger.Debug("UUUUUUid: ", fmt.Sprintf("%s_%s_%s", e.RP.AppAlias, e.RP.RuleMonitorAlias, e.RP.Policy))
-	e.JR.UID = fmt.Sprintf("%s_%d", e.RP.AppAlias, e.RP.Id)
+	// e.JR.UID = fmt.Sprintf("%s_%d", e.RP.AppAlias, e.RP.Id)
+	e.JR.UID = fmt.Sprintf("%s", e.RP.AppAlias)
 	return e
 }
 
@@ -202,6 +203,7 @@ func (e *EventHandler) RegisterPrometheusGauge() *EventHandler {
 	if err := prometheus.Register(gauge); err != nil {
 		if err.Error() == "duplicate metrics collector registration attempted" {
 			logger.Errorf("Failed to register gauge: %v", err)
+			logger.Infof("promMap: %v", e.promMap)
 			return e
 		} else {
 			log.Fatalf("Failed to register gauge: %v", err)
@@ -216,7 +218,7 @@ func (e *EventHandler) SetPromKV() *EventHandler {
 	e.GetRegisteredGauge(e.RP.RuleMonitorAlias).WithLabelValues(
 		e.RP.AppAlias, e.RP.RuleKind, e.JR.UID,
 	).Set(float64(e.JR.RowGaugeResult))
-	logger.Debugf("e.JR.RowGaugeResult", e.JR.RowGaugeResult)
+	logger.Debug("e.JR.RowGaugeResult", e.JR.RowGaugeResult)
 	return e
 }