prometheus-client-mmap 0.7.0.beta9 → 0.7.0.beta10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24351728cd7ccff16974ea7cf72a781f3b393831
4
- data.tar.gz: aba591bd2540b26541949b3536a2b5fbc2850e72
3
+ metadata.gz: 8458ed064082dd282bb57a7f449da9042d57ec7c
4
+ data.tar.gz: 4fa6bab0e01f0bdac5260627afecf61a71bad2d7
5
5
  SHA512:
6
- metadata.gz: 5a6d7c3669a14ff150f3a7d79c119db34ed7a30404a6e69f0c6183e8c50b53325f6147fad8bbf5efd55137d00eef3c6e4c89b60c54e4dad8618753edc69bf06b
7
- data.tar.gz: ff9e4880b4847076b887d5c2ee07fe09fefb88d0806b840d6a65f21a8d4e1c3aca05e07ca94561ec97bf79f6450a95f4129a48c1eb9cdf982ac898797d4101a4
6
+ metadata.gz: a5ad6aa9d4c5a9351ae91baa4be9c1cd8757587bfc32fcdfb64e12d1d9e30faee558ad87f0434ef702263721f939a61087283a5fad0d8b782e4019101e6263f4
7
+ data.tar.gz: e7c731aad2ece103e9ea21d3f01221155435d3c85313fe85016b8d5390d8949d435247f957b4b93a55e780e20d83796381157bc02f9e4dfd8009d2093e915cf1
@@ -1,3 +1,5 @@
1
+ require 'prometheus/client'
2
+
1
3
  module Prometheus
2
4
  module Client
3
5
  class ParsingError < StandardError; end
@@ -18,7 +20,9 @@ module Prometheus
18
20
  def initialize(filename)
19
21
  @mutex = Mutex.new
20
22
  @f = File.open(filename, 'a+b')
21
- process_file_wrappe_error
23
+ process_file
24
+ rescue StandardError => e
25
+ raise ParsingError.new("exception #{e} while processing metrics file #{@f.path}")
22
26
  end
23
27
 
24
28
  # Yield (key, value, pos). No locking is performed.
@@ -49,19 +53,16 @@ module Prometheus
49
53
  @f.close
50
54
  end
51
55
 
52
- private
53
-
54
- def process_file_wrappe_error
55
- process_file
56
- rescue StandardError => e
57
- raise ParsingError.new("exception #{e} while processing metrics file #{@f.path}")
56
+ def initial_mmap_file_size
57
+ Prometheus::Client.configuration.initial_mmap_file_size
58
58
  end
59
59
 
60
+ private
61
+
60
62
  def process_file
61
63
  if @f.size < MINIMUM_SIZE
62
64
  @f.truncate(initial_mmap_file_size)
63
65
  end
64
- @f.truncate(initial_mmap_file_size)
65
66
 
66
67
  @capacity = @f.size
67
68
  @m = Mmap.new(@f.path, 'rw', Mmap::MAP_SHARED)
@@ -79,10 +80,6 @@ module Prometheus
79
80
  end
80
81
  end
81
82
 
82
- def initial_mmap_file_size
83
- Prometheus::Client.configuration.initial_mmap_file_size
84
- end
85
-
86
83
  # Initialize a value. Lock must be held by caller.
87
84
  def init_value(key)
88
85
  # Pad to be 8-byte aligned.
@@ -72,7 +72,7 @@ module Prometheus
72
72
  def read_value(key)
73
73
  @file.read_value(key)
74
74
  rescue StandardError => e
75
- Prometheus::Client.logger.warn("readomg value from #{@file.path} failed with #{e}")
75
+ Prometheus::Client.logger.warn("reading value from #{@file.path} failed with #{e}")
76
76
  end
77
77
  end
78
78
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prometheus
4
4
  module Client
5
- VERSION = '0.7.0.beta9'
5
+ VERSION = '0.7.0.beta10'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus-client-mmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.beta9
4
+ version: 0.7.0.beta10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schmidt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2017-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mmap2