roqua-support 0.1.18 → 0.1.19

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: b1260f5e2577e4a24dd4f9868b47584002aed67f
4
- data.tar.gz: 5bcbec3a34712d84f960bae3e4d473b47adbb9e4
3
+ metadata.gz: 54d706d399e594e9134c31f0fe79b7411bc9feb6
4
+ data.tar.gz: b7b0e7cf40671cc9bd9a24a266e55dd2cc342318
5
5
  SHA512:
6
- metadata.gz: 888335569ebbdfca84dc88b7c5f15f07691b405310c457de37fee368cf4dec09774e5a43bd48b4f45fbd42eeb5c069d5e36f1be584e71fe75d4579c42990d327
7
- data.tar.gz: 68cf75c3c2da7ac90c10b5ea38581a96c8c6ab500d55981d218de8562196aa3ad15d1e9a1cb62045a2eff6c6fafd11a713873a7180c3a4fe333a13612c3ecfa0
6
+ metadata.gz: 0a3a19acaff5ebfbd26431073f5cf83f0abb332a93628cc98d85190e54ecede61da2939c140d6acdf318e18a583448bad36b9f33b4dc817e4e7caace7c9d3105
7
+ data.tar.gz: 5a1fd2afb46ca30fea972a4d0f6dc16812ac736137e42db9c77318c86d18050c0d9b9a65ecb3c6db075cd8993c8c7b66d24e3b634cecbf7d2142e11f97bf1d2c
@@ -1,3 +1,7 @@
1
+ ## 0.1.19
2
+
3
+ * Add active_interaction/rails_instrumentation
4
+
1
5
  ## 0.1.18
2
6
 
3
7
  * Fix default stats backend
data/Gemfile CHANGED
@@ -10,4 +10,5 @@ group :test do
10
10
  gem 'rspec-rails'
11
11
  gem 'combustion', '~> 0.5.2'
12
12
  gem 'active_interaction', '~> 1.0'
13
+ gem 'rspec-instrumentation-matcher'
13
14
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roqua-support (0.1.18)
4
+ roqua-support (0.1.19)
5
5
  activesupport (>= 3.2, < 5.0)
6
6
  naught (~> 1.0)
7
7
 
@@ -88,6 +88,9 @@ GEM
88
88
  rspec-expectations (3.0.4)
89
89
  diff-lcs (>= 1.2.0, < 2.0)
90
90
  rspec-support (~> 3.0.0)
91
+ rspec-instrumentation-matcher (0.0.4)
92
+ activesupport
93
+ rspec-expectations
91
94
  rspec-mocks (3.0.4)
92
95
  rspec-support (~> 3.0.0)
93
96
  rspec-rails (3.0.2)
@@ -121,4 +124,5 @@ DEPENDENCIES
121
124
  rake
122
125
  roqua-support!
123
126
  rspec (>= 2.12.0, < 4.0)
127
+ rspec-instrumentation-matcher
124
128
  rspec-rails
data/README.md CHANGED
@@ -5,11 +5,11 @@ useful to have in RoQua's applications, but have nothing to with the domain.
5
5
 
6
6
  ## Usage
7
7
 
8
- ### Logging
8
+ ### Instrumentation
9
9
 
10
10
  ```ruby
11
11
  class Example
12
- include Roqua::Logging
12
+ include Roqua::Support::Instrumentation
13
13
 
14
14
  def methodname
15
15
  # This writes a single line to the event log with
@@ -27,15 +27,18 @@ class Example
27
27
  sleep 5
28
28
  end
29
29
  end
30
-
31
- def third
32
- # This example is the same as the `another` example.
33
- sleep 5
34
- end
35
- log :third, 'example.lifecycle', optional: 'params'
36
30
  end
37
31
  ```
38
32
 
33
+ ### Rails instrumentation for active_interaction operations
34
+
35
+ ```ruby
36
+ # Adds the instrumentation around all active_interaction operations:
37
+ # ActiveSupport::Notifications.instrument 'operation.active_interaction',
38
+ # class_name: self.class.to_s.underscore do
39
+ require 'roqua/core_ext/active_interaction/rails_instrumentation'
40
+ ```
41
+
39
42
  ### Rails logger
40
43
 
41
44
  You can also add an additional request logger by adding this to `config/initializers/request_logger.rb`:
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module Support
3
- VERSION = '0.1.18'
3
+ VERSION = '0.1.19'
4
4
  end
5
5
  end
@@ -0,0 +1,12 @@
1
+ require 'active_support/notifications.rb'
2
+
3
+ module RoquaRailsActiveInteractionInstrumentation
4
+ def run
5
+ ActiveSupport::Notifications.instrument 'operation.active_interaction',
6
+ class_name: self.class.to_s.underscore do
7
+ super
8
+ end
9
+ end
10
+ end
11
+
12
+ ActiveInteraction::Base.include RoquaRailsActiveInteractionInstrumentation
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require 'rspec-instrumentation-matcher'
3
+ require 'active_interaction'
4
+ require 'active_support/all'
5
+ require 'roqua/core_ext/active_interaction/rails_instrumentation'
6
+
7
+ class AIRailsInstrumentationTest < ActiveInteraction::Base
8
+ string :foo, default: 'bar'
9
+
10
+ def execute
11
+ end
12
+ end
13
+
14
+ describe RoquaRailsActiveInteractionInstrumentation do
15
+ include RSpec::Instrumentation::Matcher
16
+ it 'creates an event' do
17
+ expect { AIRailsInstrumentationTest.run }.to instrument('operation.active_interaction').with(
18
+ class_name: 'ai_rails_instrumentation_test')
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -113,6 +113,7 @@ files:
113
113
  - lib/roqua-support/version.rb
114
114
  - lib/roqua/core_ext/active_interaction/filters/date_time_as_unix_extension.rb
115
115
  - lib/roqua/core_ext/active_interaction/filters/duration_filter.rb
116
+ - lib/roqua/core_ext/active_interaction/rails_instrumentation.rb
116
117
  - lib/roqua/core_ext/activerecord/uniq_find_or_create.rb
117
118
  - lib/roqua/core_ext/array/stable_sort_by.rb
118
119
  - lib/roqua/core_ext/enumerable/sort_by_alphanum.rb
@@ -131,6 +132,7 @@ files:
131
132
  - roqua-support.gemspec
132
133
  - spec/roqua/core_ext/active_interaction/date_time_as_unix_extension_spec.rb
133
134
  - spec/roqua/core_ext/active_interaction/duration_filter_spec.rb
135
+ - spec/roqua/core_ext/active_interaction/rails_intrumentation_spec.rb
134
136
  - spec/roqua/core_ext/activerecord/uniq_find_or_create_spec.rb
135
137
  - spec/roqua/core_ext/array/stable_sort_by_spec.rb
136
138
  - spec/roqua/core_ext/enumerable/sort_by_alphanum_spec.rb
@@ -165,13 +167,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
167
  version: '0'
166
168
  requirements: []
167
169
  rubyforge_project:
168
- rubygems_version: 2.2.2
170
+ rubygems_version: 2.4.3
169
171
  signing_key:
170
172
  specification_version: 4
171
173
  summary: Helper objects and proxies used by a lot of RoQua applications
172
174
  test_files:
173
175
  - spec/roqua/core_ext/active_interaction/date_time_as_unix_extension_spec.rb
174
176
  - spec/roqua/core_ext/active_interaction/duration_filter_spec.rb
177
+ - spec/roqua/core_ext/active_interaction/rails_intrumentation_spec.rb
175
178
  - spec/roqua/core_ext/activerecord/uniq_find_or_create_spec.rb
176
179
  - spec/roqua/core_ext/array/stable_sort_by_spec.rb
177
180
  - spec/roqua/core_ext/enumerable/sort_by_alphanum_spec.rb
@@ -186,3 +189,4 @@ test_files:
186
189
  - spec/roqua/support/stats_spec.rb
187
190
  - spec/roqua/support_spec.rb
188
191
  - spec/spec_helper.rb
192
+ has_rdoc: