File: discard.go

package info (click to toggle)
golang-github-go-kit-kit 0.13.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,784 kB
  • sloc: sh: 22; makefile: 11
file content (40 lines) | stat: -rw-r--r-- 1,064 bytes parent folder | download | duplicates (5)
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
// Package discard provides a no-op metrics backend.
package discard

import "github.com/go-kit/kit/metrics"

type counter struct{}

// NewCounter returns a new no-op counter.
func NewCounter() metrics.Counter { return counter{} }

// With implements Counter.
func (c counter) With(labelValues ...string) metrics.Counter { return c }

// Add implements Counter.
func (c counter) Add(delta float64) {}

type gauge struct{}

// NewGauge returns a new no-op gauge.
func NewGauge() metrics.Gauge { return gauge{} }

// With implements Gauge.
func (g gauge) With(labelValues ...string) metrics.Gauge { return g }

// Set implements Gauge.
func (g gauge) Set(value float64) {}

// Add implements metrics.Gauge.
func (g gauge) Add(delta float64) {}

type histogram struct{}

// NewHistogram returns a new no-op histogram.
func NewHistogram() metrics.Histogram { return histogram{} }

// With implements Histogram.
func (h histogram) With(labelValues ...string) metrics.Histogram { return h }

// Observe implements histogram.
func (h histogram) Observe(value float64) {}