mnemosyne-ruby 1.7.0 → 1.7.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: fb2326f2e2297d704b1c3d859a2ee58069b3bacdde6048e81497608627d648c3
4
- data.tar.gz: fefd390b87f1f4c24ae2e4ad4cfc3c395680dfad02a1ade58cc3452546783878
3
+ metadata.gz: ac987a42c8acad894e9ba6f4a7a8f82978a070a814f1934740e972d872319483
4
+ data.tar.gz: fc1fce9f2aa11e6f01dc826a70d5130791191d4d6750a8f65239a70bd3c33c6a
5
5
  SHA512:
6
- metadata.gz: 3cbf49d3f0dd1266547b457111e4a04dc486aa427bbe8014bdac9c346d5a6449468c699d3db7f142241eeda8336da11c5c278cf44c278e5220273f14b4f9619b
7
- data.tar.gz: 0402611e591f645b4a3398d6e052caa23d6b54aab2e8f52812c05145c62bd44cc4c644f4b9cea0830adb92afd6f30a8a33639529eb46d3d7cf53245dc44bf058
6
+ metadata.gz: 3089578f4a14216d8f50d0aac9f2af6ef177051181629ee8f5956b5874f9396dca9723670bc5eb776b7a8cb0f24567c3a48714be5bf3b972166d9bda5371f41f
7
+ data.tar.gz: bc4c72f330ba74aec138fb31dcaa4acb9c53f426cda98c34abae7780fd30c076d0d39ce6f804497b7d40a5bc5dac659df798c57ecb7f692084c56ae087d2aca3
data/.travis.yml CHANGED
@@ -3,6 +3,10 @@ cache: bundler
3
3
  sudo: required
4
4
  services:
5
5
  - rabbitmq
6
+ addons:
7
+ apt:
8
+ packages:
9
+ - rabbitmq-server
6
10
  rvm:
7
11
  - 2.6.3
8
12
  - 2.5.5
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.7.1] - 2019-06-15
9
+ ### Fixed
10
+ - Reworked Faraday probe to not override connection middleware stack
11
+
8
12
  ## [1.7.0] - 2019-05-21
9
13
  ### Added
10
14
  - Restify probe: Attach HTTP response status (#12, #13)
@@ -78,7 +82,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
78
82
  ### Added
79
83
  - Add platform identifier
80
84
 
81
- [Unreleased]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.7.0...HEAD
85
+ [unreleased]: https://github.com/:mnemosyne-mon/mnemosyne-ruby/compare/v1.7.1...HEAD
86
+ [1.7.1]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.7.0...v1.7.1
82
87
  [1.7.0]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.6.2...v1.7.0
83
88
  [1.6.2]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.6.1...v1.6.2
84
89
  [1.6.1]: https://github.com/mnemosyne-mon/mnemosyne-ruby/compare/v1.6.0...v1.6.1
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+
5
+ module Mnemosyne
6
+ module Middleware
7
+ class Faraday < ::Faraday::Middleware
8
+ def initialize(app)
9
+ @app = app
10
+ end
11
+
12
+ def call(env)
13
+ trace = ::Mnemosyne::Instrumenter.current_trace
14
+
15
+ return @app.call(env) unless trace
16
+
17
+ span = ::Mnemosyne::Span.new 'external.http.faraday', \
18
+ meta: {url: env[:url].to_s, method: env[:method]}
19
+
20
+ span.start!
21
+
22
+ env[:request_headers].merge!({
23
+ 'X-Mnemosyne-Transaction' => trace.transaction,
24
+ 'X-Mnemosyne-Origin' => span.uuid,
25
+ }.reject {|_, v| v.nil? })
26
+
27
+ @app.call(env).on_complete do |env|
28
+ span.meta[:status] = env[:status]
29
+
30
+ trace << span.finish!
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -6,41 +6,27 @@ module Mnemosyne
6
6
  module Base
7
7
  class Probe < ::Mnemosyne::Probe
8
8
  def setup
9
- ::Faraday.default_connection_options = {
10
- builder: ::Faraday::RackBuilder.new do |faraday|
11
- faraday.use Probe::Middleware
12
- faraday.request :url_encoded
13
- faraday.adapter ::Faraday.default_adapter
14
- end
15
- }
16
- end
17
-
18
- class Middleware
19
- def initialize(app)
20
- @app = app
21
- end
22
-
23
- def call(env)
24
- trace = ::Mnemosyne::Instrumenter.current_trace
25
-
26
- return @app.call(env) unless trace
9
+ require 'mnemosyne/middleware/faraday'
27
10
 
28
- span = ::Mnemosyne::Span.new 'external.http.faraday', \
29
- meta: {url: env[:url].to_s, method: env[:method]}
11
+ ::Faraday::Middleware.register_middleware \
12
+ mnemosyne: ::Mnemosyne::Middleware::Faraday
30
13
 
31
- span.start!
32
-
33
- env[:request_headers].merge!({
34
- 'X-Mnemosyne-Transaction' => trace.transaction,
35
- 'X-Mnemosyne-Origin' => span.uuid,
36
- }.reject {|_, v| v.nil? })
37
-
38
- @app.call(env).on_complete do |env|
39
- span.meta[:status] = env[:status]
14
+ ::Faraday::RackBuilder.prepend Extension
15
+ end
16
+ end
40
17
 
41
- trace << span.finish!
18
+ module Extension
19
+ def lock!
20
+ if !@handlers.include?('Mnemosyne::Middleware::Faraday')
21
+ if respond_to?(:is_adapter?, true) &&
22
+ (idx = @handlers.find_index {|h| is_adapter?(h) })
23
+ insert(idx, ::Mnemosyne::Middleware::Faraday)
24
+ else
25
+ use(::Mnemosyne::Middleware::Faraday)
42
26
  end
43
27
  end
28
+
29
+ super
44
30
  end
45
31
  end
46
32
  end
@@ -4,7 +4,7 @@ module Mnemosyne
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 7
7
- PATCH = 0
7
+ PATCH = 1
8
8
  STAGE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mnemosyne-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-21 00:00:00.000000000 Z
11
+ date: 2019-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -82,6 +82,7 @@ files:
82
82
  - lib/mnemosyne/instrumenter.rb
83
83
  - lib/mnemosyne/logging.rb
84
84
  - lib/mnemosyne/middleware/acfs.rb
85
+ - lib/mnemosyne/middleware/faraday.rb
85
86
  - lib/mnemosyne/middleware/rack.rb
86
87
  - lib/mnemosyne/middleware/sidekiq.rb
87
88
  - lib/mnemosyne/probe.rb