hubstep 2.0.3 → 2.0.4

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
  SHA1:
3
- metadata.gz: f9f16b63e7a1bcb313327bc0ce955c9acd971b05
4
- data.tar.gz: 392c2321669a3a307cd93018ca66c1690d55961d
3
+ metadata.gz: 931085ea4e5c72ee66f49d6e2a706bfadfcff707
4
+ data.tar.gz: 7699cc179fdb410ecfa67b909f9363bc1ee94df3
5
5
  SHA512:
6
- metadata.gz: fafcdc535bc8ff9b6ae00b462938585231ef12ba73cbe4c51ccc735d057635eda1f8ac8dd909965242e8f4bc624d5cd3562f16c22cd145764772176e9fd2abdd
7
- data.tar.gz: 76fc1fbe37fae6b971cd86b6324b68ddc07f2d139a9a56097d0ae640e3ce54fad17a69656e081b7b63318d473d3895811abc88843a59407fad52059d566630f2
6
+ metadata.gz: 9ecb9021740887aba98a9c13f3082394226b5d081bac1b6f456d1f6699a8c6034742d3fc19c4f2e0e7a11d86da6e9c8abc93d81b751d89258329ad5b394ba281
7
+ data.tar.gz: abd2f91b4c15b8d75fe98549aaec282058036270aca42adf0d8e00d63b50d51a2e3213c9585964217521b2894be1125433a5ddfa3efa9e0fe6daa598d7b310a7
data/.rubocop.yml CHANGED
@@ -20,6 +20,9 @@ Metrics/LineLength:
20
20
  Metrics/MethodLength:
21
21
  Max: 15
22
22
 
23
+ Metrics/AbcSize:
24
+ Max: 17
25
+
23
26
  Style/DoubleNegation:
24
27
  Enabled: false
25
28
 
@@ -13,6 +13,25 @@ module HubStep
13
13
  # b.adapter(:typhoeus)
14
14
  # end
15
15
  class Middleware < ::Faraday::Middleware
16
+ class << self
17
+ # Set a URI parser.
18
+ #
19
+ # parser - An object that responds to `parse`
20
+ #
21
+ def uri_parser=(parser)
22
+ if parser == :default
23
+ parser = URI
24
+ end
25
+ @uri_parser = parser
26
+ end
27
+
28
+ # Get the URI parser.
29
+ attr_reader :uri_parser
30
+ end
31
+
32
+ # Default the uri_parser
33
+ self.uri_parser = :default
34
+
16
35
  # Create a Middleware
17
36
  #
18
37
  # tracer - a HubStep::Tracer instance
@@ -56,8 +75,15 @@ module HubStep
56
75
  url = request_env[:url]
57
76
  span.set_tag("http.url", url) if @include_urls
58
77
 
59
- uri = URI.parse(url.to_s)
60
- span.set_tag("http.domain", uri.host)
78
+ begin
79
+ uri = self.class.uri_parser.parse(url.to_s)
80
+ domain = uri.host
81
+ rescue => e
82
+ HubStep.instrumenter.instrument("hubstep.faraday.middleware.error", error: e)
83
+ domain = nil
84
+ end
85
+
86
+ span.set_tag("http.domain", domain)
61
87
  end
62
88
 
63
89
  def record_response(span, response_env)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module HubStep
3
- VERSION = "2.0.3"
3
+ VERSION = "2.0.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubstep
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-11 00:00:00.000000000 Z
11
+ date: 2017-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lightstep