glide up
This commit is contained in:
4
vendor/github.com/go-kit/kit/metrics/influx/example_test.go
generated
vendored
4
vendor/github.com/go-kit/kit/metrics/influx/example_test.go
generated
vendored
@@ -44,14 +44,11 @@ func ExampleGauge() {
|
||||
gauge.With("error", "true").Set(1)
|
||||
gauge.With("error", "false").Set(2)
|
||||
gauge.Set(50)
|
||||
gauge.With("test", "true").Set(1)
|
||||
gauge.With("test", "true").Add(1)
|
||||
|
||||
client := &bufWriter{}
|
||||
in.WriteTo(client)
|
||||
|
||||
expectedLines := []string{
|
||||
`(influx_gauge,a=b,test=true value=2) [0-9]{19}`,
|
||||
`(influx_gauge,a=b value=50) [0-9]{19}`,
|
||||
`(influx_gauge,a=b,error=true value=1) [0-9]{19}`,
|
||||
`(influx_gauge,a=b,error=false value=2) [0-9]{19}`,
|
||||
@@ -62,7 +59,6 @@ func ExampleGauge() {
|
||||
}
|
||||
|
||||
// Output:
|
||||
// influx_gauge,a=b,test=true value=2
|
||||
// influx_gauge,a=b value=50
|
||||
// influx_gauge,a=b,error=true value=1
|
||||
// influx_gauge,a=b,error=false value=2
|
||||
|
16
vendor/github.com/go-kit/kit/metrics/influx/influx.go
generated
vendored
16
vendor/github.com/go-kit/kit/metrics/influx/influx.go
generated
vendored
@@ -66,7 +66,6 @@ func (in *Influx) NewGauge(name string) *Gauge {
|
||||
return &Gauge{
|
||||
name: name,
|
||||
obs: in.gauges.Observe,
|
||||
add: in.gauges.Add,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,14 +168,10 @@ func mergeTags(tags map[string]string, labelValues []string) map[string]string {
|
||||
if len(labelValues)%2 != 0 {
|
||||
panic("mergeTags received a labelValues with an odd number of strings")
|
||||
}
|
||||
ret := make(map[string]string, len(tags)+len(labelValues)/2)
|
||||
for k, v := range tags {
|
||||
ret[k] = v
|
||||
}
|
||||
for i := 0; i < len(labelValues); i += 2 {
|
||||
ret[labelValues[i]] = labelValues[i+1]
|
||||
tags[labelValues[i]] = labelValues[i+1]
|
||||
}
|
||||
return ret
|
||||
return tags
|
||||
}
|
||||
|
||||
func sum(a []float64) float64 {
|
||||
@@ -221,7 +216,6 @@ type Gauge struct {
|
||||
name string
|
||||
lvs lv.LabelValues
|
||||
obs observeFunc
|
||||
add observeFunc
|
||||
}
|
||||
|
||||
// With implements metrics.Gauge.
|
||||
@@ -230,7 +224,6 @@ func (g *Gauge) With(labelValues ...string) metrics.Gauge {
|
||||
name: g.name,
|
||||
lvs: g.lvs.With(labelValues...),
|
||||
obs: g.obs,
|
||||
add: g.add,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,11 +232,6 @@ func (g *Gauge) Set(value float64) {
|
||||
g.obs(g.name, g.lvs, value)
|
||||
}
|
||||
|
||||
// Add implements metrics.Gauge.
|
||||
func (g *Gauge) Add(delta float64) {
|
||||
g.add(g.name, g.lvs, delta)
|
||||
}
|
||||
|
||||
// Histogram is an Influx histrogram. Observations are aggregated into a
|
||||
// generic.Histogram and emitted as per-quantile gauges to the Influx server.
|
||||
type Histogram struct {
|
||||
|
31
vendor/github.com/go-kit/kit/metrics/influx/influx_test.go
generated
vendored
31
vendor/github.com/go-kit/kit/metrics/influx/influx_test.go
generated
vendored
@@ -82,37 +82,6 @@ func TestHistogramLabels(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssue404(t *testing.T) {
|
||||
in := New(map[string]string{}, influxdb.BatchPointsConfig{}, log.NewNopLogger())
|
||||
|
||||
counterOne := in.NewCounter("influx_counter_one").With("a", "b")
|
||||
counterOne.Add(123)
|
||||
|
||||
counterTwo := in.NewCounter("influx_counter_two").With("c", "d")
|
||||
counterTwo.Add(456)
|
||||
|
||||
w := &bufWriter{}
|
||||
in.WriteTo(w)
|
||||
|
||||
lines := strings.Split(strings.TrimSpace(w.buf.String()), "\n")
|
||||
if want, have := 2, len(lines); want != have {
|
||||
t.Fatalf("want %d, have %d", want, have)
|
||||
}
|
||||
for _, line := range lines {
|
||||
if strings.HasPrefix(line, "influx_counter_one") {
|
||||
if !strings.HasPrefix(line, "influx_counter_one,a=b count=123 ") {
|
||||
t.Errorf("invalid influx_counter_one: %s", line)
|
||||
}
|
||||
} else if strings.HasPrefix(line, "influx_counter_two") {
|
||||
if !strings.HasPrefix(line, "influx_counter_two,c=d count=456 ") {
|
||||
t.Errorf("invalid influx_counter_two: %s", line)
|
||||
}
|
||||
} else {
|
||||
t.Errorf("unexpected line: %s", line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type bufWriter struct {
|
||||
buf bytes.Buffer
|
||||
}
|
||||
|
Reference in New Issue
Block a user