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 +4 -4
- data/Gemfile.lock +5 -1
- data/lib/traxor/faraday.rb +13 -0
- data/lib/traxor/rails.rb +2 -0
- data/lib/traxor/version.rb +1 -1
- data/lib/traxor.rb +1 -0
- data/traxor.gemspec +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec438dd90374fb5cde37ef7dbacda2b3e74c1ae1d825cfae4a4a2480f1f85c97
|
4
|
+
data.tar.gz: dfb668bc76e5e950b57ff7877d18d6febd2f7c5657d8a858da10f4c711ef9c3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
data/lib/traxor/version.rb
CHANGED
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.
|
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
|