diff --git a/go.mod b/go.mod index d0de820..db81def 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.16 require ( github.com/VictoriaMetrics/metrics v1.18.0 - go.unistack.org/micro/v3 v3.8.7 + go.unistack.org/micro/v3 v3.8.6 ) diff --git a/go.sum b/go.sum index f5d6302..6a2745a 100644 --- a/go.sum +++ b/go.sum @@ -15,8 +15,8 @@ github.com/valyala/histogram v1.2.0 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OL github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY= go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA= go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8= -go.unistack.org/micro/v3 v3.8.7 h1:k1zOpJ3uS8MxdhK8annRsa5J/LW7MpqPjwYuekW61wE= -go.unistack.org/micro/v3 v3.8.7/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= +go.unistack.org/micro/v3 v3.8.6 h1:nU6dpNRF7iF8dtcTTfzdPan8RkhiDuTsfMrXBmpzG/g= +go.unistack.org/micro/v3 v3.8.6/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/victoriametrics.go b/victoriametrics.go index 2884056..6f6294b 100644 --- a/victoriametrics.go +++ b/victoriametrics.go @@ -47,10 +47,10 @@ func (r *victoriametricsMeter) buildName(name string, labels ...string) string { return meter.BuildName(name, nlabels...) } - for idx := 0; idx <= len(nlabels)/2; idx += 2 { + for idx := 0; idx < nl; idx++ { nlabels[idx] = r.opts.LabelPrefix + nlabels[idx] + idx++ } - return meter.BuildName(name, nlabels...) } diff --git a/victoriametrics_test.go b/victoriametrics_test.go index b5c5b82..7851516 100644 --- a/victoriametrics_test.go +++ b/victoriametrics_test.go @@ -14,8 +14,8 @@ import ( func TestBuildName(t *testing.T) { m := NewMeter() im := m.(*victoriametricsMeter) - check := `micro_foo{micro_aaa="b",micro_bar="baz"}` - name := im.buildName("foo", "bar", "baz", "aaa", "b") + check := `micro_foo{micro_aaa="b",micro_bar="baz",micro_ccc="d"}` + name := im.buildName("foo", "bar", "baz", "aaa", "b", "ccc", "d") if name != check { t.Fatalf("metric name error: %s != %s", name, check) }