Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(collector): fix the problem that prometheus cannot display the indicators collected by collector #1851

Merged
merged 11 commits into from
Jan 15, 2024
10 changes: 10 additions & 0 deletions collector/webui/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@ import (
"context"
"time"

"github.com/apache/incubator-pegasus/collector/metrics"
"github.com/kataras/iris/v12"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)

// StartWebServer starts an iris-powered HTTP server.
func StartWebServer() {
registry := prometheus.NewRegistry()
for _, cV := range metrics.CounterMetricsMap {
registry.MustRegister(cV)
}
for _, gV := range metrics.GaugeMetricsMap {
registry.MustRegister(gV)
}

app := iris.New()
app.Get("/", indexHandler)
app.Get("/tables", tablesHandler)
Expand Down
Loading