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

metrics: use second as the unit of latency #8367

Merged
merged 2 commits into from
Jul 8, 2024
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: 1 addition & 1 deletion client/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func initMetrics(constLabels prometheus.Labels) {
Subsystem: "request",
Name: "tso_batch_send_latency",
ConstLabels: constLabels,
Buckets: prometheus.ExponentialBuckets(1, 2, 34), // 1ns ~ 8s
Buckets: prometheus.ExponentialBuckets(0.0005, 2, 13),
Help: "tso batch send latency",
})

Expand Down
4 changes: 2 additions & 2 deletions client/tso_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (s *pdTSOStream) processRequests(
}
return
}
tsoBatchSendLatency.Observe(float64(time.Since(batchStartTime)))
tsoBatchSendLatency.Observe(time.Since(batchStartTime).Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the time delta is less than 1 second, will we got zero as the value of Observe?Is it expected?

resp, err := s.stream.Recv()
if err != nil {
if err == io.EOF {
Expand Down Expand Up @@ -195,7 +195,7 @@ func (s *tsoTSOStream) processRequests(
}
return
}
tsoBatchSendLatency.Observe(float64(time.Since(batchStartTime)))
tsoBatchSendLatency.Observe(time.Since(batchStartTime).Seconds())
resp, err := s.stream.Recv()
if err != nil {
if err == io.EOF {
Expand Down
2 changes: 1 addition & 1 deletion server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var (
Subsystem: "scheduler",
Name: "region_heartbeat_latency_seconds",
Help: "Bucketed histogram of latency (s) of receiving heartbeat.",
Buckets: prometheus.ExponentialBuckets(1, 2, 12),
Buckets: prometheus.ExponentialBuckets(0.0005, 2, 13),
}, []string{"address", "store"})

metadataGauge = prometheus.NewGaugeVec(
Expand Down