meeseeks 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Makefile +4 -4
- data/lib/meeseeks/meeseeks.rb +22 -5
- data/lib/meeseeks/version.rb +1 -1
- data/lib/meeseeks.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ad8f7a1d3b3d90506c58b5cdb6213f3e22ee75262c252e8c892eef64825763c
|
4
|
+
data.tar.gz: d64864ea00952fc76f2f3660a79540d9002d4c2dd29dff7125b7898fa44c8d36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69d274bd2e7fb007c8f6580d4e99a3a40911ce1a14f3190bbdff4ff98799a6d53fefa76025b789b943373b994f3b651ba60a06b3070e05aa75aeb38c533977c0
|
7
|
+
data.tar.gz: 6e0b68f4d94018ef85dcf0af751b6f621c1a96d869fd64520ee4b4f01ec5d994cd1922f338a56447871630ae21c9be1f7b5eaca8c5f6f0cf13b3d09ecc600fee
|
data/Gemfile.lock
CHANGED
data/Makefile
CHANGED
@@ -12,16 +12,16 @@ build:
|
|
12
12
|
docker build -t coup-mobility/meeseeks .
|
13
13
|
|
14
14
|
bump-patch:
|
15
|
-
|
15
|
+
gem bump --version patch
|
16
16
|
|
17
17
|
bump-minor:
|
18
|
-
|
18
|
+
gem bump --version minor
|
19
19
|
|
20
20
|
bump-major:
|
21
|
-
|
21
|
+
gem bump --version major
|
22
22
|
|
23
23
|
release:
|
24
|
-
|
24
|
+
rake release
|
25
25
|
|
26
26
|
bundle:
|
27
27
|
docker-compose run meeseeks bash -l -c "bundle check || bundle install"
|
data/lib/meeseeks/meeseeks.rb
CHANGED
@@ -17,6 +17,7 @@ module Meeseeks
|
|
17
17
|
interval: nil,
|
18
18
|
max_batch_size: nil,
|
19
19
|
max_queue_size: nil)
|
20
|
+
@imploded = false
|
20
21
|
@queue = Queue.new
|
21
22
|
@interval = interval || ENV.fetch('MEESEEKS_INTERVAL', 60).to_i
|
22
23
|
@max_queue_size = max_queue_size ||
|
@@ -25,16 +26,16 @@ module Meeseeks
|
|
25
26
|
ENV.fetch('MEESEEKS_MAX_BATCH_SIZE', 1_000).to_i
|
26
27
|
@data_submission_url = data_submission_url ||
|
27
28
|
ENV.fetch('MEESEEKS_DATA_SUBMISSION_URL')
|
28
|
-
|
29
|
-
create_http_trap
|
30
|
-
start_harvester
|
29
|
+
start
|
31
30
|
end
|
32
31
|
|
33
32
|
def record!(group, metric, value, time = DateTime.now)
|
34
|
-
|
33
|
+
return false if @imploded
|
35
34
|
return false if @queue.size >= @max_queue_size
|
36
35
|
|
36
|
+
Payload.validate_type!(value)
|
37
37
|
@queue.push(Payload.for_group(group, metric, value, time))
|
38
|
+
|
38
39
|
true
|
39
40
|
end
|
40
41
|
|
@@ -48,12 +49,28 @@ module Meeseeks
|
|
48
49
|
{
|
49
50
|
queue_size: @queue.size,
|
50
51
|
harvester: @harvester.stats,
|
51
|
-
http_trap: @http_trap.stats
|
52
|
+
http_trap: @http_trap.stats,
|
53
|
+
imploded: @imploded
|
52
54
|
}
|
53
55
|
end
|
54
56
|
|
57
|
+
def implode!
|
58
|
+
return if @imploded
|
59
|
+
|
60
|
+
@imploded = true
|
61
|
+
harvester.stop
|
62
|
+
harvester.kill
|
63
|
+
queue.clear
|
64
|
+
queue.close
|
65
|
+
end
|
66
|
+
|
55
67
|
private
|
56
68
|
|
69
|
+
def start
|
70
|
+
create_http_trap
|
71
|
+
start_harvester
|
72
|
+
end
|
73
|
+
|
57
74
|
def create_http_trap
|
58
75
|
@http_trap = HTTPTrap.new(@data_submission_url)
|
59
76
|
end
|
data/lib/meeseeks/version.rb
CHANGED
data/lib/meeseeks.rb
CHANGED
@@ -8,12 +8,20 @@ module Meeseeks
|
|
8
8
|
extend SingleForwardable
|
9
9
|
|
10
10
|
def self.instance
|
11
|
-
@instance ||= Meeseeks.new(
|
11
|
+
@instance ||= Meeseeks.new(*(@configuration || {}))
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.configure(*args)
|
15
15
|
@configuration = args
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
def self.implode!
|
19
|
+
@instance&.implode!
|
20
|
+
@instance = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def_delegators(
|
24
|
+
:instance,
|
25
|
+
*(::Meeseeks::Meeseeks.instance_methods(false) - [:implode!])
|
26
|
+
)
|
19
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meeseeks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jannis Hermanns
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|