prometheus-client-mmap 0.14.0 → 0.16.1

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.
@@ -37,7 +37,7 @@ module Prometheus
37
37
  valid?(labels)
38
38
 
39
39
  unless @validated.empty? || match?(labels, @validated.first.last)
40
- raise InvalidLabelSetError, 'labels must have the same signature'
40
+ raise InvalidLabelSetError, "labels must have the same signature: (#{label_diff(labels, @validated.first.last)})"
41
41
  end
42
42
 
43
43
  @validated[labels.hash] = labels
@@ -45,6 +45,10 @@ module Prometheus
45
45
 
46
46
  private
47
47
 
48
+ def label_diff(a, b)
49
+ "expected keys: #{b.keys.sort}, got: #{a.keys.sort}"
50
+ end
51
+
48
52
  def match?(a, b)
49
53
  a.keys.sort == b.keys.sort
50
54
  end
@@ -129,14 +129,10 @@ module Prometheus
129
129
 
130
130
 
131
131
  def rebuild_key
132
- labelnames = []
133
- labelvalues = []
134
- @labels.each do |k, v|
135
- labelnames << k
136
- labelvalues << v
137
- end
132
+ keys = @labels.keys.sort
133
+ values = @labels.values_at(*keys)
138
134
 
139
- [@metric_name, @name, labelnames, labelvalues].to_json
135
+ [@metric_name, @name, keys, values].to_json
140
136
  end
141
137
 
142
138
  def write_value(key, val)
@@ -1,5 +1,5 @@
1
1
  module Prometheus
2
2
  module Client
3
- VERSION = '0.14.0'.freeze
3
+ VERSION = '0.16.1'.freeze
4
4
  end
5
5
  end
@@ -37,6 +37,10 @@ module Prometheus
37
37
  ::Prometheus::Client::MmapedValue.reset_and_reinitialize
38
38
  end
39
39
 
40
+ def cleanup!
41
+ Dir.glob("#{configuration.multiprocess_files_dir}/*.db").each { |f| File.unlink(f) if File.exist?(f) }
42
+ end
43
+
40
44
  # With `force: false`: reinitializes metric files only for processes with the changed PID.
41
45
  # With `force: true`: reinitializes all metrics files.
42
46
  # Always keeps the registry.
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: 0.14.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schmidt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-08-25 00:00:00.000000000 Z
12
+ date: 2022-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fuzzbert
@@ -123,6 +123,7 @@ files:
123
123
  - lib/prometheus/client/counter.rb
124
124
  - lib/prometheus/client/formats/text.rb
125
125
  - lib/prometheus/client/gauge.rb
126
+ - lib/prometheus/client/helper/#json_parser.rb#
126
127
  - lib/prometheus/client/helper/entry_parser.rb
127
128
  - lib/prometheus/client/helper/file_locker.rb
128
129
  - lib/prometheus/client/helper/json_parser.rb
@@ -181,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
182
  - !ruby/object:Gem::Version
182
183
  version: '0'
183
184
  requirements: []
184
- rubygems_version: 3.1.4
185
+ rubygems_version: 3.3.16
185
186
  signing_key:
186
187
  specification_version: 4
187
188
  summary: A suite of instrumentation metric primitivesthat can be exposed through a