prometheus-client-mmap 0.7.0.beta17 → 0.7.0.beta18
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 125465cb67bfcdcce578b05e2533264d5a6f16bf
|
4
|
+
data.tar.gz: 8251ad819a49074395451366c33ed4e2e28c7efd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e6d918da65e60683c55306e74869a5b166ed21a8ba0b0512b11d9f1c817d625541300d06668e294bb99cdf5b3a6feacb24e990e6bf97249c1eadcb7d65fdf0
|
7
|
+
data.tar.gz: 50f9b80b2f9d2861e18105c6037cac59e8b282aaed402f571d4a75cbc43b2a1221b7c9ac1f6e8eadadefa189b502e4bc3697bd3c1fee6abbfcc98e6ac2f3a698
|
@@ -29,14 +29,10 @@ module Prometheus
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def ensure_process_exclusive_file(file_prefix = 'mmaped_file')
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
path = File.join(Prometheus::Client.configuration.multiprocess_files_dir, filename)
|
37
|
-
filename_number += 1
|
38
|
-
end
|
39
|
-
path
|
32
|
+
(0..Float::INFINITY).lazy
|
33
|
+
.map { |f_num| "#{file_prefix}_#{Prometheus::Client.pid}-#{f_num}.db" }
|
34
|
+
.map { |filename| File.join(Prometheus::Client.configuration.multiprocess_files_dir, filename) }
|
35
|
+
.find { |path| Helper::MmapedFile.lock_to_process(path) }
|
40
36
|
end
|
41
37
|
|
42
38
|
def open_process_exclusive_file(file_prefix = 'mmaped_file')
|
@@ -102,10 +98,6 @@ module Prometheus
|
|
102
98
|
self.pid = 0
|
103
99
|
end
|
104
100
|
|
105
|
-
def initial_mmap_file_size
|
106
|
-
Prometheus::Client.configuration.initial_mmap_file_size
|
107
|
-
end
|
108
|
-
|
109
101
|
def entries
|
110
102
|
return Enumerator.new {} if used.zero?
|
111
103
|
|
@@ -118,10 +110,11 @@ module Prometheus
|
|
118
110
|
encoded_len, = data.unpack('l')
|
119
111
|
padding_len = 8 - (encoded_len + 4) % 8
|
120
112
|
value_offset = 4 + encoded_len + padding_len
|
113
|
+
pos += value_offset
|
121
114
|
|
122
|
-
yielder.yield data, encoded_len, value_offset
|
115
|
+
yielder.yield data, encoded_len, value_offset, pos
|
123
116
|
|
124
|
-
pos +=
|
117
|
+
pos += 8
|
125
118
|
end
|
126
119
|
end
|
127
120
|
end
|
@@ -150,6 +143,10 @@ module Prometheus
|
|
150
143
|
|
151
144
|
private
|
152
145
|
|
146
|
+
def initial_mmap_file_size
|
147
|
+
Prometheus::Client.configuration.initial_mmap_file_size
|
148
|
+
end
|
149
|
+
|
153
150
|
def pid_alive?(pid)
|
154
151
|
begin
|
155
152
|
Process.getpgid(pid)
|
@@ -26,7 +26,7 @@ module Prometheus
|
|
26
26
|
@used = @m.used
|
27
27
|
|
28
28
|
@positions = {}
|
29
|
-
read_all_positions.each do |key,
|
29
|
+
read_all_positions.each do |key, pos|
|
30
30
|
@positions[key] = pos
|
31
31
|
end
|
32
32
|
rescue StandardError => e
|
@@ -37,7 +37,7 @@ module Prometheus
|
|
37
37
|
def self.read_all_values(f)
|
38
38
|
m = Helper::MmapedFile.open(f)
|
39
39
|
|
40
|
-
m.entries.map do |data, encoded_len, value_offset|
|
40
|
+
m.entries.map do |data, encoded_len, value_offset, _|
|
41
41
|
encoded, value = data.unpack(format('@4A%d@%dd', encoded_len, value_offset))
|
42
42
|
[encoded, value]
|
43
43
|
end
|
@@ -73,10 +73,6 @@ module Prometheus
|
|
73
73
|
Prometheus::Client.logger.warn("munmap raised error #{e}")
|
74
74
|
end
|
75
75
|
|
76
|
-
def initial_mmap_file_size
|
77
|
-
Prometheus::Client.configuration.initial_mmap_file_size
|
78
|
-
end
|
79
|
-
|
80
76
|
private
|
81
77
|
|
82
78
|
# Initialize a value. Lock must be held by caller.
|
@@ -89,11 +85,11 @@ module Prometheus
|
|
89
85
|
@positions[key] = @used - 8
|
90
86
|
end
|
91
87
|
|
92
|
-
# Yield (key,
|
88
|
+
# Yield (key, pos). No locking is performed.
|
93
89
|
def read_all_positions
|
94
|
-
@m.entries.map do |data, encoded_len,
|
90
|
+
@m.entries.map do |data, encoded_len, _, absolute_pos|
|
95
91
|
encoded, = data.unpack(format('@4A%d', encoded_len))
|
96
|
-
[encoded,
|
92
|
+
[encoded, absolute_pos]
|
97
93
|
end
|
98
94
|
end
|
99
95
|
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.beta18
|
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-10-
|
11
|
+
date: 2017-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mmap2
|