github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/engine/pkg/promutil/factory.go (about)

     1  // Copyright 2022 PingCAP, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  package promutil
    15  
    16  import "github.com/prometheus/client_golang/prometheus"
    17  
    18  // Factory is the interface to create some native prometheus metric
    19  type Factory interface {
    20  	// NewCounter works like the function of the same name in the prometheus
    21  	// package.
    22  	NewCounter(opts prometheus.CounterOpts) prometheus.Counter
    23  
    24  	// NewCounterVec works like the function of the same name in the
    25  	// prometheus package.
    26  	NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
    27  
    28  	// NewGauge works like the function of the same name in the prometheus
    29  	// package.
    30  	NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
    31  
    32  	// NewGaugeVec works like the function of the same name in the prometheus
    33  	// package.
    34  	NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
    35  
    36  	// NewHistogram works like the function of the same name in the prometheus
    37  	// package.
    38  	NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
    39  
    40  	// NewHistogramVec works like the function of the same name in the
    41  	// prometheus package.
    42  	NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
    43  }