Skip to content

Commit

Permalink
Merge branch 'master' into support-scatter
Browse files Browse the repository at this point in the history
  • Loading branch information
nolouch authored Apr 15, 2019
2 parents 8f8de63 + 656a830 commit 2193d10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func (s *Server) Tso(stream pdpb.PD_TsoServer) error {
if err != nil {
return errors.WithStack(err)
}
start := time.Now()
if err = s.validateRequest(request.GetHeader()); err != nil {
return err
}
Expand All @@ -89,6 +90,7 @@ func (s *Server) Tso(stream pdpb.PD_TsoServer) error {
if err := stream.Send(response); err != nil {
return errors.WithStack(err)
}
tsoHandleDuration.Observe(time.Since(start).Seconds())
}
}

Expand Down
10 changes: 10 additions & 0 deletions server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ var (
Name: "status",
Help: "Status of the scheduling configurations.",
}, []string{"type", "namespace"})

tsoHandleDuration = prometheus.NewHistogram(
prometheus.HistogramOpts{
Namespace: "pd",
Subsystem: "server",
Name: "handle_tso_duration_seconds",
Help: "Bucketed histogram of processing time (s) of handled tso requests.",
Buckets: prometheus.ExponentialBuckets(0.0005, 2, 13),
})
)

func init() {
Expand All @@ -182,4 +191,5 @@ func init() {
prometheus.MustRegister(patrolCheckRegionsHistogram)
prometheus.MustRegister(placementStatusGauge)
prometheus.MustRegister(configStatusGauge)
prometheus.MustRegister(tsoHandleDuration)
}

0 comments on commit 2193d10

Please sign in to comment.