mettric 0.1.11 → 0.1.12

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: 07e948b89a3afae759b17952440f77fdb35d8931
4
- data.tar.gz: 36d7b8ca5fc0f5c289eaa7fb5e0a6f39e24b39aa
3
+ metadata.gz: 555d7e8f5825dd4b4d33cdf1007a869854bab852
4
+ data.tar.gz: 6014b23f15ad3bbf4134fba45b2de25da778e57c
5
5
  SHA512:
6
- metadata.gz: c8be8ee40e62c9e12c23e0af5c9624cb688b2407e8d93e49d2f9f2d71d1dfc3c64143e9b8daab816412d3cce6f311ab92b4eeff0ad33881293a6e1825b579125
7
- data.tar.gz: 2a47f272c04c483906e8067588768880d3d0c754917acede9863ce6d398e55ca34a57d575acf3c3adb103b87e95eecfac800a8428640c7021a4b7af13d215908
6
+ metadata.gz: 0894d38c1412cdf571be55852bb3b61099805da54a8467803e5f6353a69e0445140a7925f4dabd0d91d5863aec1b5ff285147c875dcecb638c055f969e79701e
7
+ data.tar.gz: 63bf7b956aa464f4fa9e1a53eeb9fea1c89c37bce02fd8a5a3d465106a97b6af5727bbbe3115a29d7d8f024937692d964b9050e9e35d65372a4823857c3be21e
@@ -72,8 +72,7 @@ class Mettric::Client
72
72
  out = stringify(payload)
73
73
  raise Mettric::MissingService, out if out[:service].blank?
74
74
 
75
- out[:tags] ||= []
76
- out[:tags] << 'mettric'
75
+ out[:tags] = [out[:tags], :mettric].flatten.compact.uniq
77
76
  out[:tags] << env if env.present?
78
77
  out[:metric] ||= 1
79
78
 
@@ -19,6 +19,19 @@ class Mettric
19
19
  QUEUE.size
20
20
  end
21
21
 
22
+ # Tracking meter readings is the default
23
+ def self.meter(payload)
24
+ track(payload)
25
+ end
26
+
27
+ # To track events
28
+ def self.event(payload)
29
+ payload[:tags] ||= []
30
+ payload[:tags] << :event
31
+ track(payload)
32
+ end
33
+
34
+ # To track durations
22
35
  def self.time(payload)
23
36
  exception = nil
24
37
  state = 'success'
@@ -32,7 +45,7 @@ class Mettric
32
45
  payload[:service] = "#{payload[:service]} ms" unless payload[:service].to_s.end_with?(' ms')
33
46
  payload[:metric] = ((Time.now - start) * 1000).to_i
34
47
  payload[:tags] ||= []
35
- payload[:tags] << 'timing'
48
+ payload[:tags] << :timing
36
49
  track(payload)
37
50
  end
38
51
 
data/lib/mettric/scnr.rb CHANGED
@@ -1,11 +1,20 @@
1
- # SCNR
2
- def 🌡(payload)
3
- Mettric.track(payload)
1
+ # An event (to become a rate)
2
+ # https://youtu.be/pWso-qRaIlM?t=48
3
+ def 🛎 (payload)
4
+ Mettric.event(payload)
4
5
  rescue Mettric::CouldNotStartWorkerThread
5
6
  puts "***WARNING*** Mettric::CouldNotStartWorkerThread raised"
6
7
  end
7
8
 
8
- def ⏱(payload, &block)
9
+ # A meter
10
+ def 🌡 (payload)
11
+ Mettric.meter(payload)
12
+ rescue Mettric::CouldNotStartWorkerThread
13
+ puts "***WARNING*** Mettric::CouldNotStartWorkerThread raised"
14
+ end
15
+
16
+ # A duration
17
+ def ⏱ (payload, &block)
9
18
  Mettric.time(payload) do
10
19
  block.call
11
20
  end
@@ -1,3 +1,3 @@
1
1
  class Mettric
2
- VERSION = "0.1.11"
2
+ VERSION = "0.1.12"
3
3
  end
@@ -15,7 +15,7 @@ class Mettric::Worker
15
15
 
16
16
  def loop
17
17
  Mettric::Client.new(@config) do |client|
18
- deliver(client, service: 'mettric.worker.start') rescue nil
18
+ deliver(client, service: 'mettric.worker.start', metric: 1) rescue nil
19
19
  while payload = @queue.pop
20
20
  deliver(client, payload)
21
21
  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.11
4
+ version: 0.1.12
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-06-02 00:00:00.000000000 Z
11
+ date: 2016-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport