nsa 0.2.8 → 0.3.0

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
  SHA256:
3
- metadata.gz: abd4fef5644f8f3c61e7aa019dcdc65a9b7b5438aef6627d6217547c8aba5ba6
4
- data.tar.gz: b5c9663cdb0e4bcb08dc187bee2be634c44634da57b3e4b5492844c668480cc5
3
+ metadata.gz: 37e17700593bdc086519eeb89241d961cb1f6f922e10989be1a6954167563be3
4
+ data.tar.gz: d0079fd977a6d6788941af123769d739f06fb9530c496e05c4c10a8660dcace5
5
5
  SHA512:
6
- metadata.gz: 6c862df27c47bf19b7ca6441eb227cb4d66e81109bf07735730f55dbafa2fee389a69784331894496fce61f8df4fb6404e138496e862d65055fdd652b24a201a
7
- data.tar.gz: 5d589a6580a300497f2bd98e1bc7733363e1a6cad6420834360d5b578f82617a4330bedc410a83dfae5067a40b4a1c6bff2c23ca9a0f322016a9fc37117aee37
6
+ metadata.gz: f3882d5dd4e2bf8e0c967a76faf16a8c0999d34621bcf76995adf9db748e55ede984a668a774dd9cf628606660e4f135b2952762ec89650e5d572d555ba98b42
7
+ data.tar.gz: 5e9fe626719980e222f37993a944680802027ccdf7906ae47d957f100fd52eaab595a5ffcc3f971b93a7d9c83d62cd1d5f4b9f2005073626b62c2e74056aecbe
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # NSA (National Statsd Agency)
2
2
 
3
- Listen to Rails `ActiveSupport::Notifications` and deliver to a [Statsd](https://github.com/reinh/statsd) backend.
4
- This gem also supports writing your own custom collectors.
3
+ Listen to Rails `ActiveSupport::Notifications` and deliver to a
4
+ [Statsd](https://github.com/reinh/statsd) backend. This gem also supports
5
+ writing your own custom collectors.
5
6
 
6
7
  [![Gem Version](https://badge.fury.io/rb/nsa.svg)](https://badge.fury.io/rb/nsa)
7
8
  [![Build Status](https://travis-ci.org/localshred/nsa.svg)](https://travis-ci.org/localshred/nsa)
@@ -24,8 +25,8 @@ Or install it yourself as:
24
25
 
25
26
  ## Usage
26
27
 
27
- NSA comes packaged with collectors for ActionController, ActiveRecord, ActiveSupport Caching,
28
- and Sidekiq.
28
+ NSA comes packaged with collectors for ActionController, ActiveRecord,
29
+ ActiveSupport Caching, and Sidekiq.
29
30
 
30
31
  To use this gem, simply get a reference to a statsd backend, then indicate which
31
32
  collectors you'd like to run. Each `collect` method specifies a Collector to use
@@ -106,11 +107,15 @@ Metrics recorded:
106
107
 
107
108
  ## Writing your own collector
108
109
 
109
- Writing your own collector is very simple. To take advantage of the keyspace handling you must:
110
+ Writing your own collector is very simple. To take advantage of the keyspace
111
+ handling you must:
110
112
 
111
- 1. Create an object/module which responds to `collect`, taking the `key_prefix` as its only argument.
112
- 2. Include or extend your class/module with `NSA::Statsd::Publisher` or `NSA::Statsd::Publisher`.
113
- 3. Call any of the `statsd_*` prefixed methods provided by the included Publisher:
113
+ 1. Create an object/module which responds to `collect`, taking the `key_prefix`
114
+ as its only argument.
115
+ 2. Include or extend your class/module with `NSA::Statsd::Publisher` or
116
+ `NSA::Statsd::Publisher`.
117
+ 3. Call any of the `statsd_*` prefixed methods provided by the included
118
+ Publisher:
114
119
 
115
120
  __`Publisher` methods:__
116
121
 
@@ -130,12 +135,13 @@ __`AsyncPublisher` methods:__
130
135
  + `async_statsd_time(key, sample_rate = nil, &block)`
131
136
  + `async_statsd_timing(key, sample_rate = nil, &block)`
132
137
 
133
- ___Note:___ When using the `AsyncPublisher`, the value is derived from the block. This is useful
134
- when the value is not near at hand and has a relatively high cost to compute (e.g. db query)
135
- and you don't want your current thread to wait.
138
+ ___Note:___ When using the `AsyncPublisher`, the value is derived from the
139
+ block. This is useful when the value is not near at hand and has a relatively
140
+ high cost to compute (e.g. db query) and you don't want your current thread to
141
+ wait.
136
142
 
137
- For example, first define your collector. Our (very naive) example will write
138
- a gauge metric every 10 seconds of the User count in the db.
143
+ For example, first define your collector. Our (very naive) example will write a
144
+ gauge metric every 10 seconds of the User count in the db.
139
145
 
140
146
  ```ruby
141
147
  # Publishing User.count gauge using a collector
@@ -189,11 +195,16 @@ the thread responsible for creating the record (and processing more callbacks).
189
195
 
190
196
  ## Development
191
197
 
192
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
198
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
199
+ `rake test` to run the tests. You can also run `bin/console` for an interactive
200
+ prompt that will allow you to experiment.
193
201
 
194
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
202
+ To install this gem onto your local machine, run `bundle exec rake install`. To
203
+ release a new version, update the version number in `version.rb`, and then run
204
+ `bundle exec rake release`, which will create a git tag for the version, push
205
+ git commits and tags, and push the `.gem` file to
206
+ [rubygems.org](https://rubygems.org).
195
207
 
196
208
  ## Contributing
197
209
 
198
210
  Bug reports and pull requests are welcome on GitHub at https://github.com/localshred/nsa.
199
-
@@ -25,7 +25,7 @@ module NSA
25
25
  end
26
26
 
27
27
  def call(worker, message, queue_name)
28
- worker_name = worker.class.name.tr("::", ".")
28
+ worker_name = worker.class.name.gsub("::", ".")
29
29
 
30
30
  statsd_time(make_key(worker_name, :processing_time)) do
31
31
  yield
data/lib/nsa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module NSA
2
- VERSION = "0.2.8"
2
+ VERSION = "0.3.0"
3
3
  end
data/nsa.gemspec CHANGED
@@ -19,13 +19,13 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "activesupport", "< 7", ">= 4.2"
22
+ spec.add_dependency "activesupport", "< 7.2", ">= 4.2"
23
23
  spec.add_dependency "concurrent-ruby", "~> 1.0", ">= 1.0.2"
24
24
  spec.add_dependency "sidekiq", ">= 3.5"
25
25
  spec.add_dependency "statsd-ruby", "~> 1.4", ">= 1.4.0"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 2.1"
28
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rake", "~> 13.0"
29
29
  spec.add_development_dependency "minitest", "~> 5.0"
30
30
  spec.add_development_dependency "mocha", "~> 1.11"
31
31
  spec.add_development_dependency "byebug", "~> 10"
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.8
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BJ Neilsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-12 00:00:00.000000000 Z
11
+ date: 2024-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: '7'
19
+ version: '7.2'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: '4.2'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - "<"
28
28
  - !ruby/object:Gem::Version
29
- version: '7'
29
+ version: '7.2'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '4.2'
@@ -104,14 +104,14 @@ dependencies:
104
104
  requirements:
105
105
  - - "~>"
106
106
  - !ruby/object:Gem::Version
107
- version: '10.0'
107
+ version: '13.0'
108
108
  type: :development
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - "~>"
113
113
  - !ruby/object:Gem::Version
114
- version: '10.0'
114
+ version: '13.0'
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: minitest
117
117
  requirement: !ruby/object:Gem::Requirement
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  requirements: []
204
- rubygems_version: 3.2.15
204
+ rubygems_version: 3.3.26
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: Publish Rails application metrics to statsd