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 +4 -4
- data/CHANGELOG.md +5 -0
- data/bc-lightstep-ruby.gemspec +1 -1
- data/lib/bigcommerce/lightstep.rb +6 -0
- data/lib/bigcommerce/lightstep/configuration.rb +1 -1
- data/lib/bigcommerce/lightstep/interceptors/env.rb +1 -0
- data/lib/bigcommerce/lightstep/middleware/faraday.rb +1 -1
- data/lib/bigcommerce/lightstep/transport.rb +37 -18
- data/lib/bigcommerce/lightstep/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8438758949aeee5ef6d8908fdb428a466d768b9548c50ec11d91ebfe6d4a51d
|
4
|
+
data.tar.gz: 1afbe2aca9eed46303b8a3a40802ead2fad62ed937638213e74f257149a3c3b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddfe877c18f72a78694074fa5d71ca8cf405638fcb4dc171417f5371fb8ea3a0d3048933e7ecf1bee1b1b785cd93e965485cf16df31ab224dea8b261797f0496
|
7
|
+
data.tar.gz: 60a2238aa127269ba871c21d0a4a6749ba3bcbc1752bc658fec9f1b055cc77e6b6bc3125eadd997a4b436788a90d0b909a959927b1a83718348cfa33ce7981c0
|
data/CHANGELOG.md
CHANGED
data/bc-lightstep-ruby.gemspec
CHANGED
@@ -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
|
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
|
@@ -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:
|
48
|
-
port:
|
49
|
-
verbose:
|
50
|
-
encryption:
|
63
|
+
host: nil,
|
64
|
+
port: nil,
|
65
|
+
verbose: nil,
|
66
|
+
encryption: nil,
|
51
67
|
ssl_verify_peer: true,
|
52
|
-
|
53
|
-
|
68
|
+
ssl_port: nil,
|
69
|
+
open_timeout: nil,
|
70
|
+
read_timeout: nil,
|
54
71
|
continue_timeout: nil,
|
55
|
-
keep_alive_timeout:
|
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
|
-
@
|
64
|
-
@
|
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(
|
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 >=
|
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 >=
|
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 ==
|
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
|
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.
|
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-
|
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
|
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
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|