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

tools: use metrics to record statistics #5673

Merged
merged 3 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tools/pd-simulator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ EXIT:
}

fmt.Printf("%s [%s] total iteration: %d, time cost: %v\n", simResult, simCase, driver.TickCount(), time.Since(start))
driver.PrintStatistics()
if analysis.GetTransferCounter().IsValid {
analysis.GetTransferCounter().PrintResult()
}
Expand Down
5 changes: 0 additions & 5 deletions tools/pd-simulator/simulator/drive.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@ func (d *Driver) Check() bool {
return d.simCase.Checker(d.raftEngine.regionsInfo, stats)
}

// PrintStatistics prints the statistics of the scheduler.
func (d *Driver) PrintStatistics() {
d.raftEngine.schedulerStats.PrintStatistics()
}

// Start starts all nodes.
func (d *Driver) Start() error {
for _, n := range d.conn.Nodes {
Expand Down
18 changes: 18 additions & 0 deletions tools/pd-simulator/simulator/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,26 @@ var (
Help: "Bucketed histogram of processing time (s) of handled snap requests.",
Buckets: prometheus.ExponentialBuckets(0.0005, 2, 20),
}, []string{"store", "type"})

schedulingCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: "pd",
Subsystem: "schedule",
Name: "scheduling_count",
Help: "Counter of region scheduling",
}, []string{"type"})

snapshotCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: "pd",
Subsystem: "schedule",
Name: "snapshot_count",
Help: "Counter of region snapshot",
}, []string{"store", "type"})
)

func init() {
prometheus.MustRegister(snapDuration)
bufferflies marked this conversation as resolved.
Show resolved Hide resolved
prometheus.MustRegister(schedulingCounter)
prometheus.MustRegister(snapshotCounter)
}
2 changes: 0 additions & 2 deletions tools/pd-simulator/simulator/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type RaftEngine struct {
regionsInfo *core.RegionsInfo
conn *Connection
regionChange map[uint64][]uint64
schedulerStats *schedulerStatistics
regionSplitSize int64
regionSplitKeys int64
storeConfig *SimConfig
Expand All @@ -45,7 +44,6 @@ func NewRaftEngine(conf *cases.Case, conn *Connection, storeConfig *SimConfig) *
regionsInfo: core.NewRegionsInfo(),
conn: conn,
regionChange: make(map[uint64][]uint64),
schedulerStats: newSchedulerStatistics(),
regionSplitSize: conf.RegionSplitSize,
regionSplitKeys: conf.RegionSplitKeys,
storeConfig: storeConfig,
Expand Down
219 changes: 0 additions & 219 deletions tools/pd-simulator/simulator/statistics.go

This file was deleted.

Loading