vendor: update github.com/VictoriaMetrics/metrics from v1.35.0 to v1.35.1

This commit is contained in:
Aliaksandr Valialkin 2024-07-16 13:18:38 +02:00
parent 57000f5105
commit f5a89aea1e
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
6 changed files with 41 additions and 25 deletions

2
go.mod
View file

@ -9,7 +9,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2
github.com/VictoriaMetrics/easyproto v0.1.4 github.com/VictoriaMetrics/easyproto v0.1.4
github.com/VictoriaMetrics/fastcache v1.12.2 github.com/VictoriaMetrics/fastcache v1.12.2
github.com/VictoriaMetrics/metrics v1.35.0 github.com/VictoriaMetrics/metrics v1.35.1
github.com/VictoriaMetrics/metricsql v0.76.0 github.com/VictoriaMetrics/metricsql v0.76.0
github.com/aws/aws-sdk-go-v2 v1.30.1 github.com/aws/aws-sdk-go-v2 v1.30.1
github.com/aws/aws-sdk-go-v2/config v1.27.24 github.com/aws/aws-sdk-go-v2/config v1.27.24

4
go.sum
View file

@ -72,8 +72,8 @@ github.com/VictoriaMetrics/easyproto v0.1.4/go.mod h1:QlGlzaJnDfFd8Lk6Ci/fuLxfTo
github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI=
github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI=
github.com/VictoriaMetrics/metrics v1.34.0/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8= github.com/VictoriaMetrics/metrics v1.34.0/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8=
github.com/VictoriaMetrics/metrics v1.35.0 h1:xWImz8UTwyhGZAzueTHFgYe4bnKbXCaLWBq2JBj7EzI= github.com/VictoriaMetrics/metrics v1.35.1 h1:o84wtBKQbzLdDy14XeskkCZih6anG+veZ1SwJHFGwrU=
github.com/VictoriaMetrics/metrics v1.35.0/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8= github.com/VictoriaMetrics/metrics v1.35.1/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8=
github.com/VictoriaMetrics/metricsql v0.76.0 h1:hl7vqJqyH2d8zKImzalkFrkFiD5q4ACF8gl3s86DqKA= github.com/VictoriaMetrics/metricsql v0.76.0 h1:hl7vqJqyH2d8zKImzalkFrkFiD5q4ACF8gl3s86DqKA=
github.com/VictoriaMetrics/metricsql v0.76.0/go.mod h1:1g4hdCwlbJZ851PU9VN65xy9Rdlzupo6fx3SNZ8Z64U= github.com/VictoriaMetrics/metricsql v0.76.0/go.mod h1:1g4hdCwlbJZ851PU9VN65xy9Rdlzupo6fx3SNZ8Z64U=
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow= github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=

View file

@ -47,13 +47,21 @@ var bucketMultiplier = math.Pow(10, 1.0/bucketsPerDecimal)
// Zero histogram is usable. // Zero histogram is usable.
type Histogram struct { type Histogram struct {
// Mu gurantees synchronous update for all the counters and sum. // Mu gurantees synchronous update for all the counters and sum.
mu sync.RWMutex //
// Do not use sync.RWMutex, since it has zero sense from performance PoV.
// It only complicates the code.
mu sync.Mutex
// decimalBuckets contains counters for histogram buckets
decimalBuckets [decimalBucketsCount]*[bucketsPerDecimal]uint64 decimalBuckets [decimalBucketsCount]*[bucketsPerDecimal]uint64
// lower is the number of values, which hit the lower bucket
lower uint64 lower uint64
// upper is the number of values, which hit the upper bucket
upper uint64 upper uint64
// sum is the sum of all the values put into Histogram
sum float64 sum float64
} }
@ -109,28 +117,30 @@ func (h *Histogram) Update(v float64) {
h.mu.Unlock() h.mu.Unlock()
} }
// Merge merges histograms // Merge merges src to h
func (h *Histogram) Merge(b *Histogram) { func (h *Histogram) Merge(src *Histogram) {
h.mu.Lock() h.mu.Lock()
defer h.mu.Unlock() defer h.mu.Unlock()
b.mu.RLock() src.mu.Lock()
defer b.mu.RUnlock() defer src.mu.Unlock()
h.lower += b.lower h.lower += src.lower
h.upper += b.upper h.upper += src.upper
h.sum += b.sum h.sum += src.sum
for i, db := range b.decimalBuckets { for i, dbSrc := range src.decimalBuckets {
if db == nil { if dbSrc == nil {
continue continue
} }
if h.decimalBuckets[i] == nil { dbDst := h.decimalBuckets[i]
if dbDst == nil {
var b [bucketsPerDecimal]uint64 var b [bucketsPerDecimal]uint64
h.decimalBuckets[i] = &b dbDst = &b
h.decimalBuckets[i] = dbDst
} }
for j := range db { for j := range dbSrc {
h.decimalBuckets[i][j] += db[j] dbDst[j] += dbSrc[j]
} }
} }
} }
@ -142,7 +152,7 @@ func (h *Histogram) Merge(b *Histogram) {
// This is required to be compatible with Prometheus-style histogram buckets // This is required to be compatible with Prometheus-style histogram buckets
// with `le` (less or equal) labels. // with `le` (less or equal) labels.
func (h *Histogram) VisitNonZeroBuckets(f func(vmrange string, count uint64)) { func (h *Histogram) VisitNonZeroBuckets(f func(vmrange string, count uint64)) {
h.mu.RLock() h.mu.Lock()
if h.lower > 0 { if h.lower > 0 {
f(lowerBucketRange, h.lower) f(lowerBucketRange, h.lower)
} }
@ -161,7 +171,7 @@ func (h *Histogram) VisitNonZeroBuckets(f func(vmrange string, count uint64)) {
if h.upper > 0 { if h.upper > 0 {
f(upperBucketRange, h.upper) f(upperBucketRange, h.upper)
} }
h.mu.RUnlock() h.mu.Unlock()
} }
// NewHistogram creates and returns new histogram with the given name. // NewHistogram creates and returns new histogram with the given name.
@ -249,9 +259,9 @@ func (h *Histogram) marshalTo(prefix string, w io.Writer) {
} }
func (h *Histogram) getSum() float64 { func (h *Histogram) getSum() float64 {
h.mu.RLock() h.mu.Lock()
sum := h.sum sum := h.sum
h.mu.RUnlock() h.mu.Unlock()
return sum return sum
} }

View file

@ -16,6 +16,11 @@ import (
// See https://github.com/prometheus/procfs/blob/a4ac0826abceb44c40fc71daed2b301db498b93e/proc_stat.go#L40 . // See https://github.com/prometheus/procfs/blob/a4ac0826abceb44c40fc71daed2b301db498b93e/proc_stat.go#L40 .
const userHZ = 100 const userHZ = 100
// Different environments may have different page size.
//
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6457
var pageSizeBytes = uint64(os.Getpagesize())
// See http://man7.org/linux/man-pages/man5/proc.5.html // See http://man7.org/linux/man-pages/man5/proc.5.html
type procStat struct { type procStat struct {
State byte State byte
@ -80,7 +85,7 @@ func writeProcessMetrics(w io.Writer) {
WriteCounterUint64(w, "process_major_pagefaults_total", uint64(p.Majflt)) WriteCounterUint64(w, "process_major_pagefaults_total", uint64(p.Majflt))
WriteCounterUint64(w, "process_minor_pagefaults_total", uint64(p.Minflt)) WriteCounterUint64(w, "process_minor_pagefaults_total", uint64(p.Minflt))
WriteGaugeUint64(w, "process_num_threads", uint64(p.NumThreads)) WriteGaugeUint64(w, "process_num_threads", uint64(p.NumThreads))
WriteGaugeUint64(w, "process_resident_memory_bytes", uint64(p.Rss)*uint64(os.Getpagesize())) WriteGaugeUint64(w, "process_resident_memory_bytes", uint64(p.Rss)*pageSizeBytes)
WriteGaugeUint64(w, "process_start_time_seconds", uint64(startTimeSeconds)) WriteGaugeUint64(w, "process_start_time_seconds", uint64(startTimeSeconds))
WriteGaugeUint64(w, "process_virtual_memory_bytes", uint64(p.Vsize)) WriteGaugeUint64(w, "process_virtual_memory_bytes", uint64(p.Vsize))
writeProcessMemMetrics(w) writeProcessMemMetrics(w)

View file

@ -32,7 +32,8 @@ type PushOptions struct {
// By default the compression is enabled. // By default the compression is enabled.
DisableCompression bool DisableCompression bool
// Method is an optional of HTTP request method. // Method is HTTP request method to use when pushing metrics to pushURL.
//
// By default the Method is GET. // By default the Method is GET.
Method string Method string
@ -301,7 +302,7 @@ func newPushContext(pushURL string, opts *PushOptions) (*pushContext, error) {
} }
method := opts.Method method := opts.Method
if len(method) == 0 { if method == "" {
method = http.MethodGet method = http.MethodGet
} }

2
vendor/modules.txt vendored
View file

@ -115,7 +115,7 @@ github.com/VictoriaMetrics/easyproto
# github.com/VictoriaMetrics/fastcache v1.12.2 # github.com/VictoriaMetrics/fastcache v1.12.2
## explicit; go 1.13 ## explicit; go 1.13
github.com/VictoriaMetrics/fastcache github.com/VictoriaMetrics/fastcache
# github.com/VictoriaMetrics/metrics v1.35.0 # github.com/VictoriaMetrics/metrics v1.35.1
## explicit; go 1.17 ## explicit; go 1.17
github.com/VictoriaMetrics/metrics github.com/VictoriaMetrics/metrics
# github.com/VictoriaMetrics/metricsql v0.76.0 # github.com/VictoriaMetrics/metricsql v0.76.0