File: influx.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,063 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 provider

import (
	"github.com/go-kit/kit/metrics"
	"github.com/go-kit/kit/metrics/influx"
)

type influxProvider struct {
	in   *influx.Influx
	stop func()
}

// NewInfluxProvider takes the given Influx object and stop func, and returns
// a Provider that produces Influx metrics.
func NewInfluxProvider(in *influx.Influx, stop func()) Provider {
	return &influxProvider{
		in:   in,
		stop: stop,
	}
}

// NewCounter implements Provider. Per-metric tags are not supported.
func (p *influxProvider) NewCounter(name string) metrics.Counter {
	return p.in.NewCounter(name)
}

// NewGauge implements Provider. Per-metric tags are not supported.
func (p *influxProvider) NewGauge(name string) metrics.Gauge {
	return p.in.NewGauge(name)
}

// NewHistogram implements Provider. Per-metric tags are not supported.
func (p *influxProvider) NewHistogram(name string, buckets int) metrics.Histogram {
	return p.in.NewHistogram(name)
}

// Stop implements Provider, invoking the stop function passed at construction.
func (p *influxProvider) Stop() {
	p.stop()
}