nsa 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/nsa/statsd/publisher.rb +5 -3
- data/lib/nsa/statsd/subscriber.rb +3 -4
- data/lib/nsa/version.rb +1 -1
- metadata +3 -3
- data/tags +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7475edbaf8cc95205506f3c252b7ac8da45fc26
|
4
|
+
data.tar.gz: 402c2eee5ce3874a1a974651176e420f996e1b4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8d6e984c0e10594a1b728076c6321ebd378b979b62c360556036ae55f469f31efc1c75f66dc1a7e9d202e5c25af1bf7135ca235d3d371b62a6e6189a516c288
|
7
|
+
data.tar.gz: ca3c1672cd3b069fdabdd54f3582cdd2bc42702864615a685693d0c30b5efa4a5a1afacd144e8b3111768e521b619bd3dcdd208735ac541c9f0dd7359c2443b2
|
data/.gitignore
CHANGED
data/lib/nsa/statsd/publisher.rb
CHANGED
@@ -23,18 +23,20 @@ module NSA
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def statsd_time(key, sample_rate = nil, &block)
|
26
|
-
|
26
|
+
start = Time.now
|
27
|
+
result = block.call unless block.nil?
|
28
|
+
statsd_timing(key, ((Time.now - start) * 1000).round, sample_rate)
|
29
|
+
result
|
27
30
|
end
|
28
31
|
|
29
32
|
def statsd_timing(key, value = 1, sample_rate = nil)
|
30
33
|
__statsd_publish(:timing, key, value, sample_rate)
|
31
34
|
end
|
32
35
|
|
33
|
-
def __statsd_publish(stat_type, key, value = nil, sample_rate = nil
|
36
|
+
def __statsd_publish(stat_type, key, value = nil, sample_rate = nil)
|
34
37
|
payload = { :key => key }
|
35
38
|
payload.merge!({ :value => value }) if value
|
36
39
|
payload.merge!({ :sample_rate => sample_rate }) if sample_rate
|
37
|
-
payload.merge!({ :block => block }) if block_given?
|
38
40
|
|
39
41
|
::ActiveSupport::Notifications.instrument("#{stat_type}.statsd", payload)
|
40
42
|
end
|
@@ -21,14 +21,13 @@ module NSA
|
|
21
21
|
|
22
22
|
key_name = payload[:key]
|
23
23
|
sample_rate = payload.fetch(:sample_rate, 1)
|
24
|
-
block = payload[:block]
|
25
24
|
|
26
25
|
case action.to_sym
|
27
26
|
when :count, :timing, :set, :gauge then
|
28
27
|
value = payload.fetch(:value) { 1 }
|
29
|
-
backend.__send__(action, key_name, value, sample_rate
|
30
|
-
when :increment, :decrement
|
31
|
-
backend.__send__(action, key_name, sample_rate
|
28
|
+
backend.__send__(action, key_name, value, sample_rate)
|
29
|
+
when :increment, :decrement then
|
30
|
+
backend.__send__(action, key_name, sample_rate)
|
32
31
|
end
|
33
32
|
end
|
34
33
|
|
data/lib/nsa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nsa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BJ Neilsen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -164,7 +164,6 @@ files:
|
|
164
164
|
- lib/nsa/statsd/subscriber.rb
|
165
165
|
- lib/nsa/version.rb
|
166
166
|
- nsa.gemspec
|
167
|
-
- tags
|
168
167
|
homepage: https://www.github.com/localshred/nsa
|
169
168
|
licenses: []
|
170
169
|
metadata: {}
|
@@ -190,3 +189,4 @@ specification_version: 4
|
|
190
189
|
summary: Listen to your Rails ActiveSupport::Notifications and deliver to a Statsd
|
191
190
|
backend.
|
192
191
|
test_files: []
|
192
|
+
has_rdoc:
|
data/tags
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
2
|
-
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
3
|
-
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
|
4
|
-
!_TAG_PROGRAM_NAME Exuberant Ctags //
|
5
|
-
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
6
|
-
!_TAG_PROGRAM_VERSION 5.8 //
|
7
|
-
ActionController lib/nsa/collectors/action_controller.rb /^ module ActionController$/;" m class:NSA.Collectors
|
8
|
-
ActiveRecord lib/nsa/collectors/active_record.rb /^ module ActiveRecord$/;" m class:NSA.Collectors
|
9
|
-
ActiveSupportCache lib/nsa/collectors/active_support_cache.rb /^ module ActiveSupportCache$/;" m class:NSA.Collectors
|
10
|
-
CACHE_TYPES lib/nsa/collectors/active_support_cache.rb /^ CACHE_TYPES = {$/;" c
|
11
|
-
COLLECTOR_TYPES lib/nsa/statsd_informant.rb /^ COLLECTOR_TYPES = ::Hash.new(::NSA::Collectors::Null).merge({$/;" c
|
12
|
-
Collectors lib/nsa/collectors/action_controller.rb /^ module Collectors$/;" m class:NSA
|
13
|
-
Collectors lib/nsa/collectors/active_record.rb /^ module Collectors$/;" m class:NSA
|
14
|
-
Collectors lib/nsa/collectors/active_support_cache.rb /^ module Collectors$/;" m class:NSA
|
15
|
-
Collectors lib/nsa/collectors/null.rb /^ module Collectors$/;" m class:NSA
|
16
|
-
Collectors lib/nsa/collectors/sidekiq.rb /^ module Collectors$/;" m class:NSA
|
17
|
-
EMPTY_MATCH_RESULT lib/nsa/collectors/active_record.rb /^ EMPTY_MATCH_RESULT = []$/;" c
|
18
|
-
EXPECTED_RESPONDABLE_METHODS lib/nsa/statsd/subscriber.rb /^ EXPECTED_RESPONDABLE_METHODS = %i( count decrement gauge increment set time timing ).freeze$/;" c
|
19
|
-
LoadError lib/nsa/collectors/sidekiq.rb /^ rescue ::LoadError => exception$/;" c
|
20
|
-
MATCHERS lib/nsa/collectors/active_record.rb /^ MATCHERS = [$/;" c
|
21
|
-
NSA lib/nsa.rb /^module NSA$/;" m
|
22
|
-
NSA lib/nsa/collectors/action_controller.rb /^module NSA$/;" m
|
23
|
-
NSA lib/nsa/collectors/active_record.rb /^module NSA$/;" m
|
24
|
-
NSA lib/nsa/collectors/active_support_cache.rb /^module NSA$/;" m
|
25
|
-
NSA lib/nsa/collectors/null.rb /^module NSA$/;" m
|
26
|
-
NSA lib/nsa/collectors/sidekiq.rb /^module NSA$/;" m
|
27
|
-
NSA lib/nsa/statsd/publisher.rb /^module NSA$/;" m
|
28
|
-
NSA lib/nsa/statsd/subscriber.rb /^module NSA$/;" m
|
29
|
-
NSA lib/nsa/statsd_informant.rb /^module NSA$/;" m
|
30
|
-
NSA lib/nsa/version.rb /^module NSA$/;" m
|
31
|
-
Null lib/nsa/collectors/null.rb /^ module Null$/;" m class:NSA.Collectors
|
32
|
-
Publisher lib/nsa/statsd/publisher.rb /^ module Publisher$/;" m class:NSA.Statsd
|
33
|
-
Sidekiq lib/nsa/collectors/sidekiq.rb /^ class Sidekiq$/;" c class:NSA.Collectors
|
34
|
-
Statsd lib/nsa/statsd/publisher.rb /^ module Statsd$/;" m class:NSA
|
35
|
-
Statsd lib/nsa/statsd/subscriber.rb /^ module Statsd$/;" m class:NSA
|
36
|
-
StatsdInformant lib/nsa/statsd_informant.rb /^ module StatsdInformant$/;" m class:NSA
|
37
|
-
Subscriber lib/nsa/statsd/subscriber.rb /^ module Subscriber$/;" m class:NSA.Statsd
|
38
|
-
VERSION lib/nsa/version.rb /^ VERSION = "0.1.4"$/;" c
|
39
|
-
__send_event_to_statsd lib/nsa/statsd/subscriber.rb /^ def __send_event_to_statsd(backend, name, start, finish, id, payload)$/;" f class:NSA.Statsd.Subscriber
|
40
|
-
__statsd_publish lib/nsa/statsd/publisher.rb /^ def __statsd_publish(stat_type, key, value = nil, sample_rate = nil, &block)$/;" f class:NSA.Statsd.Publisher
|
41
|
-
backend_valid? lib/nsa/statsd/subscriber.rb /^ def backend_valid?(backend)$/;" f class:NSA.Statsd.Subscriber
|
42
|
-
call lib/nsa/collectors/sidekiq.rb /^ def call(worker, message, queue_name)$/;" f class:NSA.Collectors.Sidekiq
|
43
|
-
collect lib/nsa/collectors/action_controller.rb /^ def self.collect(key_prefix)$/;" F class:NSA.Collectors.ActionController
|
44
|
-
collect lib/nsa/collectors/active_record.rb /^ def self.collect(key_prefix)$/;" F class:NSA.Collectors.ActiveRecord
|
45
|
-
collect lib/nsa/collectors/active_support_cache.rb /^ def self.collect(key_prefix)$/;" F class:NSA.Collectors.ActiveSupportCache
|
46
|
-
collect lib/nsa/collectors/null.rb /^ def self.collect(*_)$/;" F class:NSA.Collectors.Null
|
47
|
-
collect lib/nsa/collectors/sidekiq.rb /^ def self.collect(key_prefix)$/;" F class:NSA.Collectors.Sidekiq
|
48
|
-
collect lib/nsa/statsd_informant.rb /^ def self.collect(collector, key_prefix)$/;" F class:NSA.StatsdInformant
|
49
|
-
inform_statsd lib/nsa.rb /^ def self.inform_statsd(backend)$/;" F class:NSA
|
50
|
-
initialize lib/nsa/collectors/sidekiq.rb /^ def initialize(key_prefix)$/;" f class:NSA.Collectors.Sidekiq
|
51
|
-
listen lib/nsa/statsd_informant.rb /^ def self.listen(backend)$/;" F class:NSA.StatsdInformant
|
52
|
-
make_key lib/nsa/collectors/sidekiq.rb /^ def make_key(*args)$/;" f class:NSA.Collectors.Sidekiq
|
53
|
-
match_query lib/nsa/collectors/active_record.rb /^ def self.match_query(sql)$/;" F class:NSA.Collectors
|
54
|
-
publish_overall_stats lib/nsa/collectors/sidekiq.rb /^ def publish_overall_stats$/;" f class:NSA.Collectors.Sidekiq
|
55
|
-
publish_queue_size_and_latency lib/nsa/collectors/sidekiq.rb /^ def publish_queue_size_and_latency(queue_name)$/;" f class:NSA.Collectors.Sidekiq
|
56
|
-
statsd_count lib/nsa/statsd/publisher.rb /^ def statsd_count(key, value = 1, sample_rate = nil)$/;" f class:NSA.Statsd.Publisher
|
57
|
-
statsd_decrement lib/nsa/statsd/publisher.rb /^ def statsd_decrement(key, sample_rate = nil)$/;" f class:NSA.Statsd.Publisher
|
58
|
-
statsd_gauge lib/nsa/statsd/publisher.rb /^ def statsd_gauge(key, value = 1, sample_rate = nil)$/;" f class:NSA.Statsd.Publisher
|
59
|
-
statsd_increment lib/nsa/statsd/publisher.rb /^ def statsd_increment(key, sample_rate = nil)$/;" f class:NSA.Statsd.Publisher
|
60
|
-
statsd_set lib/nsa/statsd/publisher.rb /^ def statsd_set(key, value = 1, sample_rate = nil)$/;" f class:NSA.Statsd.Publisher
|
61
|
-
statsd_subscribe lib/nsa/statsd/subscriber.rb /^ def statsd_subscribe(backend)$/;" f class:NSA.Statsd.Subscriber
|
62
|
-
statsd_time lib/nsa/statsd/publisher.rb /^ def statsd_time(key, sample_rate = nil, &block)$/;" f class:NSA.Statsd.Publisher
|
63
|
-
statsd_timing lib/nsa/statsd/publisher.rb /^ def statsd_timing(key, value = 1, sample_rate = nil)$/;" f class:NSA.Statsd.Publisher
|