Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit a91adcb

Browse files
committed
register / remove metrics of dumpling
1 parent 5f55bf3 commit a91adcb

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

dumpling/dumpling.go

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"strings"
2121
"time"
2222

23+
"github.com/prometheus/client_golang/prometheus"
24+
2325
"github.com/pingcap/dm/dm/config"
2426
"github.com/pingcap/dm/dm/pb"
2527
"github.com/pingcap/dm/dm/unit"
@@ -219,6 +221,7 @@ func (m *Dumpling) constructArgs() (*export.Config, error) {
219221
dumpConfig.CompleteInsert = true // always keep column name in `INSERT INTO` statements.
220222
dumpConfig.Logger = m.logger.Logger
221223
dumpConfig.NoViews = false
224+
dumpConfig.Labels = prometheus.Labels{"task": cfg.Name}
222225

223226
if cfg.Threads > 0 {
224227
dumpConfig.Threads = cfg.Threads

dumpling/metrics.go

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package dumpling
1515

1616
import (
17+
"github.com/pingcap/dumpling/v4/export"
1718
"github.com/prometheus/client_golang/prometheus"
1819

1920
"github.com/pingcap/dm/pkg/metricsproxy"
@@ -33,8 +34,10 @@ var (
3334
// RegisterMetrics registers metrics.
3435
func RegisterMetrics(registry *prometheus.Registry) {
3536
registry.MustRegister(dumplingExitWithErrorCounter)
37+
export.RegisterMetrics(registry)
3638
}
3739

3840
func (m *Dumpling) removeLabelValuesWithTaskInMetrics(task string) {
3941
dumplingExitWithErrorCounter.DeleteAllAboutLabels(prometheus.Labels{"task": task})
42+
export.RemoveLabelValuesWithTaskInMetrics(prometheus.Labels{"task": task})
4043
}

0 commit comments

Comments
 (0)