mettric 0.1.1 → 0.1.2

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: 9a2285181b588c6f4765443ae11ee4bd9803ee32
4
- data.tar.gz: 2d626f504da61119a9b675444a05473af7732a1d
3
+ metadata.gz: e90960d6ac1ea5b24dff5c10434738169fb53e11
4
+ data.tar.gz: 47550cc9c25e78f8b382ff31533c0b97fcd5c0c7
5
5
  SHA512:
6
- metadata.gz: 4d1cf9921a93de477cfcef6161e93217660419d931ed364aff2074bf9c29af16218e397a32d53fa1cb2445a8ed6d412d34f717f950be8f34268e2612ba5e3f87
7
- data.tar.gz: 90b51b739c39ad34f701c8b730cdf1de28fed30b2b0620298914bde789a1b187a4c3cf624a3ec3443adc9838fc8c7e00617b0d97b679796fd5e7df3ccabef558
6
+ metadata.gz: 707d923b1083528530c289c438b9bdf0873f6b1edafa3b2eb5484f740546eca990b00129b13cc8a287980ac969e8290fecbf7ae10806ac74e542fdf64024bd7b
7
+ data.tar.gz: 638b91f7fad2d79a057d1e9fe2a238f310341cf8e3be00109c72d6348da3bf353df1275916aa2542f9f97420d18ec43b8d03855056bebf8ceda9f41a0ce4b651
@@ -57,6 +57,7 @@ class Mettric::Client
57
57
 
58
58
  def standardize_payload(payload)
59
59
  out = payload.symbolize_keys
60
+ raise Mettric::MissingService, out if out[:service].blank?
60
61
  out[:host] = host
61
62
  out[:service] = "#{app}.#{out[:service]}"
62
63
  out
@@ -1,3 +1,4 @@
1
1
  class Mettric::CouldNotStartWorkerThread < StandardError; end
2
2
  class Mettric::MissingAppName < StandardError; end
3
3
  class Mettric::MissingHostName < StandardError; end
4
+ class Mettric::MissingService < StandardError; end
@@ -15,6 +15,7 @@ class Mettric
15
15
  def self.track(payload)
16
16
  ensure_worker_running
17
17
  QUEUE << payload
18
+ QUEUE.size
18
19
  end
19
20
 
20
21
  def self.ensure_worker_running
@@ -26,7 +27,7 @@ class Mettric
26
27
  end
27
28
 
28
29
  def self.worker_running?
29
- @worker_thread and @worker_thread.alive?
30
+ @worker_thread && @worker_thread.alive?
30
31
  end
31
32
 
32
33
  def self.start_worker
@@ -1,3 +1,3 @@
1
1
  class Mettric
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -8,25 +8,30 @@ class Mettric::Worker
8
8
 
9
9
  def start
10
10
  return false if @started
11
+ puts "Mettric::Worker#start" if @config[:debug]
11
12
  @started = true
12
13
  loop
13
14
  end
14
15
 
15
16
  def loop
16
17
  Mettric::Client.new(@config) do |client|
18
+ deliver(client, service: 'Mettric Worker start') rescue nil
17
19
  while payload = @queue.pop
18
20
  deliver(client, payload)
19
21
  end
20
22
  end
23
+ binding.pry
21
24
  end
22
25
 
23
26
  def stop
27
+ puts "Mettric::Worker#stop" if @config[:debug]
24
28
  @started = false
25
29
  end
26
30
 
27
31
  private
28
32
 
29
33
  def deliver(client, payload)
34
+ puts "Mettric::Worker#deliver #{payload}" if @config[:debug]
30
35
  client << payload
31
36
  end
32
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mettric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jannis Hermanns
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2016-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport