You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/11/06 05:13:13 UTC

[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #1165: Optimize: Add service/instance usage metrics

tianxiaoliang commented on a change in pull request #1165:
URL: https://github.com/apache/servicecomb-service-center/pull/1165#discussion_r744077370



##########
File path: server/metrics/meta_reporter.go
##########
@@ -64,6 +78,16 @@ func (m *MetaReporter) InstanceAdd(delta float64, ml datasource.MetricsLabels) {
 		log.Error("gauge add failed", err)
 	}
 }
+func (m *MetaReporter) InstanceUsageSet() {
+	instance := metricsvc.InstanceName()
+	labels := map[string]string{
+		"instance": instance,
+	}
+	used := promutil.GaugeValue(KeyInstanceTotal, labels)
+	if err := metrics.GaugeSet(KeyInstanceUsage, used/float64(quota.DefaultInstanceQuota), labels); err != nil {

Review comment:
       判断0

##########
File path: server/metrics/meta_reporter.go
##########
@@ -51,6 +55,16 @@ func (m *MetaReporter) ServiceAdd(delta float64, ml datasource.MetricsLabels) {
 		log.Error("gauge add failed", err)
 	}
 }
+func (m *MetaReporter) ServiceUsageSet() {
+	instance := metricsvc.InstanceName()
+	labels := map[string]string{
+		"instance": instance,
+	}
+	used := promutil.GaugeValue(KeyServiceTotal, labels)
+	if err := metrics.GaugeSet(KeyServiceUsage, used/float64(quota.DefaultServiceQuota), labels); err != nil {

Review comment:
       判断下0




-- 
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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org