request-tracer 0.6.6 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZTgyMTNkZjI4NjExMWNkOWVjOWRhZWZiMjkwMGUxYTMxOTYxNGZmZQ==
5
- data.tar.gz: !binary |-
6
- ZTlhODA5YmRkM2E1ZDZjOTU2YWE3ZWRiZGJiYjZmNmQ5YWU1ZmYyYg==
2
+ SHA1:
3
+ metadata.gz: 0874c4286cf361e744ac5ce489ed21c18b8f0620
4
+ data.tar.gz: 5f415d9191a2b16bfd18cd704e26d3cab3b5a8b4
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YTU3Mzc2MTZmNWMyOTc1ZGNlNTBiNjliZTA5NGQ4M2E1MTQ0NjlhMDA5NWY1
10
- MTlmNmZmZDNmMjhiY2UyODU4ZTY4OWJiOGI5ZDJlYjFlZGQyNjc5ZDQ5MWYx
11
- NzQ2NzU1MmE2YzM5ZWFmZGY1YTBmZTVlZDMyNzU2YTI4ZTc5MzQ=
12
- data.tar.gz: !binary |-
13
- NzI3NGFjNGZiNmQ1MDE0NjhkODUzNjI5NWVmODIwNTRkZmZhMWUxM2NmNjQ5
14
- OWVhMzYwNTZmY2MyOGYwYWE1NzQxOTM1OTUzNjYzMjBiYzgxYzY0M2Q3YmI1
15
- MjcxYzliYWE2MjMzMTlkODQ5MzAyNzdjZDQyNWY5ZDdjOTc0ZmU=
6
+ metadata.gz: 2e5ef16f258b190e2dec5c28179659724e5ae548d7c68dfe4c72d843db9698a1a666b8b90054132e4d5c9a3ed23e6e73ed7d5e3045fb8bad8e5f506d346ccb7f
7
+ data.tar.gz: a8132487d2c8f8a50e27020716795974c226168646fefbab0464cb55ac56e48106923f733807f63b9d3fd2d2feae1c1066d8d7a99e43a4fad1531c5a506a817a
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.2.3
5
- - 2.3.0
4
+ - 2.2.5
5
+ - 2.3.3
6
6
  - jruby-head
7
7
  - rbx
8
8
  before_install:
data/README.md CHANGED
@@ -37,8 +37,29 @@ run MyApp.new
37
37
 
38
38
  Writing trace headers
39
39
  ---------------------
40
- Somewhere in your code (e.g. in an initializer under `config/initializers/request-tracing.rb`)
41
- add the following call:
40
+
41
+ ### RestClient
42
+
42
43
  ```ruby
44
+ # Somewhere in an initializer (e.g. under `config/initializers/request-tracing.rb`)
43
45
  RequestTracer.integrate_with(:rest_client)
46
+
47
+ # Perform rest calls as usual
48
+ RestClient.get("http://www.example.com")
49
+ ```
50
+
51
+ ### Faraday
52
+
53
+ ```ruby
54
+ # Somewhere in an initializer (e.g. under `config/initializers/request-tracing.rb`)
55
+ RequestTracer.integrate_with(:faraday)
56
+
57
+ # Client instantiation
58
+ client = Faraday.new("http://www.example.com/") do |conn|
59
+ conn.use :tracing
60
+ conn.adapter Faraday.default_adapter
61
+ end
62
+
63
+ # Perform rest calls as usual
64
+ client.get
44
65
  ```
@@ -7,10 +7,7 @@ module RequestTracer
7
7
  module FaradayHandler
8
8
  extend self
9
9
  def activate
10
- ::Faraday::Request.register_middleware(nil, tracing: FaradayTracing)
11
- builder = Faraday::RackBuilder.new
12
- builder.insert 0, FaradayTracing
13
- Faraday.default_connection_options.builder = builder
10
+ ::Faraday::Middleware.register_middleware tracing: FaradayTracing
14
11
  end
15
12
  end
16
13
  class FaradayTracing < ::Faraday::Middleware
@@ -1,3 +1,3 @@
1
1
  module RequestTracer
2
- VERSION = "0.6.6"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -17,7 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_development_dependency 'rest-client'
20
- spec.add_development_dependency 'faraday'
20
+ spec.add_development_dependency 'faraday', '~> 0.10.1'
21
+ spec.add_development_dependency 'typhoeus'
21
22
  spec.add_development_dependency 'sidekiq'
22
23
  spec.add_development_dependency 'bundler', '~> 1.7'
23
24
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -11,17 +11,30 @@ describe RequestTracer::Integration::FaradayHandler do
11
11
 
12
12
  let(:trace) { RequestTracer::Trace.create }
13
13
 
14
- before do
15
- RequestTracer::Trace.clear
16
- stub_request(:any, "www.example.com")
17
- allow(RequestTracer::Trace).to receive(:record) {|&block| block.call(trace) }
18
- Faraday.new("http://www.example.com/").get
19
- end
14
+ shared_examples_for "adding a tracing request header" do |adapter|
15
+ before do
16
+ RequestTracer::Trace.clear
17
+ stub_request(:any, "www.example.com")
18
+ allow(RequestTracer::Trace).to receive(:record) {|&block| block.call(trace) }
19
+ client = Faraday.new("http://www.example.com/") do |conn|
20
+ conn.use :tracing
21
+ conn.adapter adapter
22
+ end
23
+ client.get
24
+ end
20
25
 
21
- context "when no previous trace existed on the stack" do
22
- it "sets fresh trace headers on the outgoing call" do
23
- expect(WebMock).to have_requested(:get, "www.example.com").
24
- with(headers: extract_headers_from_fields(trace.to_h))
26
+ context "when no previous trace existed on the stack" do
27
+ it "sets fresh trace headers on the outgoing call" do
28
+ expect(WebMock).to have_requested(:get, "www.example.com").
29
+ with(headers: extract_headers_from_fields(trace.to_h))
30
+ end
25
31
  end
26
32
  end
33
+ context "with the default adapter" do
34
+ it_behaves_like "adding a tracing request header", :typhoeus
35
+ end
36
+ context "with the typhoeus adapter" do
37
+ require 'typhoeus/adapters/faraday'
38
+ it_behaves_like "adding a tracing request header", Faraday.default_adapter
39
+ end
27
40
  end
metadata CHANGED
@@ -1,223 +1,237 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request-tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Mauch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-29 00:00:00.000000000 Z
11
+ date: 2017-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.10.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: typhoeus
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
47
  version: '0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ! '>='
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: sidekiq
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ! '>='
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ! '>='
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ~>
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
75
  version: '1.7'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ~>
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '1.7'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rake
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ~>
87
+ - - "~>"
74
88
  - !ruby/object:Gem::Version
75
89
  version: '10.0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ~>
94
+ - - "~>"
81
95
  - !ruby/object:Gem::Version
82
96
  version: '10.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ~>
101
+ - - "~>"
88
102
  - !ruby/object:Gem::Version
89
103
  version: '3.4'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ~>
108
+ - - "~>"
95
109
  - !ruby/object:Gem::Version
96
110
  version: '3.4'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: generative
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ! '>='
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ! '>='
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rack-test
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - ~>
129
+ - - "~>"
116
130
  - !ruby/object:Gem::Version
117
131
  version: '0.6'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - ~>
136
+ - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0.6'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: webmock
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - ! '>='
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - ! '>='
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: guard
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - ~>
157
+ - - "~>"
144
158
  - !ruby/object:Gem::Version
145
159
  version: '2.13'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - ~>
164
+ - - "~>"
151
165
  - !ruby/object:Gem::Version
152
166
  version: '2.13'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: guard-rspec
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - ~>
171
+ - - "~>"
158
172
  - !ruby/object:Gem::Version
159
173
  version: '4.6'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - ~>
178
+ - - "~>"
165
179
  - !ruby/object:Gem::Version
166
180
  version: '4.6'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: guard-bundler
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - ~>
185
+ - - "~>"
172
186
  - !ruby/object:Gem::Version
173
187
  version: '2.1'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - ~>
192
+ - - "~>"
179
193
  - !ruby/object:Gem::Version
180
194
  version: '2.1'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: geminabox
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
- - - ! '>='
199
+ - - ">="
186
200
  - !ruby/object:Gem::Version
187
201
  version: '0'
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
- - - ! '>='
206
+ - - ">="
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: gem-release
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
- - - ! '>='
213
+ - - ">="
200
214
  - !ruby/object:Gem::Version
201
215
  version: '0'
202
216
  type: :development
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
- - - ! '>='
220
+ - - ">="
207
221
  - !ruby/object:Gem::Version
208
222
  version: '0'
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: pry
211
225
  requirement: !ruby/object:Gem::Requirement
212
226
  requirements:
213
- - - ! '>='
227
+ - - ">="
214
228
  - !ruby/object:Gem::Version
215
229
  version: '0'
216
230
  type: :development
217
231
  prerelease: false
218
232
  version_requirements: !ruby/object:Gem::Requirement
219
233
  requirements:
220
- - - ! '>='
234
+ - - ">="
221
235
  - !ruby/object:Gem::Version
222
236
  version: '0'
223
237
  description: This is a tracer that hooks into several components to allow tracing
@@ -228,10 +242,10 @@ executables: []
228
242
  extensions: []
229
243
  extra_rdoc_files: []
230
244
  files:
231
- - .gemrelease
232
- - .gitignore
233
- - .rspec
234
- - .travis.yml
245
+ - ".gemrelease"
246
+ - ".gitignore"
247
+ - ".rspec"
248
+ - ".travis.yml"
235
249
  - Gemfile
236
250
  - Guardfile
237
251
  - LICENSE
@@ -265,12 +279,12 @@ require_paths:
265
279
  - lib
266
280
  required_ruby_version: !ruby/object:Gem::Requirement
267
281
  requirements:
268
- - - ! '>='
282
+ - - ">="
269
283
  - !ruby/object:Gem::Version
270
284
  version: '0'
271
285
  required_rubygems_version: !ruby/object:Gem::Requirement
272
286
  requirements:
273
- - - ! '>='
287
+ - - ">="
274
288
  - !ruby/object:Gem::Version
275
289
  version: '0'
276
290
  requirements: []