vendor: update metrics package

Related to https://github.com/VictoriaMetrics/metrics/issues/85
This commit is contained in:
f41gh7
2026-03-12 09:41:47 +01:00
parent 82eab5c5b7
commit e9b7adc0e5
7 changed files with 43 additions and 6 deletions

View File

@@ -37,6 +37,7 @@ See also [LTS releases](https://docs.victoriametrics.com/victoriametrics/lts-rel
* FEATURE: [vmsingle](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/) and `vmselect` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/victoriametrics/cluster-victoriametrics/): Disable `/graphite/tags/tagSeries` and `/graphite/tags/tagMultiSeries` for Graphite tag registration since it is unlikely it is used in context of VictoriaMetrics. See [10544](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10544).
* FEATURE: [vmui](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#vmui): rename debug tools buttons for clarity. See [#10453](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10453).
* BUGFIX: all VictoriaMetrics components: replace `histogram` with `untyped` metric metadata type for [VictoriaMetrics histograms](https://docs.victoriametrics.com/victoriametrics/keyconcepts/#histogram) when `-metrics.exposeMetadata` is set. See [#82](https://github.com/VictoriaMetrics/metrics/issues/82).
* BUGFIX: [vmauth](https://docs.victoriametrics.com/victoriametrics/vmauth/): properly route requests to `default_url`. Previously, `request_path` query arg could be set incorrectly during concurrent requests. See [#10626](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/10626).
* BUGFIX: [vmui](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#vmui): use `increase_pure` instead of `rate` for histogram heatmaps in Explore Metrics to correctly display the first observation in each new bucket. See [#10365](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10365). Thanks to @ab0utbla-k for the contribution.
* BUGFIX: [dashboards/vmauth](https://grafana.com/grafana/dashboards/21394): fix `requested from system` and `heap inuse` expressions in the memory usage panel. See [#10574](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/10574).

2
go.mod
View File

@@ -10,7 +10,7 @@ require (
github.com/VictoriaMetrics/VictoriaLogs v0.0.0-20260218111324-95b48d57d032
github.com/VictoriaMetrics/easyproto v1.2.0
github.com/VictoriaMetrics/fastcache v1.13.3
github.com/VictoriaMetrics/metrics v1.41.2
github.com/VictoriaMetrics/metrics v1.42.0
github.com/VictoriaMetrics/metricsql v0.85.0
github.com/aws/aws-sdk-go-v2 v1.41.1
github.com/aws/aws-sdk-go-v2/config v1.32.8

2
go.sum
View File

@@ -60,6 +60,8 @@ github.com/VictoriaMetrics/fastcache v1.13.3 h1:rBabE0iIxcqKEMCwUmwHZ9dgEqXerg8F
github.com/VictoriaMetrics/fastcache v1.13.3/go.mod h1:hHXhl4DA2fTL2HTZDJFXWgW0LNjo6B+4aj2Wmng3TjU=
github.com/VictoriaMetrics/metrics v1.41.2 h1:pLQ4Mw9TqXFq3ZsZVJkz88JHpjL9LY5NHTY3v2gBNAw=
github.com/VictoriaMetrics/metrics v1.41.2/go.mod h1:xDM82ULLYCYdFRgQ2JBxi8Uf1+8En1So9YUwlGTOqTc=
github.com/VictoriaMetrics/metrics v1.42.0 h1:t/OGs3BjMUYhxw/h83Z28qAss8DuA4QEVwO4NwJ9hZc=
github.com/VictoriaMetrics/metrics v1.42.0/go.mod h1:xDM82ULLYCYdFRgQ2JBxi8Uf1+8En1So9YUwlGTOqTc=
github.com/VictoriaMetrics/metricsql v0.85.0 h1:xI+EfqsOgY0T2yd7p8hcYQ52LOtf+1i8fQQzQ+RGtZM=
github.com/VictoriaMetrics/metricsql v0.85.0/go.mod h1:d4EisFO6ONP/HIGDYTAtwrejJBBeKGQYiRl095bS4QQ=
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=

View File

@@ -266,5 +266,13 @@ func (h *Histogram) getSum() float64 {
}
func (h *Histogram) metricType() string {
return "histogram"
// The Prometheus data model requires histogram metrics to expose "le" labels.
// Some collectors, such as the OpenTelemetry (OTEL) Collector, strictly enforce
// this data model and apply transformations based on the metric type.
//
// Because Prometheus metric types are strongly typed and we don't have control over it,
// introducing a custom "vm_histogram" type is not possible.
//
// So it's better to use untyped metric type.
return "untyped"
}

View File

@@ -13,6 +13,7 @@
package metrics
import (
"bytes"
"fmt"
"io"
"sort"
@@ -42,6 +43,11 @@ func init() {
var (
registeredSets = make(map[*Set]struct{})
registeredSetsLock sync.Mutex
bufPool = sync.Pool{
New: func() any {
return bytes.NewBuffer(make([]byte, 0, 64*1024))
},
}
)
// RegisterSet registers the given set s for metrics export via global WritePrometheus() call.
@@ -248,6 +254,23 @@ func WriteProcessMetrics(w io.Writer) {
writePushMetrics(w)
}
// WriteGoMetrics writes Go runtime metrics to w.
// This includes runtime/metrics such as memory stats, GC stats, goroutine counts, etc.
func WriteGoMetrics(w io.Writer) {
writeGoMetrics(w)
}
// WriteProcMetrics writes OS-level process metrics to w by reading
// the /proc filesystem (CPU, memory, file descriptors, PSI, etc.).
func WriteProcMetrics(w io.Writer) {
writeProcessMetrics(w)
}
// WritePushMetrics writes push-mode related metrics to w.
func WritePushMetrics(w io.Writer) {
writePushMetrics(w)
}
// WriteFDMetrics writes `process_max_fds` and `process_open_fds` metrics to w.
func WriteFDMetrics(w io.Writer) {
writeFDMetrics(w)

View File

@@ -35,7 +35,10 @@ func NewSet() *Set {
// WritePrometheus writes all the metrics from s to w in Prometheus format.
func (s *Set) WritePrometheus(w io.Writer) {
// Collect all the metrics in in-memory buffer in order to prevent from long locking due to slow w.
var bb bytes.Buffer
bb := bufPool.Get().(*bytes.Buffer)
bb.Reset()
defer bufPool.Put(bb)
lessFunc := func(i, j int) bool {
// the sorting must be stable.
// see edge cases why we can't simply do `s.a[i].name < s.a[j].name` here:
@@ -77,7 +80,7 @@ func (s *Set) WritePrometheus(w io.Writer) {
if !isMetadataEnabled() {
// Call marshalTo without the global lock, since certain metric types such as Gauge
// can call a callback, which, in turn, can try calling s.mu.Lock again.
nm.metric.marshalTo(nm.name, &bb)
nm.metric.marshalTo(nm.name, bb)
continue
}
@@ -93,7 +96,7 @@ func (s *Set) WritePrometheus(w io.Writer) {
if metricFamily != prevMetricFamily {
// write metadata only once per metric family
metricType := nm.metric.metricType()
writeMetadata(&bb, metricFamily, metricType)
writeMetadata(bb, metricFamily, metricType)
prevMetricFamily = metricFamily
}
bb.Write(metricsWithMetadataBuf.Bytes())

2
vendor/modules.txt vendored
View File

@@ -142,7 +142,7 @@ github.com/VictoriaMetrics/easyproto
# github.com/VictoriaMetrics/fastcache v1.13.3
## explicit; go 1.24.0
github.com/VictoriaMetrics/fastcache
# github.com/VictoriaMetrics/metrics v1.41.2
# github.com/VictoriaMetrics/metrics v1.42.0
## explicit; go 1.24.0
github.com/VictoriaMetrics/metrics
# github.com/VictoriaMetrics/metricsql v0.85.0