github.com/kaituanwang/hyperledger@v2.0.1+incompatible/common/metrics/disabled/provider.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package disabled
     8  
     9  import (
    10  	"github.com/hyperledger/fabric/common/metrics"
    11  )
    12  
    13  type Provider struct{}
    14  
    15  func (p *Provider) NewCounter(o metrics.CounterOpts) metrics.Counter       { return &Counter{} }
    16  func (p *Provider) NewGauge(o metrics.GaugeOpts) metrics.Gauge             { return &Gauge{} }
    17  func (p *Provider) NewHistogram(o metrics.HistogramOpts) metrics.Histogram { return &Histogram{} }
    18  
    19  type Counter struct{}
    20  
    21  func (c *Counter) Add(delta float64) {}
    22  func (c *Counter) With(labelValues ...string) metrics.Counter {
    23  	return c
    24  }
    25  
    26  type Gauge struct{}
    27  
    28  func (g *Gauge) Add(delta float64) {}
    29  func (g *Gauge) Set(delta float64) {}
    30  func (g *Gauge) With(labelValues ...string) metrics.Gauge {
    31  	return g
    32  }
    33  
    34  type Histogram struct{}
    35  
    36  func (h *Histogram) Observe(value float64) {}
    37  func (h *Histogram) With(labelValues ...string) metrics.Histogram {
    38  	return h
    39  }