prometheus-client-mmap 0.7.0.beta4 → 0.7.0.beta5
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: 70cad9d30fe8702c5d934cc6303fcfd657e1c4ec
|
4
|
+
data.tar.gz: 11f7e6cac114e68260ea67a4aab5be3fa43b6259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c4347575300007df7c7dc03718f419fdbc1f49748433a4a10a74a3015efc7ee96f910a5fba27c333bb72f917dd00b22b3e8ba4ba6d4d2c46a6420a4c00f3c6c
|
7
|
+
data.tar.gz: a85b5b8f6a62232822f6759b6282f377e67e573318cb461fa850eaa4d783a9fd2140bb5e5cb99b3fd2861d2a9b7e8c8eeddfe3839b686c1779512caa695f2923
|
@@ -38,7 +38,7 @@ module Prometheus
|
|
38
38
|
(lines << nil).join(DELIMITER)
|
39
39
|
end
|
40
40
|
|
41
|
-
def self.marshal_multiprocess(path=
|
41
|
+
def self.marshal_multiprocess(path=Prometheus::Client::Multiprocdir)
|
42
42
|
metrics = {}
|
43
43
|
Dir.glob(File.join(path, "*.db")).each do |f|
|
44
44
|
parts = File.basename(f).split("_")
|
@@ -62,11 +62,8 @@ module Prometheus
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def respond_with(format)
|
65
|
-
|
66
|
-
|
67
|
-
else
|
68
|
-
response = format.marshal(@registry)
|
69
|
-
end
|
65
|
+
# For now we're only supporting mmapped ValueClass.
|
66
|
+
response = format.marshal_multiprocess
|
70
67
|
[
|
71
68
|
200,
|
72
69
|
{ 'Content-Type' => format::CONTENT_TYPE },
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
require 'quantile'
|
4
3
|
require 'prometheus/client/metric'
|
5
4
|
|
6
5
|
module Prometheus
|
@@ -17,23 +16,11 @@ module Prometheus
|
|
17
16
|
def initialize(type, name, labels)
|
18
17
|
@sum = ValueClass.new(type, name, "#{name}_sum", labels)
|
19
18
|
@total = ValueClass.new(type, name, "#{name}_count", labels)
|
20
|
-
@estimator = Quantile::Estimator.new
|
21
|
-
@estimator.invariants.each do |invariant|
|
22
|
-
self[invariant.quantile] = ValueClass.new(type, name, "#{name}_summary", labels.merge({:quantile => invariant.quantile}))
|
23
|
-
end
|
24
19
|
end
|
25
20
|
|
26
21
|
def observe(value)
|
27
22
|
@sum.increment(value)
|
28
23
|
@total.increment()
|
29
|
-
# TODO: The quantile info is innaccurate as it only contains
|
30
|
-
# observations per-process. What needs to happen is for
|
31
|
-
# observations to be read into the estimator and then reported.
|
32
|
-
# Alternatively it could be done in the exporter.
|
33
|
-
@estimator.observe(value)
|
34
|
-
@estimator.invariants.each do |invariant|
|
35
|
-
self[invariant.quantile].set(@estimator.query(invariant.quantile))
|
36
|
-
end
|
37
24
|
end
|
38
25
|
end
|
39
26
|
|
@@ -42,7 +42,7 @@ module Prometheus
|
|
42
42
|
|
43
43
|
@@files_lock.synchronize do
|
44
44
|
if !@@files.has_key?(file_prefix)
|
45
|
-
filename = File.join(
|
45
|
+
filename = File.join(Prometheus::Client::Multiprocdir, "#{file_prefix}_#{@@pid}.db")
|
46
46
|
@@files[file_prefix] = MmapedDict.new(filename)
|
47
47
|
end
|
48
48
|
end
|
@@ -90,9 +90,12 @@ module Prometheus
|
|
90
90
|
# and as that may be in some arbitrary library the user/admin has
|
91
91
|
# no control over we use an enviroment variable.
|
92
92
|
if ENV.has_key?('prometheus_multiproc_dir')
|
93
|
+
Multiprocdir = ENV['prometheus_multiproc_dir']
|
93
94
|
ValueClass = MmapedValue
|
94
95
|
else
|
95
|
-
|
96
|
+
# Only support mmap values for now.
|
97
|
+
Multiprocdir = '/var/run/gitlab/unicorn'
|
98
|
+
ValueClass = MmapedValue
|
96
99
|
end
|
97
100
|
end
|
98
101
|
end
|
@@ -201,4 +204,4 @@ class MmapedDict
|
|
201
204
|
end
|
202
205
|
values
|
203
206
|
end
|
204
|
-
end
|
207
|
+
end
|
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.7.0.
|
4
|
+
version: 0.7.0.beta5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schmidt
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.2.6
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: quantile
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.2.0
|
41
27
|
description:
|
42
28
|
email:
|
43
29
|
- ts@soundcloud.com
|
@@ -62,7 +48,7 @@ files:
|
|
62
48
|
- lib/prometheus/client/valuetype.rb
|
63
49
|
- lib/prometheus/client/version.rb
|
64
50
|
- lib/prometheus/client/version.rb.orig
|
65
|
-
homepage: https://
|
51
|
+
homepage: https://gitlab.com/gitlab-org/prometheus-client-mmap
|
66
52
|
licenses:
|
67
53
|
- Apache 2.0
|
68
54
|
metadata: {}
|