Skip to content

Commit

Permalink
metrics(*): fix for promtheus_client breaking change (#5643) (#5653)
Browse files Browse the repository at this point in the history
close #5494
  • Loading branch information
ti-chi-bot authored Aug 18, 2022
1 parent 6056246 commit 7faae9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cdc/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ import (
"github.com/pingcap/tiflow/pkg/orchestrator"
"github.com/pingcap/tiflow/pkg/p2p"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
tikvmetrics "github.com/tikv/client-go/v2/metrics"
)

var registry = prometheus.NewRegistry()

func init() {
registry.MustRegister(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}))
registry.MustRegister(prometheus.NewGoCollector())
registry.MustRegister(prometheus.NewGoCollector(
collectors.WithGoCollections(collectors.GoRuntimeMemStatsCollection | collectors.GoRuntimeMetricsCollection)))

kv.InitMetrics(registry)
puller.InitMetrics(registry)
Expand Down
4 changes: 3 additions & 1 deletion dm/dm/worker/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

cpu "github.com/pingcap/tidb-tools/pkg/utils"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promhttp"

"github.com/pingcap/tiflow/dm/dm/common"
Expand Down Expand Up @@ -104,7 +105,8 @@ func (s *Server) runBackgroundJob(ctx context.Context) {
func RegistryMetrics() {
registry := prometheus.NewRegistry()
registry.MustRegister(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}))
registry.MustRegister(prometheus.NewGoCollector())
registry.MustRegister(prometheus.NewGoCollector(
collectors.WithGoCollections(collectors.GoRuntimeMemStatsCollection | collectors.GoRuntimeMetricsCollection)))

registry.MustRegister(cpuUsageGauge)

Expand Down

0 comments on commit 7faae9f

Please sign in to comment.