6 Commits

Author SHA1 Message Date
17593e466c add HistogramExt method with custom quantiles
Some checks failed
sync / sync (push) Failing after 23s
coverage / build (push) Successful in 4m25s
test / test (push) Failing after 18m20s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2025-10-12 15:59:10 +03:00
vtolstov
6f996f3cc4 Apply Code Coverage Badge 2025-10-12 12:44:48 +00:00
9955afc90d update for latest micro
Some checks failed
coverage / build (push) Successful in 2m58s
test / test (push) Failing after 15m40s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2025-10-12 15:40:22 +03:00
12fd9c04f5 Merge pull request #173 from unistack-org/dependabot/github_actions/tj-actions/coverage-badge-go-3
Some checks failed
sync / sync (push) Failing after 11s
Bump tj-actions/coverage-badge-go from 2 to 3
2025-10-01 09:49:43 +03:00
0579d5df86 Merge branch 'v4' into dependabot/github_actions/tj-actions/coverage-badge-go-3 2025-10-01 09:49:34 +03:00
dependabot[bot]
7949bb3f1f Bump tj-actions/coverage-badge-go from 2 to 3
Bumps [tj-actions/coverage-badge-go](https://github.com/tj-actions/coverage-badge-go) from 2 to 3.
- [Release notes](https://github.com/tj-actions/coverage-badge-go/releases)
- [Changelog](https://github.com/tj-actions/coverage-badge-go/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/coverage-badge-go/compare/v2...v3)

---
updated-dependencies:
- dependency-name: tj-actions/coverage-badge-go
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-28 10:57:07 +00:00
5 changed files with 27 additions and 13 deletions

View File

@@ -32,7 +32,7 @@ jobs:
go tool cover -func coverage.out -o coverage.out
- name: coverage badge
uses: tj-actions/coverage-badge-go@v2
uses: tj-actions/coverage-badge-go@v3
with:
green: 80
filename: coverage.out

View File

@@ -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

8
go.mod
View File

@@ -1,12 +1,12 @@
module go.unistack.org/micro-meter-victoriametrics/v4
go 1.23.0
go 1.24.0
toolchain go1.24.4
require (
github.com/VictoriaMetrics/metrics v1.38.0
go.unistack.org/micro/v4 v4.1.19
github.com/VictoriaMetrics/metrics v1.40.2
go.unistack.org/micro/v4 v4.1.23
)
require (
@@ -16,7 +16,7 @@ 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
golang.org/x/sys v0.37.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

12
go.sum
View File

@@ -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.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,12 +30,12 @@ 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.23 h1:T9O1O1mN60JHqIAIw+XkNik8xb0h90O9fJ55uQMb8VU=
go.unistack.org/micro/v4 v4.1.23/go.mod h1:nlBXTbx0rQrSZX4HPp2m57PHmpuGPWUd0O+jpUIiPto=
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/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
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=

View File

@@ -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 {
@@ -65,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...))
}
@@ -94,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
}