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 6d237da3f3
commit 06f7f23ebe
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/VictoriaMetrics/easyproto v0.1.4
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/aws/aws-sdk-go-v2 v1.30.1
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/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI=
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.0/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8=
github.com/VictoriaMetrics/metrics v1.35.1 h1:o84wtBKQbzLdDy14XeskkCZih6anG+veZ1SwJHFGwrU=
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/go.mod h1:1g4hdCwlbJZ851PU9VN65xy9Rdlzupo6fx3SNZ8Z64U=
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.
type Histogram struct {
// 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
// lower is the number of values, which hit the lower bucket
lower uint64
// upper is the number of values, which hit the upper bucket
upper uint64
// sum is the sum of all the values put into Histogram
sum float64
}
@ -109,28 +117,30 @@ func (h *Histogram) Update(v float64) {
h.mu.Unlock()
}
// Merge merges histograms
func (h *Histogram) Merge(b *Histogram) {
// Merge merges src to h
func (h *Histogram) Merge(src *Histogram) {
h.mu.Lock()
defer h.mu.Unlock()
b.mu.RLock()
defer b.mu.RUnlock()
src.mu.Lock()
defer src.mu.Unlock()
h.lower += b.lower
h.upper += b.upper
h.sum += b.sum
h.lower += src.lower
h.upper += src.upper
h.sum += src.sum
for i, db := range b.decimalBuckets {
if db == nil {
for i, dbSrc := range src.decimalBuckets {
if dbSrc == nil {
continue
}
if h.decimalBuckets[i] == nil {
dbDst := h.decimalBuckets[i]
if dbDst == nil {
var b [bucketsPerDecimal]uint64
h.decimalBuckets[i] = &b
dbDst = &b
h.decimalBuckets[i] = dbDst
}
for j := range db {
h.decimalBuckets[i][j] += db[j]
for j := range dbSrc {
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
// with `le` (less or equal) labels.
func (h *Histogram) VisitNonZeroBuckets(f func(vmrange string, count uint64)) {
h.mu.RLock()
h.mu.Lock()
if h.lower > 0 {
f(lowerBucketRange, h.lower)
}
@ -161,7 +171,7 @@ func (h *Histogram) VisitNonZeroBuckets(f func(vmrange string, count uint64)) {
if h.upper > 0 {
f(upperBucketRange, h.upper)
}
h.mu.RUnlock()
h.mu.Unlock()
}
// 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 {
h.mu.RLock()
h.mu.Lock()
sum := h.sum
h.mu.RUnlock()
h.mu.Unlock()
return sum
}

View file

@ -16,6 +16,11 @@ import (
// See https://github.com/prometheus/procfs/blob/a4ac0826abceb44c40fc71daed2b301db498b93e/proc_stat.go#L40 .
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
type procStat struct {
State byte
@ -80,7 +85,7 @@ func writeProcessMetrics(w io.Writer) {
WriteCounterUint64(w, "process_major_pagefaults_total", uint64(p.Majflt))
WriteCounterUint64(w, "process_minor_pagefaults_total", uint64(p.Minflt))
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_virtual_memory_bytes", uint64(p.Vsize))
writeProcessMemMetrics(w)

View file

@ -32,7 +32,8 @@ type PushOptions struct {
// By default the compression is enabled.
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.
Method string
@ -301,7 +302,7 @@ func newPushContext(pushURL string, opts *PushOptions) (*pushContext, error) {
}
method := opts.Method
if len(method) == 0 {
if method == "" {
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
## explicit; go 1.13
github.com/VictoriaMetrics/fastcache
# github.com/VictoriaMetrics/metrics v1.35.0
# github.com/VictoriaMetrics/metrics v1.35.1
## explicit; go 1.17
github.com/VictoriaMetrics/metrics
# github.com/VictoriaMetrics/metricsql v0.76.0