Skip to content

Commit

Permalink
fix metrics path ref error (apache#2553)
Browse files Browse the repository at this point in the history
  • Loading branch information
FoghostCn authored and FinalT committed Jan 10, 2024
1 parent 4f21a41 commit b91c85e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion metrics/prometheus/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions metrics/prometheus/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit b91c85e

Please sign in to comment.