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

server: add tso handle time metrics #1502

Merged
merged 1 commit into from
Apr 12, 2019
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
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)
}