-
Notifications
You must be signed in to change notification settings - Fork 213
/
prometheus.go
56 lines (50 loc) · 1.83 KB
/
prometheus.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (C) 2021 The GoHBase Authors. All rights reserved.
// This file is part of GoHBase.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
package gohbase
import (
"github.com/prometheus/client_golang/prometheus"
"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"},
)
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),
},
)
cachedRegionTotal = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "gohbase",
Subsystem: "cache",
Name: "regions_total",
Help: "Total number of regions in the cache",
})
retryBackoffDuration = promauto.NewHistogram(prometheus.HistogramOpts{
Namespace: "gohbase",
Subsystem: "retry",
Name: "backoff_duration_seconds",
Help: "Time spend sleeping in retry backoff",
// Buckets match the exact backoff time generated by the sleepAndIncreaseBackoff function
Buckets: []float64{
0.016, 0.032, 0.064, 0.128, 0.256, 0.512, 1.024, 2.048,
4.096, 8.192, 13.192, 18.192, 23.192, 28.192, 33.192,
},
})
)