github.com/Jeffail/benthos/v3@v3.65.0/internal/component/metrics/vector_util.go (about)

     1  package metrics
     2  
     3  import "github.com/Jeffail/benthos/v3/lib/metrics"
     4  
     5  type fCounterVec struct {
     6  	f func([]string) metrics.StatCounter
     7  }
     8  
     9  func (f *fCounterVec) With(labels ...string) metrics.StatCounter {
    10  	return f.f(labels)
    11  }
    12  
    13  func fakeCounterVec(f func([]string) metrics.StatCounter) metrics.StatCounterVec {
    14  	return &fCounterVec{
    15  		f: f,
    16  	}
    17  }
    18  
    19  //------------------------------------------------------------------------------
    20  
    21  type fTimerVec struct {
    22  	f func([]string) metrics.StatTimer
    23  }
    24  
    25  func (f *fTimerVec) With(labels ...string) metrics.StatTimer {
    26  	return f.f(labels)
    27  }
    28  
    29  func fakeTimerVec(f func([]string) metrics.StatTimer) metrics.StatTimerVec {
    30  	return &fTimerVec{
    31  		f: f,
    32  	}
    33  }
    34  
    35  //------------------------------------------------------------------------------
    36  
    37  type fGaugeVec struct {
    38  	f func([]string) metrics.StatGauge
    39  }
    40  
    41  func (f *fGaugeVec) With(labels ...string) metrics.StatGauge {
    42  	return f.f(labels)
    43  }
    44  
    45  func fakeGaugeVec(f func([]string) metrics.StatGauge) metrics.StatGaugeVec {
    46  	return &fGaugeVec{
    47  		f: f,
    48  	}
    49  }