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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8458ed064082dd282bb57a7f449da9042d57ec7c
|
4
|
+
data.tar.gz: 4fa6bab0e01f0bdac5260627afecf61a71bad2d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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("
|
75
|
+
Prometheus::Client.logger.warn("reading value from #{@file.path} failed with #{e}")
|
76
76
|
end
|
77
77
|
end
|
78
78
|
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.
|
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-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mmap2
|