From 616b762696573da7a1d546dbc22d7fc310db4b6d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Aug 2025 11:15:36 +0000 Subject: [PATCH 1/8] Bump github.com/VictoriaMetrics/metrics from 1.38.0 to 1.39.1 Bumps [github.com/VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) from 1.38.0 to 1.39.1. - [Commits](https://github.com/VictoriaMetrics/metrics/compare/v1.38.0...v1.39.1) --- updated-dependencies: - dependency-name: github.com/VictoriaMetrics/metrics dependency-version: 1.39.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c00fca0..c994ff9 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23.0 toolchain go1.24.4 require ( - github.com/VictoriaMetrics/metrics v1.38.0 + github.com/VictoriaMetrics/metrics v1.39.1 go.unistack.org/micro/v4 v4.1.19 ) diff --git a/go.sum b/go.sum index cee7bc5..30b539b 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/VictoriaMetrics/metrics v1.38.0 h1:1d0dRgVH8Nnu8dKMfisKefPC3q7gqf3/odyO0quAvyA= -github.com/VictoriaMetrics/metrics v1.38.0/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8= +github.com/VictoriaMetrics/metrics v1.39.1 h1:AT7jz7oSpAK9phDl5O5Tmy06nXnnzALwqVnf4ros3Ow= +github.com/VictoriaMetrics/metrics v1.39.1/go.mod h1:XE4uudAAIRaJE614Tl5HMrtoEU6+GDZO4QTnNSsZRuA= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= From 3987d34f6d2c0f7eda7a21c0602313fcfa9b2fb2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 01:45:54 +0000 Subject: [PATCH 2/8] Bump google.golang.org/grpc from 1.72.0 to 1.79.3 Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.72.0 to 1.79.3. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.72.0...v1.79.3) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-version: 1.79.3 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 10 +++++----- go.sum | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index c994ff9..73b55c7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go.unistack.org/micro-meter-victoriametrics/v4 -go 1.23.0 +go 1.24.0 toolchain go1.24.4 @@ -16,8 +16,8 @@ require ( github.com/valyala/fastrand v1.1.0 // indirect github.com/valyala/histogram v1.2.0 // indirect go.unistack.org/micro-proto/v4 v4.1.0 // indirect - golang.org/x/sys v0.33.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect - google.golang.org/grpc v1.72.0 // indirect - google.golang.org/protobuf v1.36.6 // indirect + golang.org/x/sys v0.39.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/grpc v1.79.3 // indirect + google.golang.org/protobuf v1.36.10 // indirect ) diff --git a/go.sum b/go.sum index 30b539b..009abb7 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -32,17 +32,17 @@ go.unistack.org/micro-proto/v4 v4.1.0 h1:qPwL2n/oqh9RE3RTTDgt28XK3QzV597VugQPaw9 go.unistack.org/micro-proto/v4 v4.1.0/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec= go.unistack.org/micro/v4 v4.1.19 h1:LKpmSPYvX5B9AkFD7JqMU/U06v5yEWn2bsCG/YKZtZI= go.unistack.org/micro/v4 v4.1.19/go.mod h1:xleO2M5Yxh4s6I+RUcLrEpUjobefh+71ctrdIfn7TUs= -golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= -golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= -golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= -golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= -golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a h1:51aaUVRocpvUOSQKM6Q7VuoaktNIaMCLuhZB6DKksq4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a/go.mod h1:uRxBH1mhmO8PGhU89cMcHaXKZqO+OfakD8QQO0oYwlQ= -google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= -google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= -google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= +golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= +golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= +golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= +google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From b0e900124ddb920326d9a14d0578c436d734987a Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 12 Oct 2025 15:40:22 +0300 Subject: [PATCH 3/8] update for latest micro Signed-off-by: Vasiliy Tolstov --- go.mod | 4 ++-- go.sum | 8 ++++---- victoriametrics.go | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 73b55c7..7df2ad9 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.24.0 toolchain go1.24.4 require ( - github.com/VictoriaMetrics/metrics v1.39.1 - go.unistack.org/micro/v4 v4.1.19 + github.com/VictoriaMetrics/metrics v1.40.2 + go.unistack.org/micro/v4 v4.1.22 ) require ( diff --git a/go.sum b/go.sum index 009abb7..2a827c0 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/VictoriaMetrics/metrics v1.39.1 h1:AT7jz7oSpAK9phDl5O5Tmy06nXnnzALwqVnf4ros3Ow= -github.com/VictoriaMetrics/metrics v1.39.1/go.mod h1:XE4uudAAIRaJE614Tl5HMrtoEU6+GDZO4QTnNSsZRuA= +github.com/VictoriaMetrics/metrics v1.40.2 h1:OVSjKcQEx6JAwGeu8/KQm9Su5qJ72TMEW4xYn5vw3Ac= +github.com/VictoriaMetrics/metrics v1.40.2/go.mod h1:XE4uudAAIRaJE614Tl5HMrtoEU6+GDZO4QTnNSsZRuA= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -30,8 +30,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/v4 v4.1.0 h1:qPwL2n/oqh9RE3RTTDgt28XK3QzV597VugQPaw9lKUk= go.unistack.org/micro-proto/v4 v4.1.0/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec= -go.unistack.org/micro/v4 v4.1.19 h1:LKpmSPYvX5B9AkFD7JqMU/U06v5yEWn2bsCG/YKZtZI= -go.unistack.org/micro/v4 v4.1.19/go.mod h1:xleO2M5Yxh4s6I+RUcLrEpUjobefh+71ctrdIfn7TUs= +go.unistack.org/micro/v4 v4.1.22 h1:CBRwTxj53gtFkQKyzUeoIad9LyyJaMCJDcsmzUwXHdI= +go.unistack.org/micro/v4 v4.1.22/go.mod h1:nlBXTbx0rQrSZX4HPp2m57PHmpuGPWUd0O+jpUIiPto= golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= diff --git a/victoriametrics.go b/victoriametrics.go index d84b795..97b3668 100644 --- a/victoriametrics.go +++ b/victoriametrics.go @@ -26,6 +26,10 @@ func (r *victoriametricsMeter) Name() string { return r.opts.Name } +func (r *victoriametricsMeter) Unregister(name string, labels ...string) bool { + return r.set.UnregisterMetric(r.buildName(name, labels...)) +} + func (r *victoriametricsMeter) Clone(opts ...meter.Option) meter.Meter { options := r.opts for _, o := range opts { From d1015eed276e8108f0249fd271a1e480f9aa29f6 Mon Sep 17 00:00:00 2001 From: vtolstov Date: Sun, 12 Oct 2025 12:44:48 +0000 Subject: [PATCH 4/8] Apply Code Coverage Badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8096e0f..5ea00b9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # VictoriaMetrics -![Coverage](https://img.shields.io/badge/Coverage-46.9%25-yellow) +![Coverage](https://img.shields.io/badge/Coverage-46.0%25-yellow) Wrappers are a form of middleware that can be used with go-micro services. They can wrap both the Client and Server handlers. This plugin implements the HandlerWrapper interface to provide automatic prometheus metric handling From 526898ad9f860adb6d220a81571bacbc9731af62 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 12 Oct 2025 15:59:04 +0300 Subject: [PATCH 5/8] add HistogramExt method with custom quantiles Signed-off-by: Vasiliy Tolstov --- go.mod | 2 +- go.sum | 4 ++-- victoriametrics.go | 12 +++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 7df2ad9..a397def 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.24.4 require ( github.com/VictoriaMetrics/metrics v1.40.2 - go.unistack.org/micro/v4 v4.1.22 + go.unistack.org/micro/v4 v4.1.23 ) require ( diff --git a/go.sum b/go.sum index 2a827c0..74ae80d 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,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/v4 v4.1.0 h1:qPwL2n/oqh9RE3RTTDgt28XK3QzV597VugQPaw9lKUk= go.unistack.org/micro-proto/v4 v4.1.0/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec= -go.unistack.org/micro/v4 v4.1.22 h1:CBRwTxj53gtFkQKyzUeoIad9LyyJaMCJDcsmzUwXHdI= -go.unistack.org/micro/v4 v4.1.22/go.mod h1:nlBXTbx0rQrSZX4HPp2m57PHmpuGPWUd0O+jpUIiPto= +go.unistack.org/micro/v4 v4.1.23 h1:T9O1O1mN60JHqIAIw+XkNik8xb0h90O9fJ55uQMb8VU= +go.unistack.org/micro/v4 v4.1.23/go.mod h1:nlBXTbx0rQrSZX4HPp2m57PHmpuGPWUd0O+jpUIiPto= golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= diff --git a/victoriametrics.go b/victoriametrics.go index 97b3668..d8faee4 100644 --- a/victoriametrics.go +++ b/victoriametrics.go @@ -69,7 +69,14 @@ func (r *victoriametricsMeter) Gauge(name string, f func() float64, labels ...st func (r *victoriametricsMeter) Histogram(name string, labels ...string) meter.Histogram { if r.prometheusCompat { - return r.set.GetOrCreatePrometheusHistogram(r.buildName(name, labels...)) + return r.set.GetOrCreatePrometheusHistogramExt(r.buildName(name, labels...), r.opts.Quantiles) + } + return r.set.GetOrCreateHistogram(r.buildName(name, labels...)) +} + +func (r *victoriametricsMeter) HistogramExt(name string, quantiles []float64, labels ...string) meter.Histogram { + if r.prometheusCompat { + return r.set.GetOrCreatePrometheusHistogramExt(r.buildName(name, labels...), quantiles) } return r.set.GetOrCreateHistogram(r.buildName(name, labels...)) } @@ -98,6 +105,9 @@ func (r *victoriametricsMeter) Init(opts ...meter.Option) error { if v, ok := r.opts.Context.Value(prometheusCompatKey{}).(bool); ok && v { r.prometheusCompat = v } + if r.opts.Quantiles == nil { + r.opts.Quantiles = meter.DefaultQuantiles + } return nil } From 899ce36c3528c65f39801ceabf4986577212e6f3 Mon Sep 17 00:00:00 2001 From: vtolstov Date: Sun, 12 Oct 2025 13:03:34 +0000 Subject: [PATCH 6/8] Apply Code Coverage Badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ea00b9..da6c500 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # VictoriaMetrics -![Coverage](https://img.shields.io/badge/Coverage-46.0%25-yellow) +![Coverage](https://img.shields.io/badge/Coverage-45.5%25-yellow) Wrappers are a form of middleware that can be used with go-micro services. They can wrap both the Client and Server handlers. This plugin implements the HandlerWrapper interface to provide automatic prometheus metric handling From 46f30008e38ba084b5116320aeb6315994177487 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 12 Dec 2025 10:50:04 +0300 Subject: [PATCH 7/8] optimize memory allocs Signed-off-by: Vasiliy Tolstov --- go.mod | 8 +++----- go.sum | 24 ++++++++++++------------ victoriametrics.go | 39 ++++++++++++++++++++++++++++++++++----- 3 files changed, 49 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index a397def..38f1bb8 100644 --- a/go.mod +++ b/go.mod @@ -1,18 +1,16 @@ module go.unistack.org/micro-meter-victoriametrics/v4 -go 1.24.0 - -toolchain go1.24.4 +go 1.25 require ( github.com/VictoriaMetrics/metrics v1.40.2 - go.unistack.org/micro/v4 v4.1.23 + go.unistack.org/micro/v4 v4.1.25 ) require ( github.com/google/uuid v1.6.0 // indirect github.com/matoous/go-nanoid v1.5.1 // indirect - github.com/spf13/cast v1.8.0 // indirect + github.com/spf13/cast v1.10.0 // indirect github.com/valyala/fastrand v1.1.0 // indirect github.com/valyala/histogram v1.2.0 // indirect go.unistack.org/micro-proto/v4 v4.1.0 // indirect diff --git a/go.sum b/go.sum index 74ae80d..bb9ecdc 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/VictoriaMetrics/metrics v1.40.2 h1:OVSjKcQEx6JAwGeu8/KQm9Su5qJ72TMEW4xYn5vw3Ac= github.com/VictoriaMetrics/metrics v1.40.2/go.mod h1:XE4uudAAIRaJE614Tl5HMrtoEU6+GDZO4QTnNSsZRuA= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= @@ -16,22 +16,22 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/matoous/go-nanoid v1.5.1 h1:aCjdvTyO9LLnTIi0fgdXhOPPvOHjpXN6Ik9DaNjIct4= github.com/matoous/go-nanoid v1.5.1/go.mod h1:zyD2a71IubI24efhpvkJz+ZwfwagzgSO6UNiFsZKN7U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= -github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= -github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk= -github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= +github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/valyala/fastrand v1.1.0 h1:f+5HkLW4rsgzdNoleUOB69hyT9IlD2ZQh9GyDMfb5G8= github.com/valyala/fastrand v1.1.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ= github.com/valyala/histogram v1.2.0 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ= github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY= go.unistack.org/micro-proto/v4 v4.1.0 h1:qPwL2n/oqh9RE3RTTDgt28XK3QzV597VugQPaw9lKUk= go.unistack.org/micro-proto/v4 v4.1.0/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec= -go.unistack.org/micro/v4 v4.1.23 h1:T9O1O1mN60JHqIAIw+XkNik8xb0h90O9fJ55uQMb8VU= -go.unistack.org/micro/v4 v4.1.23/go.mod h1:nlBXTbx0rQrSZX4HPp2m57PHmpuGPWUd0O+jpUIiPto= +go.unistack.org/micro/v4 v4.1.25 h1:JznyZN4K4HrfaEJNPC8z86EBMqC57NiQnmTrNR/Lu6M= +go.unistack.org/micro/v4 v4.1.25/go.mod h1:PK9s7QW65HrWf26FWkdmPEQoYhsdV0e1WwThwspjpls= golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= diff --git a/victoriametrics.go b/victoriametrics.go index d8faee4..b3901df 100644 --- a/victoriametrics.go +++ b/victoriametrics.go @@ -6,16 +6,22 @@ import ( "github.com/VictoriaMetrics/metrics" "go.unistack.org/micro/v4/meter" + xpool "go.unistack.org/micro/v4/util/xpool" ) type victoriametricsMeter struct { set *metrics.Set opts meter.Options prometheusCompat bool + builderPool *xpool.StringsPool } func NewMeter(opts ...meter.Option) meter.Meter { - m := &victoriametricsMeter{set: metrics.NewSet(), opts: meter.NewOptions(opts...)} + m := &victoriametricsMeter{ + set: metrics.NewSet(), + opts: meter.NewOptions(opts...), + builderPool: xpool.NewStringsPool(256), + } if v, ok := m.opts.Context.Value(prometheusCompatKey{}).(bool); ok && v { m.prometheusCompat = v } @@ -48,11 +54,34 @@ func (r *victoriametricsMeter) buildName(name string, labels ...string) string { return name } - nlabels := make([]string, 0, nl) - nlabels = append(nlabels, r.opts.Labels...) - nlabels = append(nlabels, labels...) + b := r.builderPool.Get() + defer r.builderPool.Put(b) - return meter.BuildName(name, nlabels...) + b.WriteString(name) + b.WriteByte('{') + + for i := 0; i < len(r.opts.Labels); i += 2 { + if i > 0 { + b.WriteByte(',') + } + b.WriteString(r.opts.Labels[i]) + b.WriteString(`="`) + b.WriteString(r.opts.Labels[i+1]) + b.WriteByte('"') + } + + for i := 0; i < len(labels); i += 2 { + if i > 0 || len(r.opts.Labels) > 0 { + b.WriteByte(',') + } + b.WriteString(labels[i]) + b.WriteString(`="`) + b.WriteString(labels[i+1]) + b.WriteByte('"') + } + + b.WriteByte('}') + return b.String() } func (r *victoriametricsMeter) Counter(name string, labels ...string) meter.Counter { From a781e5c4a3751c1ee2a6b766362f0b99fc64e6e4 Mon Sep 17 00:00:00 2001 From: Evstigneev Denis Date: Mon, 29 Dec 2025 11:47:43 +0300 Subject: [PATCH 8/8] upd job_sync && add gitignore --- .github/workflows/job_sync.yml | 2 +- .gitignore | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.github/workflows/job_sync.yml b/.github/workflows/job_sync.yml index dac3f14..f2a755b 100644 --- a/.github/workflows/job_sync.yml +++ b/.github/workflows/job_sync.yml @@ -25,7 +25,7 @@ jobs: dst_hash=$(git ls-remote ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} refs/heads/master | cut -f1) echo "src_hash=$src_hash" echo "dst_hash=$dst_hash" - if [ "$src_hash" != "$dst_hash" ]; then + if [ "$src_hash" != "$dst_hash" -a "$src_hash" != "" -a "$dst_hash" != "" ]; then echo "sync_needed=true" >> $GITHUB_OUTPUT else echo "sync_needed=false" >> $GITHUB_OUTPUT diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad367ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# Develop tools +/.vscode/ +/.idea/ +.idea +.vscode + +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Folders +_obj +_test +_build +.DS_Store + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# vim temp files +*~ +*.swp +*.swo \ No newline at end of file