github.com/tsuna/gohbase@v0.0.0-20250731002811-4ffcadfba63e/prometheus.go (about)

     1  // Copyright (C) 2021  The GoHBase Authors.  All rights reserved.
     2  // This file is part of GoHBase.
     3  // Use of this source code is governed by the Apache License 2.0
     4  // that can be found in the COPYING file.
     5  
     6  package gohbase
     7  
     8  import (
     9  	"github.com/prometheus/client_golang/prometheus"
    10  	"github.com/prometheus/client_golang/prometheus/promauto"
    11  )
    12  
    13  var (
    14  	operationDurationSeconds = promauto.NewHistogramVec(
    15  		prometheus.HistogramOpts{
    16  			Namespace: "gohbase",
    17  			Name:      "operation_duration_seconds",
    18  			Help:      "Time in seconds for operation to complete",
    19  			// 1.25ms, 2.5ms, 5ms, 10ms, 20ms, 40ms, ..., 1.28s, ... 20.48s, 40.96s
    20  			Buckets: prometheus.ExponentialBuckets(0.00125, 2, 16),
    21  		},
    22  		[]string{"operation", "result"},
    23  	)
    24  
    25  	sendBatchSplitCount = promauto.NewHistogram(
    26  		prometheus.HistogramOpts{
    27  			Namespace: "gohbase",
    28  			Name:      "sendbatch_split_count",
    29  			Help:      "Count of Region Servers hit per SendBatch",
    30  			// 1, 2, 4, 8, 16, 32, 64, 128, 256, 512
    31  			Buckets: prometheus.ExponentialBuckets(1, 2, 10),
    32  		},
    33  	)
    34  
    35  	cachedRegionTotal = promauto.NewGauge(prometheus.GaugeOpts{
    36  		Namespace: "gohbase",
    37  		Subsystem: "cache",
    38  		Name:      "regions_total",
    39  		Help:      "Total number of regions in the cache",
    40  	})
    41  
    42  	retryBackoffDuration = promauto.NewHistogram(prometheus.HistogramOpts{
    43  		Namespace: "gohbase",
    44  		Subsystem: "retry",
    45  		Name:      "backoff_duration_seconds",
    46  		Help:      "Time spend sleeping in retry backoff",
    47  		// Buckets match the exact backoff time generated by the sleepAndIncreaseBackoff function
    48  		Buckets: []float64{
    49  			0.016, 0.032, 0.064, 0.128, 0.256, 0.512, 1.024, 2.048,
    50  			4.096, 8.192, 13.192, 18.192, 23.192, 28.192, 33.192,
    51  		},
    52  	})
    53  
    54  	scanRenewers = promauto.NewGauge(prometheus.GaugeOpts{
    55  		Namespace: "gohbase",
    56  		Subsystem: "scanner",
    57  		Name:      "renewer_count",
    58  		Help: "Number of active scanner renewers. " +
    59  			"A continually increasing value indicates an Scanner leak.",
    60  	})
    61  )