traxor 0.1.0 → 0.1.1

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: 4f38d4700fc78ffda8d70ee24a88781e81aeca12b7092e67ca158036975811f5
4
- data.tar.gz: d3d03579b0a62cc0f8a0843b73cb56eea94342a20f430884c54ad240eb5a9381
3
+ metadata.gz: ec438dd90374fb5cde37ef7dbacda2b3e74c1ae1d825cfae4a4a2480f1f85c97
4
+ data.tar.gz: dfb668bc76e5e950b57ff7877d18d6febd2f7c5657d8a858da10f4c711ef9c3a
5
5
  SHA512:
6
- metadata.gz: d4f7a77b434169c993c5715d4448d1dbc3c2d021e6bce2a4b1c5842aaf76ceb3a31d44cc54324f63077316f0e30bee10e3ba73c1a91ae904c0cddd70dfc38953
7
- data.tar.gz: 4fb15f2dac7b910e2f25a99ea132d854b185d250b86bbbe4f9370f9145274e9571f18e6efc57ea77755b11d5fe58408235d48f8960b9609b6b68d6bb8a3b6675
6
+ metadata.gz: 9405a4ff72bd63c76a1998d95d1a1e57a8597385e1b1904252ec3b9b325a7320886b0511b265f28e1ff0dd8000afb7534eef8003da448a2482d85a25f1d9ed84
7
+ data.tar.gz: 2bdc780c112972adbf939221a53a0ec9aaccd3dc3f97502f66b59d6b97df3d358555449d25ba70bde1f26d8320974e921ea2f78b4a4cc1514ccfeb5aefef5805
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- traxor (0.1.0)
4
+ traxor (0.1.1)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -70,6 +70,8 @@ GEM
70
70
  docile (1.3.0)
71
71
  equalizer (0.0.11)
72
72
  erubi (1.7.1)
73
+ faraday (0.15.0)
74
+ multipart-post (>= 1.2, < 3)
73
75
  globalid (0.4.1)
74
76
  activesupport (>= 4.2.0)
75
77
  i18n (1.0.1)
@@ -88,6 +90,7 @@ GEM
88
90
  mini_mime (1.0.0)
89
91
  mini_portile2 (2.3.0)
90
92
  minitest (5.11.3)
93
+ multipart-post (2.0.0)
91
94
  nio4r (2.3.0)
92
95
  nokogiri (1.8.2)
93
96
  mini_portile2 (~> 2.3.0)
@@ -196,6 +199,7 @@ PLATFORMS
196
199
 
197
200
  DEPENDENCIES
198
201
  bundler
202
+ faraday
199
203
  pry
200
204
  pry-byebug
201
205
  rails
@@ -0,0 +1,13 @@
1
+ module Traxor
2
+ ActiveSupport::Notifications.subscribe('request.faraday') do |*args|
3
+ event = ActiveSupport::Notifications::Event.new(*args)
4
+ url = event.payload[:url]
5
+ duration = event.duration || 0.0
6
+ tags = { host: normalize_name(url.host), method: normalize_name(event.payload[:method]) }
7
+
8
+ Metric.count 'faraday.request.count', 1, tags
9
+ Metric.count "faraday.request.count.#{tags[:host]}", 1, tags
10
+ Metric.measure 'farday.request.duration', "#{duration.to_f.round(2)}ms", tags
11
+ Metric.measure "farday.request.duration.#{tags[:host]}", "#{duration.to_f.round(2)}ms", tags
12
+ end
13
+ end
data/lib/traxor/rails.rb CHANGED
@@ -19,6 +19,8 @@ module Traxor
19
19
  end
20
20
 
21
21
  config.before_configuration do
22
+ require 'traxor/faraday' if defined?(Faraday)
23
+
22
24
  if defined?(Sidekiq)
23
25
  ::Sidekiq.server_middleware do |chain|
24
26
  require 'traxor/sidekiq'
@@ -1,3 +1,3 @@
1
1
  module Traxor
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
data/lib/traxor.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'active_support/configurable'
2
2
  require 'active_support/inflector/inflections'
3
3
  require 'logger'
4
+ require 'traxor/faraday' if defined?(Faraday)
4
5
  require 'traxor/metric'
5
6
  require 'traxor/rails' if defined?(Rails)
6
7
  require 'traxor/sidekiq' if defined?(Sidekiq)
data/traxor.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency 'activesupport'
24
24
 
25
25
  spec.add_development_dependency 'bundler'
26
+ spec.add_development_dependency 'faraday'
26
27
  spec.add_development_dependency 'pry'
27
28
  spec.add_development_dependency 'pry-byebug'
28
29
  spec.add_development_dependency 'rails'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traxor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Hansen
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: pry
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -201,6 +215,7 @@ files:
201
215
  - bin/rubocop
202
216
  - bin/setup
203
217
  - lib/traxor.rb
218
+ - lib/traxor/faraday.rb
204
219
  - lib/traxor/metric.rb
205
220
  - lib/traxor/rack/middleware/post.rb
206
221
  - lib/traxor/rack/middleware/pre.rb