summaryrefslogtreecommitdiff
path: root/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-09-04 15:29:27 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-09-04 15:29:27 +0200
commit78defcd9166a202eb3140dc27afd288e1f9bfec4 (patch)
treedfe061abc810096f0141b7f585d38401c099c488 /vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go
parent[performance] faster request id generation (#4405) (diff)
downloadgotosocial-78defcd9166a202eb3140dc27afd288e1f9bfec4.tar.xz
[chore] bump dependencies (#4406)
- codeberg.org/gruf/go-ffmpreg: v0.6.9 -> v0.6.10 - github.com/ncruces/go-sqlite3: v0.27.1 -> v0.28.0 - github.com/stretchr/testify: v1.10.0 -> v1.11.1 - github.com/tdewolff/minify/v2 v2.23.11 -> v2.24.2 - go.opentelemetry.io/otel{,/*}: v1.37.0 -> v1.38.0 - go.opentelemetry.io/contrib/*: v0.62.0 -> v0.63.0 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4406 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go')
-rw-r--r--vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go
index ae1f59344..857eddf30 100644
--- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go
+++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go
@@ -183,8 +183,8 @@ func (p *expoHistogramDataPoint[N]) scaleChange(bin, startBin int32, length int)
var count int32
for high-low >= p.maxSize {
- low = low >> 1
- high = high >> 1
+ low >>= 1
+ high >>= 1
count++
if count > expoMaxScale-expoMinScale {
return count
@@ -225,7 +225,7 @@ func (b *expoBuckets) record(bin int32) {
b.counts = append(b.counts, make([]uint64, newLength-len(b.counts))...)
}
- copy(b.counts[shift:origLen+int(shift)], b.counts[:])
+ copy(b.counts[shift:origLen+int(shift)], b.counts)
b.counts = b.counts[:newLength]
for i := 1; i < int(shift); i++ {
b.counts[i] = 0
@@ -264,7 +264,7 @@ func (b *expoBuckets) downscale(delta int32) {
// new Counts: [4, 14, 30, 10]
if len(b.counts) <= 1 || delta < 1 {
- b.startBin = b.startBin >> delta
+ b.startBin >>= delta
return
}
@@ -282,7 +282,7 @@ func (b *expoBuckets) downscale(delta int32) {
lastIdx := (len(b.counts) - 1 + int(offset)) / int(steps)
b.counts = b.counts[:lastIdx+1]
- b.startBin = b.startBin >> delta
+ b.startBin >>= delta
}
// newExponentialHistogram returns an Aggregator that summarizes a set of
@@ -350,7 +350,9 @@ func (e *expoHistogram[N]) measure(
v.res.Offer(ctx, value, droppedAttr)
}
-func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int {
+func (e *expoHistogram[N]) delta(
+ dest *metricdata.Aggregation, //nolint:gocritic // The pointer is needed for the ComputeAggregation interface
+) int {
t := now()
// If *dest is not a metricdata.ExponentialHistogram, memory reuse is missed.
@@ -411,7 +413,9 @@ func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int {
return n
}
-func (e *expoHistogram[N]) cumulative(dest *metricdata.Aggregation) int {
+func (e *expoHistogram[N]) cumulative(
+ dest *metricdata.Aggregation, //nolint:gocritic // The pointer is needed for the ComputeAggregation interface
+) int {
t := now()
// If *dest is not a metricdata.ExponentialHistogram, memory reuse is missed.