Skip to content

Commit

Permalink
SendBatch: Add histogram metric for RegionServers per Batch
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbee committed Sep 14, 2023
1 parent 0480073 commit a67f669
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
36 changes: 24 additions & 12 deletions prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,28 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
)

var operationDurationSeconds = promauto.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "gohbase",
Name: "operation_duration_seconds",
Help: "Time in seconds for operation to complete",
// >>> [0.04*(2**i) for i in range(11)]
// [0.04, 0.08, 0.16, 0.32, 0.64, 1.28, 2.56, 5.12, 10.24, 20.48, 40.96]
// Meaning 40ms, 80ms, 160ms, 320ms, 640ms, 1.28s, ... max 40.96s
// (most requests have a 30s timeout by default at the Envoy level)
Buckets: prometheus.ExponentialBuckets(0.04, 2, 11),
},
[]string{"operation", "result"},
var (
operationDurationSeconds = promauto.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "gohbase",
Name: "operation_duration_seconds",
Help: "Time in seconds for operation to complete",
// >>> [0.04*(2**i) for i in range(11)]
// [0.04, 0.08, 0.16, 0.32, 0.64, 1.28, 2.56, 5.12, 10.24, 20.48, 40.96]
// Meaning 40ms, 80ms, 160ms, 320ms, 640ms, 1.28s, ... max 40.96s
// (most requests have a 30s timeout by default at the Envoy level)
Buckets: prometheus.ExponentialBuckets(0.04, 2, 11),
},
[]string{"operation", "result"},
)

sendBatchSplitCount = promauto.NewHistogram(
prometheus.HistogramOpts{
Namespace: "gohbase",
Name: "sendbatch_split_count",
Help: "Count of Region Servers hit per SendBatch",
// 1, 2, 4, 8, 16, 32, 64, 128, 256, 512
Buckets: prometheus.ExponentialBuckets(1, 2, 10),
},
)
)
1 change: 1 addition & 0 deletions rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func (c *client) SendBatch(ctx context.Context, batch []hrpc.Call) (
if !ok {
return res, false
}
sendBatchSplitCount.Observe(float64(len(rpcByClient)))

// Send each group of RPCs to region client to be executed.
type clientAndRPCs struct {
Expand Down

0 comments on commit a67f669

Please sign in to comment.