Skip to content

Commit

Permalink
add monitor
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Dec 12, 2022
1 parent 1f13a24 commit 48706ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion metrics/grafana/pd.json
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@
"intervalFactor": 2,
"legendFormat": "{{type}}",
"refId": "B"
},
}
],
"thresholds": [
{
Expand Down
1 change: 1 addition & 0 deletions server/cluster/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ func (c *coordinator) collectRegionStats() {
case <-timer.C:
}
}
collectRegionStatsGauge.Set(time.Since(start).Seconds())
start = time.Now()
}
}
Expand Down
9 changes: 9 additions & 0 deletions server/cluster/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ var (
Help: "Time spent of patrol checks region.",
})

collectRegionStatsGauge = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "pd",
Subsystem: "statistics",
Name: "collect_region_stats_time",
Help: "Time spent of collecting region stats.",
})

updateStoreStatsGauge = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "pd",
Expand Down Expand Up @@ -152,4 +160,5 @@ func init() {
prometheus.MustRegister(storesETAGauge)
prometheus.MustRegister(storeSyncConfigEvent)
prometheus.MustRegister(updateStoreStatsGauge)
prometheus.MustRegister(collectRegionStatsGauge)
}

0 comments on commit 48706ab

Please sign in to comment.