nsa 0.2.7 → 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: 7ea321d956d0cfb66ec7a6e853d2d4fc0a4f0ab09a541c7c754c666c11ee4276
4
- data.tar.gz: d30f915d957d9e0cac40cfe34d5bb60c4b4671ead76bb8f903955a2bbc6ed009
3
+ metadata.gz: 37e17700593bdc086519eeb89241d961cb1f6f922e10989be1a6954167563be3
4
+ data.tar.gz: d0079fd977a6d6788941af123769d739f06fb9530c496e05c4c10a8660dcace5
5
5
  SHA512:
6
- metadata.gz: 92a56a3ff259df0ca26f874272cf5eb20401f92687c70053221470301483fa1e68e07b5587e585909643fdb6c560efe627499f5162cc227338115b93172de0f2
7
- data.tar.gz: 46f3abced73887e07c5fa61897a00e0b70dbc8a23b743fc08752ce609495240e19bff455c3fc76d2b517457477a1e88c70fa7d448f2afc1d40789d2329971e2c
6
+ metadata.gz: f3882d5dd4e2bf8e0c967a76faf16a8c0999d34621bcf76995adf9db748e55ede984a668a774dd9cf628606660e4f135b2952762ec89650e5d572d555ba98b42
7
+ data.tar.gz: 5e9fe626719980e222f37993a944680802027ccdf7906ae47d957f100fd52eaab595a5ffcc3f971b93a7d9c83d62cd1d5f4b9f2005073626b62c2e74056aecbe
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
4
- before_install: gem install bundler -v 1.10.6
3
+ - 2.6.5
4
+ before_install: gem install bundler -v 2.1.4
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.7"
2
+ VERSION = "0.3.0"
3
3
  end
data/nsa.gemspec CHANGED
@@ -19,14 +19,14 @@ 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", "< 6", ">= 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
- spec.add_development_dependency "bundler", "~> 1.10"
28
- spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "bundler", "~> 2.1"
28
+ spec.add_development_dependency "rake", "~> 13.0"
29
29
  spec.add_development_dependency "minitest", "~> 5.0"
30
- spec.add_development_dependency "mocha", "~> 1.5"
30
+ spec.add_development_dependency "mocha", "~> 1.11"
31
31
  spec.add_development_dependency "byebug", "~> 10"
32
32
  end
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.7
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BJ Neilsen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-11 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: '6'
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: '6'
29
+ version: '7.2'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '4.2'
@@ -90,28 +90,28 @@ dependencies:
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '1.10'
93
+ version: '2.1'
94
94
  type: :development
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
- version: '1.10'
100
+ version: '2.1'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: rake
103
103
  requirement: !ruby/object:Gem::Requirement
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
@@ -132,14 +132,14 @@ dependencies:
132
132
  requirements:
133
133
  - - "~>"
134
134
  - !ruby/object:Gem::Version
135
- version: '1.5'
135
+ version: '1.11'
136
136
  type: :development
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - "~>"
141
141
  - !ruby/object:Gem::Version
142
- version: '1.5'
142
+ version: '1.11'
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: byebug
145
145
  requirement: !ruby/object:Gem::Requirement
@@ -186,7 +186,7 @@ homepage: https://github.com/localshred/nsa
186
186
  licenses:
187
187
  - MIT
188
188
  metadata: {}
189
- post_install_message:
189
+ post_install_message:
190
190
  rdoc_options: []
191
191
  require_paths:
192
192
  - lib
@@ -201,9 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  requirements: []
204
- rubyforge_project:
205
- rubygems_version: 2.7.6
206
- signing_key:
204
+ rubygems_version: 3.3.26
205
+ signing_key:
207
206
  specification_version: 4
208
207
  summary: Publish Rails application metrics to statsd
209
208
  test_files: []