You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2022/04/24 15:43:37 UTC

[dubbo-go] branch revert-1858-clean-code created (now c995f2cd6)

This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a change to branch revert-1858-clean-code
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


      at c995f2cd6 Revert "clean code (#1858)"

This branch includes the following new commits:

     new c995f2cd6 Revert "clean code (#1858)"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[dubbo-go] 01/01: Revert "clean code (#1858)"

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch revert-1858-clean-code
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git

commit c995f2cd6f50ee723f492cb557ec6fdc711ad21a
Author: Xin.Zh <dr...@foxmail.com>
AuthorDate: Sun Apr 24 23:43:34 2022 +0800

    Revert "clean code (#1858)"
    
    This reverts commit 8bea4b3e1607e13ed88b55300599e43274b6022f.
---
 metrics/prometheus/reporter.go | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/metrics/prometheus/reporter.go b/metrics/prometheus/reporter.go
index 57df38455..845f6a8fc 100644
--- a/metrics/prometheus/reporter.go
+++ b/metrics/prometheus/reporter.go
@@ -30,6 +30,7 @@ import (
 	ocprom "contrib.go.opencensus.io/exporter/prometheus"
 
 	"github.com/prometheus/client_golang/prometheus"
+	prom "github.com/prometheus/client_golang/prometheus"
 )
 
 import (
@@ -216,9 +217,9 @@ func newPrometheusReporter(reporterConfig *metrics.ReporterConfig) metrics.Repor
 				providerRTGaugeVec: newGaugeVec(providerPrefix+serviceKey+rtSuffix, reporterConfig.Namespace, labelNames),
 			}
 
-			prometheus.DefaultRegisterer.MustRegister(reporterInstance.consumerRTGaugeVec, reporterInstance.providerRTGaugeVec)
+			prom.DefaultRegisterer.MustRegister(reporterInstance.consumerRTGaugeVec, reporterInstance.providerRTGaugeVec)
 			metricsExporter, err := ocprom.NewExporter(ocprom.Options{
-				Registry: prometheus.DefaultRegisterer.(*prometheus.Registry),
+				Registry: prom.DefaultRegisterer.(*prom.Registry),
 			})
 			if err != nil {
 				logger.Errorf("new prometheus reporter with error = %s", err)
@@ -249,7 +250,7 @@ func (reporter *PrometheusReporter) setGauge(gaugeName string, toSetValue float6
 		// gauge
 		if val, exist := reporter.userGauge.Load(gaugeName); !exist {
 			newGauge := newGauge(gaugeName, reporter.namespace)
-			_ = prometheus.DefaultRegisterer.Register(newGauge)
+			_ = prom.DefaultRegisterer.Register(newGauge)
 
 			reporter.userGauge.Store(gaugeName, newGauge)
 			newGauge.Set(toSetValue)
@@ -266,7 +267,7 @@ func (reporter *PrometheusReporter) setGauge(gaugeName string, toSetValue float6
 			keyList = append(keyList, k)
 		}
 		newGaugeVec := newGaugeVec(gaugeName, reporter.namespace, keyList)
-		_ = prometheus.DefaultRegisterer.Register(newGaugeVec)
+		_ = prom.DefaultRegisterer.Register(newGaugeVec)
 		reporter.userGaugeVec.Store(gaugeName, newGaugeVec)
 		newGaugeVec.With(labelMap).Set(toSetValue)
 	} else {
@@ -281,7 +282,7 @@ func (reporter *PrometheusReporter) incCounter(counterName string, labelMap prom
 		// counter
 		if val, exist := reporter.userCounter.Load(counterName); !exist {
 			newCounter := newCounter(counterName, reporter.namespace)
-			_ = prometheus.DefaultRegisterer.Register(newCounter)
+			_ = prom.DefaultRegisterer.Register(newCounter)
 			reporter.userCounter.Store(counterName, newCounter)
 			newCounter.Inc()
 		} else {
@@ -297,7 +298,7 @@ func (reporter *PrometheusReporter) incCounter(counterName string, labelMap prom
 			keyList = append(keyList, k)
 		}
 		newCounterVec := newCounterVec(counterName, reporter.namespace, keyList)
-		_ = prometheus.DefaultRegisterer.Register(newCounterVec)
+		_ = prom.DefaultRegisterer.Register(newCounterVec)
 		reporter.userCounterVec.Store(counterName, newCounterVec)
 		newCounterVec.With(labelMap).Inc()
 	} else {
@@ -312,7 +313,7 @@ func (reporter *PrometheusReporter) incSummary(summaryName string, toSetValue fl
 		// summary
 		if val, exist := reporter.userSummary.Load(summaryName); !exist {
 			newSummary := newSummary(summaryName, reporter.namespace)
-			_ = prometheus.DefaultRegisterer.Register(newSummary)
+			_ = prom.DefaultRegisterer.Register(newSummary)
 			reporter.userSummary.Store(summaryName, newSummary)
 			newSummary.Observe(toSetValue)
 		} else {
@@ -328,7 +329,7 @@ func (reporter *PrometheusReporter) incSummary(summaryName string, toSetValue fl
 			keyList = append(keyList, k)
 		}
 		newSummaryVec := newSummaryVec(summaryName, reporter.namespace, keyList)
-		_ = prometheus.DefaultRegisterer.Register(newSummaryVec)
+		_ = prom.DefaultRegisterer.Register(newSummaryVec)
 		reporter.userSummaryVec.Store(summaryName, newSummaryVec)
 		newSummaryVec.With(labelMap).Observe(toSetValue)
 	} else {