alephant-logger-statsd 0.0.3 → 0.0.4

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: ef882b31b07d4f7cd88452a8772dfbf31f3cb409
4
- data.tar.gz: 52d018aaa0c2fb2545cd6ee46f96cc52995c3a6f
3
+ metadata.gz: bd711b8e74abebaeadb6ba78c7a624eff27ad0f4
4
+ data.tar.gz: 6c98774913384c6f03d0ee1e8d9e95285a576e7b
5
5
  SHA512:
6
- metadata.gz: 882c3fafa224f2dcc36aaf4894fcba060d9f8bd627e93fabcd6cf49fe9132a445be5cbb80f25ee1eda49d9cf61fcaf0e32c4329940be516015749be12e57a91f
7
- data.tar.gz: 0c8bd30ce8ee1dd91824108a9cce1fba1b5bc39624615d844a5a46358eb7c83dba899bcb8db30a304bc01a6560c63c8e13ea6c618f9f4c37bd8d7e176883249a
6
+ metadata.gz: c73a9cd9eea5dcec40e89b078fc183489a3a40ea3faa171735ed9a5ef26bdcac51c1f7bbd1ff3874fcfb0191a0a6268cda6b282c703490b6598346e6407bc7f0
7
+ data.tar.gz: a851fff284db31f06a77a89a61c2e037a4336432961848bdc439da5d4e49df191973222d5c6ea2f1e88b49c4c4fdc5ac88e0c5736586423c5ebea2a5bcfe7660
@@ -14,6 +14,10 @@ module Alephant
14
14
 
15
15
  alias metric increment
16
16
 
17
+ def timing(key, milliseconds, sample_rate = 1)
18
+ send_data { server.timing(key, milliseconds, sample_rate) }
19
+ end
20
+
17
21
  private
18
22
 
19
23
  attr_reader :server
@@ -1,7 +1,7 @@
1
1
  module Alephant
2
2
  module Logger
3
3
  class Statsd
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -5,7 +5,8 @@ describe Alephant::Logger::Statsd do
5
5
  let(:server) do
6
6
  instance_double(
7
7
  ::Statsd,
8
- :increment => true,
8
+ :increment => true,
9
+ :timing => true,
9
10
  :namespace= => true
10
11
  )
11
12
  end
@@ -27,7 +28,7 @@ describe Alephant::Logger::Statsd do
27
28
  specify do
28
29
  subject.new
29
30
  expect(::Statsd).to have_received(:new).once.with(
30
- config[:host],
31
+ config[:host],
31
32
  config[:port]
32
33
  )
33
34
  end
@@ -52,7 +53,7 @@ describe Alephant::Logger::Statsd do
52
53
  specify do
53
54
  subject.new config
54
55
  expect(::Statsd).to have_received(:new).once.with(
55
- config[:host],
56
+ config[:host],
56
57
  config[:port]
57
58
  )
58
59
  end
@@ -63,7 +64,7 @@ describe Alephant::Logger::Statsd do
63
64
  config[:namespace]
64
65
  )
65
66
  end
66
- end
67
+ end
67
68
  end
68
69
 
69
70
  describe "#increment" do
@@ -83,7 +84,50 @@ describe Alephant::Logger::Statsd do
83
84
  specify do
84
85
  driver.increment(key, interval).join
85
86
  expect(server).to have_received(:increment).once.with(key, interval)
86
- end
87
+ end
88
+ end
89
+ end
90
+
91
+ describe "#metric" do
92
+ let(:driver) { subject.new }
93
+ let(:key) { "batman" }
94
+
95
+ context "default interval" do
96
+ specify do
97
+ driver.metric(key).join
98
+ expect(server).to have_received(:increment).once.with(key, 1)
99
+ end
100
+ end
101
+
102
+ context "custom interval" do
103
+ let(:interval) { 10 }
104
+
105
+ specify do
106
+ driver.metric(key, interval).join
107
+ expect(server).to have_received(:increment).once.with(key, interval)
108
+ end
109
+ end
110
+ end
111
+
112
+ describe "#timing" do
113
+ let(:driver) { subject.new }
114
+ let(:key) { "batman" }
115
+ let(:time) { 512 }
116
+
117
+ context "default interval" do
118
+ specify do
119
+ driver.timing(key, time).join
120
+ expect(server).to have_received(:timing).once.with(key, time, 1)
121
+ end
122
+ end
123
+
124
+ context "custom interval" do
125
+ let(:interval) { 10 }
126
+
127
+ specify do
128
+ driver.timing(key, time, interval).join
129
+ expect(server).to have_received(:timing).once.with(key, time, interval)
130
+ end
87
131
  end
88
132
  end
89
133
  end
metadata CHANGED
@@ -1,123 +1,123 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-logger-statsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - BBC News
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-15 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: statsd-ruby
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
16
+ - - '>='
18
17
  - !ruby/object:Gem::Version
19
18
  version: '0'
20
- type: :runtime
19
+ name: statsd-ruby
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - "~>"
30
+ - - ~>
32
31
  - !ruby/object:Gem::Version
33
32
  version: '1.7'
34
- type: :development
33
+ name: bundler
35
34
  prerelease: false
35
+ type: :development
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.7'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - "~>"
44
+ - - ~>
46
45
  - !ruby/object:Gem::Version
47
46
  version: '10.0'
48
- type: :development
47
+ name: rake
49
48
  prerelease: false
49
+ type: :development
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec-nc
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
- - - ">="
58
+ - - '>='
60
59
  - !ruby/object:Gem::Version
61
60
  version: '0'
62
- type: :development
61
+ name: rspec-nc
63
62
  prerelease: false
63
+ type: :development
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: pry
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
- - - ">="
72
+ - - '>='
74
73
  - !ruby/object:Gem::Version
75
74
  version: '0'
76
- type: :development
75
+ name: pry
77
76
  prerelease: false
77
+ type: :development
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec
85
84
  requirement: !ruby/object:Gem::Requirement
86
85
  requirements:
87
- - - "~>"
86
+ - - ~>
88
87
  - !ruby/object:Gem::Version
89
88
  version: '3.1'
90
- type: :development
89
+ name: rspec
91
90
  prerelease: false
91
+ type: :development
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.1'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rake-rspec
99
98
  requirement: !ruby/object:Gem::Requirement
100
99
  requirements:
101
- - - ">="
100
+ - - '>='
102
101
  - !ruby/object:Gem::Version
103
102
  version: '0'
104
- type: :development
103
+ name: rake-rspec
105
104
  prerelease: false
105
+ type: :development
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- description:
111
+ description:
112
112
  email:
113
113
  - FutureMediaNewsRubyGems@bbc.co.uk
114
114
  executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - ".gitignore"
119
- - ".ruby-version"
120
- - ".travis.yml"
118
+ - .gitignore
119
+ - .ruby-version
120
+ - .travis.yml
121
121
  - Gemfile
122
122
  - LICENSE.txt
123
123
  - README.md
@@ -131,24 +131,24 @@ homepage: https://github.com/BBC-News/alephant-logger-statsd
131
131
  licenses:
132
132
  - MIT
133
133
  metadata: {}
134
- post_install_message:
134
+ post_install_message:
135
135
  rdoc_options: []
136
136
  require_paths:
137
137
  - lib
138
138
  required_ruby_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
- - - ">="
140
+ - - '>='
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - ">="
145
+ - - '>='
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  requirements: []
149
- rubyforge_project:
150
- rubygems_version: 2.4.8
151
- signing_key:
149
+ rubyforge_project:
150
+ rubygems_version: 2.1.9
151
+ signing_key:
152
152
  specification_version: 4
153
153
  summary: StatsD driver for Alephant Logger gem.
154
154
  test_files: