bc-lightstep-ruby 2.1.1 → 2.2.0

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: d8f1fc7a5f74205acf72c3fa8cbb6c138c5a08ad836a1e16a5dfa18eac508e61
4
- data.tar.gz: e83b6493f8e1f0960b5c5d4c160ad6908c0f18f12be6faf39b71196ba4d6ccfb
3
+ metadata.gz: f8438758949aeee5ef6d8908fdb428a466d768b9548c50ec11d91ebfe6d4a51d
4
+ data.tar.gz: 1afbe2aca9eed46303b8a3a40802ead2fad62ed937638213e74f257149a3c3b2
5
5
  SHA512:
6
- metadata.gz: a5e1791d8d2d2557eb01ec82cfe25cda4bff66637f325dceba731c44d2669f954afcdcf73f68e6dd05561e407ebc4db1e9b01af493f5652081efd43c588c79b6
7
- data.tar.gz: 0353ccabf22f3e023ce98d41957f2ee8209c5669b9417cc5f750b3f6ebafa32a7265b7e69ebf74c1de6c9f82494cfe215d2aadea52c27dfcc428b83b57f60a19
6
+ metadata.gz: ddfe877c18f72a78694074fa5d71ca8cf405638fcb4dc171417f5371fb8ea3a0d3048933e7ecf1bee1b1b785cd93e965485cf16df31ab224dea8b261797f0496
7
+ data.tar.gz: 60a2238aa127269ba871c21d0a4a6749ba3bcbc1752bc658fec9f1b055cc77e6b6bc3125eadd997a4b436788a90d0b909a959927b1a83718348cfa33ce7981c0
@@ -2,6 +2,11 @@ Changelog for the bc-lightstep-ruby gem.
2
2
 
3
3
  ### Pending Release
4
4
 
5
+ ### 2.2.0
6
+
7
+ - Only set error tag in exceptions if not already set
8
+ - Update to Rubocop 1.0
9
+
5
10
  ### 2.1.1
6
11
 
7
12
  - Bump lightstep gem to 0.16.0
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency 'rake', '>= 12.0'
40
40
  spec.add_development_dependency 'rspec', '~> 3.8'
41
41
  spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
42
- spec.add_development_dependency 'rubocop', '~> 0.79'
42
+ spec.add_development_dependency 'rubocop', '~> 1.0'
43
43
  spec.add_development_dependency 'simplecov', '~> 0.15'
44
44
  spec.add_development_dependency 'pry', '>= 0.12'
45
45
 
@@ -42,6 +42,12 @@ module Bigcommerce
42
42
  module Lightstep
43
43
  extend Configuration
44
44
 
45
+ ##
46
+ # Start the global tracer and configure LightStep
47
+ #
48
+ # @param [String] component_name
49
+ # @param [::Bigcommerce::Lightstep::TransportFactory] transport_factory
50
+ #
45
51
  def self.start(component_name: nil, transport_factory: nil)
46
52
  component_name ||= ::Bigcommerce::Lightstep.component_name
47
53
  transport_factory ||= ::Bigcommerce::Lightstep::TransportFactory.new
@@ -98,7 +98,7 @@ module Bigcommerce
98
98
  send("#{k}=".to_sym, v)
99
99
  end
100
100
 
101
- default_logger = ::Logger.new(STDOUT)
101
+ default_logger = ::Logger.new($stdout)
102
102
  default_logger.level = ::Logger::INFO
103
103
  self.logger = defined?(Rails) ? Rails.logger : default_logger
104
104
 
@@ -43,6 +43,7 @@ module Bigcommerce
43
43
  # @param [Array<Symbol>] presets Specify presets that automatically setup keys
44
44
  #
45
45
  def initialize(keys: nil, env: nil, presets: [])
46
+ super()
46
47
  @keys = keys || {}
47
48
  @presets = presets || []
48
49
  @env = env || ENV
@@ -30,7 +30,7 @@ module Bigcommerce
30
30
  OT_TAG_SAMPLED = 'ot-tracer-sampled'
31
31
 
32
32
  def initialize(app, service_name = nil)
33
- @app = app
33
+ super(app)
34
34
  @service_name = (service_name || 'external').to_s
35
35
  end
36
36
 
@@ -34,6 +34,22 @@ module Bigcommerce
34
34
  LIGHTSTEP_PORT = 443
35
35
  REPORTS_API_ENDPOINT = '/api/v0/reports'
36
36
 
37
+ DEFAULT_OPEN_TIMEOUT = 20
38
+ DEFAULT_READ_TIMEOUT = 20
39
+ DEFAULT_KEEPALIVE_TIMEOUT = 2
40
+ DEFAULT_SSL_PORT = 443
41
+
42
+ ##
43
+ # Verbosity levels for the transport
44
+ #
45
+ class Verbosity
46
+ FATAL = 0
47
+ ERROR = 1
48
+ WARN = 2
49
+ INFO = 3
50
+ DEBUG = 4
51
+ end
52
+
37
53
  # Initialize the transport
38
54
  # @param host [String] host of the domain to the endpoind to push data
39
55
  # @param port [Numeric] port on which to connect
@@ -44,31 +60,34 @@ module Bigcommerce
44
60
  # @return [Transport]
45
61
  def initialize(
46
62
  access_token:,
47
- host: LIGHTSTEP_HOST,
48
- port: LIGHTSTEP_PORT,
49
- verbose: 0,
50
- encryption: ENCRYPTION_TLS,
63
+ host: nil,
64
+ port: nil,
65
+ verbose: nil,
66
+ encryption: nil,
51
67
  ssl_verify_peer: true,
52
- open_timeout: 2,
53
- read_timeout: 2,
68
+ ssl_port: nil,
69
+ open_timeout: nil,
70
+ read_timeout: nil,
54
71
  continue_timeout: nil,
55
- keep_alive_timeout: 2,
72
+ keep_alive_timeout: nil,
56
73
  logger: nil
57
74
  )
58
- @host = host
59
- @port = port
60
- @verbose = verbose
61
- @encryption = encryption
75
+ @host = host || LIGHTSTEP_HOST
76
+ @port = port || LIGHTSTEP_PORT
77
+ @verbose = verbose || Verbosity::FATAL
78
+ @encryption = encryption || ENCRYPTION_TLS
62
79
  @ssl_verify_peer = ssl_verify_peer
63
- @open_timeout = open_timeout.to_i
64
- @read_timeout = read_timeout.to_i
80
+ @ssl_port = (ssl_port || DEFAULT_SSL_PORT).to_i
81
+ @open_timeout = (open_timeout || DEFAULT_OPEN_TIMEOUT).to_i
82
+ @read_timeout = (read_timeout || DEFAULT_READ_TIMEOUT).to_i
65
83
  @continue_timeout = continue_timeout
66
- @keep_alive_timeout = keep_alive_timeout.to_i
84
+ @keep_alive_timeout = (keep_alive_timeout || DEFAULT_KEEPALIVE_TIMEOUT).to_i
67
85
  @access_token = access_token.to_s
68
86
 
69
- default_logger = ::Logger.new(STDOUT)
87
+ default_logger = ::Logger.new($stdout)
70
88
  default_logger.level = ::Logger::INFO
71
89
  @logger = logger || default_logger
90
+ super()
72
91
  end
73
92
 
74
93
  ##
@@ -78,12 +97,12 @@ module Bigcommerce
78
97
  # @return [NilClass]
79
98
  #
80
99
  def report(report)
81
- @logger.info report if @verbose >= 3
100
+ @logger.info report if @verbose >= Verbosity::INFO
82
101
 
83
102
  req = build_request(report)
84
103
  res = connection.request(req)
85
104
 
86
- @logger.info res.to_s if @verbose >= 3
105
+ @logger.info res.to_s if @verbose >= Verbosity::INFO
87
106
 
88
107
  nil
89
108
  end
@@ -109,7 +128,7 @@ module Bigcommerce
109
128
  def connection
110
129
  unless @connection
111
130
  @connection = ::Net::HTTP.new(@host, @port)
112
- if @port == 443
131
+ if @port == @ssl_port
113
132
  @connection.use_ssl = @encryption == ENCRYPTION_TLS
114
133
  @connection.verify_mode = ::OpenSSL::SSL::VERIFY_NONE unless @ssl_verify_peer
115
134
  end
@@ -17,6 +17,6 @@
17
17
  #
18
18
  module Bigcommerce
19
19
  module Lightstep
20
- VERSION = '2.1.1'
20
+ VERSION = '2.2.0'
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bc-lightstep-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-08 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.79'
103
+ version: '1.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.79'
110
+ version: '1.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement