faraday-tracer 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +34 -0
- data/Rakefile +6 -3
- data/bin/console +3 -3
- data/faraday-tracer.gemspec +10 -8
- data/lib/faraday/tracer.rb +8 -8
- data/lib/faraday/tracer/version.rb +3 -1
- metadata +52 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 757004104d14a23593e81d9ff123168049e80dfe8c9110d447292b5015dd7ba8
|
4
|
+
data.tar.gz: dbf7dd70ebb93b714bdf8312c7b1fa3fb4661111161047da6d7a9b781d7ac47c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 184f6c154460756b1054e9e2d84b97431ced091b7b019e6571fe090221fb74612fea0532340aef502a76c58119b539c5247fcbc2e7e50a9c1977acfbb30ca45a
|
7
|
+
data.tar.gz: 6a6ea73727b67e8d0dd5c67d0c2e944c53e3cf729e9cd11d7012a14d9266d510e31bb7617ed9f9971ad89e38a7a4435cef04ca4f05c5ebe21349e13b6c19f24e
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
Metrics/AbcSize:
|
4
|
+
Enabled: no
|
5
|
+
|
6
|
+
Metrics/BlockLength:
|
7
|
+
Enabled: no
|
8
|
+
|
9
|
+
Metrics/LineLength:
|
10
|
+
Max: 120
|
11
|
+
|
12
|
+
Metrics/MethodLength:
|
13
|
+
Enabled: no
|
14
|
+
|
15
|
+
Style/Documentation:
|
16
|
+
Enabled: no
|
17
|
+
|
18
|
+
RSpec/ExampleLength:
|
19
|
+
Enabled: no
|
20
|
+
|
21
|
+
RSpec/MultipleExpectations:
|
22
|
+
Enabled: no
|
23
|
+
|
24
|
+
RSpec/MessageSpies:
|
25
|
+
Enabled: no
|
26
|
+
|
27
|
+
Style/FrozenStringLiteralComment:
|
28
|
+
Enabled: yes
|
29
|
+
EnforcedStyle: always
|
30
|
+
Include:
|
31
|
+
- 'lib/**/*'
|
32
|
+
|
33
|
+
Naming/FileName:
|
34
|
+
Enabled: no
|
data/Rakefile
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
3
4
|
|
4
5
|
RSpec::Core::RakeTask.new(:spec)
|
5
6
|
|
6
|
-
|
7
|
+
RuboCop::RakeTask.new(:rubocop)
|
8
|
+
|
9
|
+
task default: %i[rubocop spec]
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'faraday/tracer'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "faraday/tracer"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
data/faraday-tracer.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('
|
1
|
+
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'faraday-tracer'
|
7
|
-
spec.version = '0.6.
|
7
|
+
spec.version = '0.6.1'
|
8
8
|
spec.authors = ['SaleMove TechMovers']
|
9
9
|
spec.email = ['techmovers@salemove.com']
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
11
|
+
spec.summary = 'Faraday OpenTracing middleware'
|
12
|
+
spec.description = ''
|
13
13
|
spec.homepage = 'https://github.com/salemove/faraday-tracer'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -20,10 +20,12 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency 'opentracing'
|
22
22
|
|
23
|
-
spec.add_development_dependency "test-tracer", "~> 1.0"
|
24
|
-
spec.add_development_dependency "tracing-matchers", "~> 1.0"
|
25
23
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
24
|
+
spec.add_development_dependency 'faraday'
|
26
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
27
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
-
spec.add_development_dependency '
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 0.54.0'
|
28
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.24.0'
|
29
|
+
spec.add_development_dependency 'test-tracer', '~> 1.0'
|
30
|
+
spec.add_development_dependency 'tracing-matchers', '~> 1.0'
|
29
31
|
end
|
data/lib/faraday/tracer.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'opentracing'
|
3
5
|
|
@@ -16,7 +18,7 @@ module Faraday
|
|
16
18
|
# is called.
|
17
19
|
# @param errors [Array<Class>] An array of error classes to be captured by the tracer
|
18
20
|
# as errors. Errors are **not** muted by the middleware.
|
19
|
-
def initialize(
|
21
|
+
def initialize( # rubocop:disable Metrics/ParameterLists
|
20
22
|
app,
|
21
23
|
span: nil,
|
22
24
|
span_name: nil,
|
@@ -34,9 +36,8 @@ module Faraday
|
|
34
36
|
|
35
37
|
def call(env)
|
36
38
|
span = @tracer.start_span(span_name(env),
|
37
|
-
|
38
|
-
|
39
|
-
)
|
39
|
+
child_of: parent_span(env),
|
40
|
+
tags: prepare_tags(env))
|
40
41
|
@tracer.inject(span.context, OpenTracing::FORMAT_RACK, env[:request_headers])
|
41
42
|
@app.call(env).on_complete do |response|
|
42
43
|
span.set_tag('http.status_code', response.status)
|
@@ -59,10 +60,9 @@ module Faraday
|
|
59
60
|
def parent_span(env)
|
60
61
|
context = env.request.context
|
61
62
|
span = context.is_a?(Hash) && context[:span] || @parent_span
|
63
|
+
return unless span
|
62
64
|
|
63
|
-
|
64
|
-
span.respond_to?(:call) ? span.call : span
|
65
|
-
end
|
65
|
+
span.respond_to?(:call) ? span.call : span
|
66
66
|
end
|
67
67
|
|
68
68
|
def prepare_tags(env)
|
@@ -70,7 +70,7 @@ module Faraday
|
|
70
70
|
'component' => 'faraday',
|
71
71
|
'span.kind' => 'client',
|
72
72
|
'http.method' => env[:method],
|
73
|
-
'http.url' => env[:url].to_s
|
73
|
+
'http.url' => env[:url].to_s
|
74
74
|
}
|
75
75
|
|
76
76
|
if (service_name = peer_service(env))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-tracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SaleMove TechMovers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentracing
|
@@ -25,89 +25,117 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.14'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.14'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
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'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '10.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
|
-
version: '
|
68
|
+
version: '10.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '3.0'
|
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
|
-
version: '
|
82
|
+
version: '3.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: rubocop
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 0.54.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
|
-
version:
|
96
|
+
version: 0.54.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
98
|
+
name: rubocop-rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 1.24.0
|
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
|
-
version:
|
110
|
+
version: 1.24.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: test-tracer
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - "
|
115
|
+
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
117
|
+
version: '1.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
|
-
version: '0'
|
124
|
+
version: '1.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: tracing-matchers
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.0'
|
111
139
|
description: ''
|
112
140
|
email:
|
113
141
|
- techmovers@salemove.com
|
@@ -117,6 +145,7 @@ extra_rdoc_files: []
|
|
117
145
|
files:
|
118
146
|
- ".gitignore"
|
119
147
|
- ".rspec"
|
148
|
+
- ".rubocop.yml"
|
120
149
|
- ".travis.yml"
|
121
150
|
- Gemfile
|
122
151
|
- LICENSE.txt
|
@@ -147,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
176
|
version: '0'
|
148
177
|
requirements: []
|
149
178
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.6
|
179
|
+
rubygems_version: 2.7.6
|
151
180
|
signing_key:
|
152
181
|
specification_version: 4
|
153
182
|
summary: Faraday OpenTracing middleware
|