OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / go-kit / kit / metrics / provider / influx.go
1 package provider
2
3 import (
4         "github.com/go-kit/kit/metrics"
5         "github.com/go-kit/kit/metrics/influx"
6 )
7
8 type influxProvider struct {
9         in   *influx.Influx
10         stop func()
11 }
12
13 // NewInfluxProvider takes the given Influx object and stop func, and returns
14 // a Provider that produces Influx metrics.
15 func NewInfluxProvider(in *influx.Influx, stop func()) Provider {
16         return &influxProvider{
17                 in:   in,
18                 stop: stop,
19         }
20 }
21
22 // NewCounter implements Provider. Per-metric tags are not supported.
23 func (p *influxProvider) NewCounter(name string) metrics.Counter {
24         return p.in.NewCounter(name)
25 }
26
27 // NewGauge implements Provider. Per-metric tags are not supported.
28 func (p *influxProvider) NewGauge(name string) metrics.Gauge {
29         return p.in.NewGauge(name)
30 }
31
32 // NewHistogram implements Provider. Per-metric tags are not supported.
33 func (p *influxProvider) NewHistogram(name string, buckets int) metrics.Histogram {
34         return p.in.NewHistogram(name)
35 }
36
37 // Stop implements Provider, invoking the stop function passed at construction.
38 func (p *influxProvider) Stop() {
39         p.stop()
40 }