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

statistics: show stores of peers in pd-ctl output #5330

Merged
merged 6 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions server/statistics/hot_peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,12 @@ func (stat *HotPeerStat) getIntervalSum() time.Duration {
}
return stat.rollingLoads[0].lastAverage.GetIntervalSum()
}

// GetStores returns stores of the item.
func (stat *HotPeerStat) GetStores() []uint64{
stores:=[]uint64{}
for _, peer := range stat.peers {
stores = append(stores, peer.StoreId)
}
return stores
}
1 change: 1 addition & 0 deletions server/statistics/hot_regions_stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type HotPeersStat struct {
// HotPeerStatShow records the hot region statistics for output
type HotPeerStatShow struct {
StoreID uint64 `json:"store_id"`
Stores []uint64 `json:"stores"`
RegionID uint64 `json:"region_id"`
HotDegree int `json:"hot_degree"`
ByteRate float64 `json:"flow_bytes"`
Expand Down
1 change: 1 addition & 0 deletions server/statistics/store_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func toHotPeerStatShow(p *HotPeerStat, kind RWType) HotPeerStatShow {
queryRate := p.Loads[q]
return HotPeerStatShow{
StoreID: p.StoreID,
Stores: p.GetStores(),
RegionID: p.RegionID,
HotDegree: p.HotDegree,
ByteRate: byteRate,
Expand Down