prometheus-client-mmap 1.3.0-arm64-darwin → 1.4.0-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/prometheus/client/histogram.rb +21 -9
- data/lib/prometheus/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b54132a55dad72faf97169cc4e795bece0d28e4e8adfb3b7b04475b204a2f17
|
|
4
|
+
data.tar.gz: dd1d5edaed8c9725bbb6af953028b52c7704d0a18c1427e06201ec1085a583d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e25bd5c602aaf9ebc175afed2d43ee2a2f09edac3dcb26990afdf0ffaa570e655a177f3a6e04236fb8436b57f19591954696d7261628fa3ae20b4343e482f9f7
|
|
7
|
+
data.tar.gz: 1fb362658fcff4b8b635a538ff910256f049db4809bc9bcb08635292ff4a9ecd57db111a46b954e761acc2967a4b7829b4d456a88796fad9ee794ac51831488f
|
|
@@ -12,29 +12,37 @@ module Prometheus
|
|
|
12
12
|
include UsesValueType
|
|
13
13
|
attr_accessor :sum, :total, :total_inf
|
|
14
14
|
|
|
15
|
-
def initialize(type, name, labels, buckets)
|
|
15
|
+
def initialize(type, name, labels, buckets, buckets_descending)
|
|
16
16
|
@sum = value_object(type, name, "#{name}_sum", labels)
|
|
17
17
|
@total = value_object(type, name, "#{name}_count", labels)
|
|
18
18
|
@total_inf = value_object(type, name, "#{name}_bucket", labels.merge(le: "+Inf"))
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
# Buckets are precomputed/frozen at the metric level; values hold
|
|
21
|
+
# references to avoid per-label duplication.
|
|
22
|
+
@buckets, @buckets_descending = buckets, buckets_descending
|
|
23
|
+
|
|
24
|
+
@buckets.each do |bucket|
|
|
21
25
|
self[bucket] = value_object(type, name, "#{name}_bucket", labels.merge(le: bucket.to_s))
|
|
22
26
|
end
|
|
23
27
|
end
|
|
24
28
|
|
|
25
29
|
def observe(value)
|
|
26
|
-
@sum.increment(value)
|
|
27
|
-
@total.increment()
|
|
28
30
|
@total_inf.increment()
|
|
31
|
+
@total.increment()
|
|
32
|
+
@sum.increment(value)
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
# Write buckets from largest to smallest so any reader always sees
|
|
35
|
+
# monotonic (cumulative) counts; stop once the observation no longer
|
|
36
|
+
# fits to skip needless increments.
|
|
37
|
+
@buckets_descending.each do |bucket|
|
|
38
|
+
break if value > bucket
|
|
39
|
+
self[bucket].increment()
|
|
32
40
|
end
|
|
33
41
|
end
|
|
34
42
|
|
|
35
43
|
def get()
|
|
36
44
|
hash = {}
|
|
37
|
-
|
|
45
|
+
@buckets.each do |bucket|
|
|
38
46
|
hash[bucket] = self[bucket].get()
|
|
39
47
|
end
|
|
40
48
|
hash
|
|
@@ -52,7 +60,11 @@ module Prometheus
|
|
|
52
60
|
buckets = DEFAULT_BUCKETS)
|
|
53
61
|
raise ArgumentError, 'Unsorted buckets, typo?' unless sorted? buckets
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
# Precompute both orders once per metric. Shared across all label sets
|
|
64
|
+
# to avoid per-value allocation and per-observe reverse calls.
|
|
65
|
+
@buckets = buckets.dup.freeze
|
|
66
|
+
@buckets_descending = @buckets.reverse.freeze
|
|
67
|
+
|
|
56
68
|
super(name, docstring, base_labels)
|
|
57
69
|
end
|
|
58
70
|
|
|
@@ -69,7 +81,7 @@ module Prometheus
|
|
|
69
81
|
|
|
70
82
|
def default(labels)
|
|
71
83
|
# TODO: default function needs to know key of hash info (label names and values)
|
|
72
|
-
Value.new(type, @name, labels, @buckets)
|
|
84
|
+
Value.new(type, @name, labels, @buckets, @buckets_descending)
|
|
73
85
|
end
|
|
74
86
|
|
|
75
87
|
def sorted?(bucket)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: prometheus-client-mmap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: arm64-darwin
|
|
6
6
|
authors:
|
|
7
7
|
- Tobias Schmidt
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2025-
|
|
14
|
+
date: 2025-12-02 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: base64
|