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

liujun pushed a commit to branch release-3.1
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/release-3.1 by this push:
     new a4d9d0adc fix metrics path ref error (#2553)
a4d9d0adc is described below

commit a4d9d0adc71cfb03b31512702bc1fd4ffb67e8f7
Author: foghost <[email protected]>
AuthorDate: Wed Jan 3 10:12:35 2024 +0800

    fix metrics path ref error (#2553)
---
 metrics/prometheus/registry.go      | 2 +-
 metrics/prometheus/registry_test.go | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/metrics/prometheus/registry.go b/metrics/prometheus/registry.go
index d108f8f9f..aed5b4f43 100644
--- a/metrics/prometheus/registry.go
+++ b/metrics/prometheus/registry.go
@@ -152,7 +152,7 @@ func (p *promMetricRegistry) Export() {
 
 func (p *promMetricRegistry) exportHttp() {
        mux := http.NewServeMux()
-       path := p.url.GetParam(constant.PrometheusDefaultMetricsPath, 
constant.PrometheusDefaultMetricsPath)
+       path := p.url.GetParam(constant.PrometheusExporterMetricsPathKey, 
constant.PrometheusDefaultMetricsPath)
        port := p.url.GetParam(constant.PrometheusExporterMetricsPortKey, 
constant.PrometheusDefaultMetricsPort)
        mux.Handle(path, promhttp.InstrumentMetricHandler(p.r, 
promhttp.HandlerFor(p.gather, promhttp.HandlerOpts{})))
        srv := &http.Server{Addr: ":" + port, Handler: mux}
diff --git a/metrics/prometheus/registry_test.go 
b/metrics/prometheus/registry_test.go
index a3e5e6636..525b7c35b 100644
--- a/metrics/prometheus/registry_test.go
+++ b/metrics/prometheus/registry_test.go
@@ -43,8 +43,8 @@ var (
        url      = common.NewURLWithOptions(
                common.WithProtocol(constant.ProtocolPrometheus),
                common.WithParamsValue(constant.PrometheusExporterEnabledKey, 
"true"),
-               
common.WithParamsValue(constant.PrometheusExporterMetricsPortKey, 
constant.PrometheusDefaultMetricsPort),
-               
common.WithParamsValue(constant.PrometheusExporterMetricsPathKey, 
constant.PrometheusDefaultMetricsPath),
+               
common.WithParamsValue(constant.PrometheusExporterMetricsPortKey, "9999"),
+               
common.WithParamsValue(constant.PrometheusExporterMetricsPathKey, 
"/prometheus"),
                common.WithParamsValue(constant.ApplicationKey, "dubbo"),
                common.WithParamsValue(constant.AppVersionKey, "1.0.0"),
                
common.WithParamsValue(constant.PrometheusPushgatewayEnabledKey, "true"),

Reply via email to