bc-lightstep-ruby 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/bc-lightstep-ruby.gemspec +2 -0
- data/lib/bigcommerce/lightstep.rb +3 -0
- data/lib/bigcommerce/lightstep/configuration.rb +4 -2
- data/lib/bigcommerce/lightstep/errors.rb +2 -0
- data/lib/bigcommerce/lightstep/middleware/faraday.rb +5 -3
- data/lib/bigcommerce/lightstep/rails_controller_instrumentation.rb +3 -1
- data/lib/bigcommerce/lightstep/redis/tracer.rb +3 -1
- data/lib/bigcommerce/lightstep/redis/wrapper.rb +3 -1
- data/lib/bigcommerce/lightstep/tracer.rb +4 -1
- data/lib/bigcommerce/lightstep/transport.rb +7 -5
- data/lib/bigcommerce/lightstep/transport_factory.rb +2 -0
- data/lib/bigcommerce/lightstep/version.rb +3 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 75614155acef737a30e80669b9decb41b2289f18f1519c049732bcdb78f034d4
|
4
|
+
data.tar.gz: 4b937baecd5fdb865b462a5a5ff92d30f9f88e4f1c9f555c994c5c61fdcec76d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1e310ce0281e96dc8bdbe176cbf88a1d43067e90313f53933e163cc5bf53c30cc1275b27b8f3eede24de85d5c834e888a9e399d5ef344869ba44176face4373
|
7
|
+
data.tar.gz: d64dc9e30cddbc9dd9e0bedb56d738738f1a709b21e9e26190ea530114eae9748310738e07238e796b2a8c5bd69c24c6fe3e53e204512b06a3ce1201c354f640
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# bc-lightstep-ruby - LightStep distributed tracing
|
2
2
|
|
3
|
-
[](https://circleci.com/gh/bigcommerce/bc-lightstep-ruby/tree/master) [](https://badge.fury.io/rb/bc-lightstep-ruby) [](http://inch-ci.org/github/bigcommerce/bc-lightstep-ruby)
|
4
4
|
|
5
5
|
Adds [LightStep](https://lightstep.com) tracing support for Ruby. This is an extension of the
|
6
6
|
[LightStep ruby gem](https://github.com/lightstep/lightstep-tracer-ruby) and adds extra functionality and resiliency.
|
data/bc-lightstep-ruby.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -27,6 +29,7 @@ require_relative 'lightstep/redis/tracer'
|
|
27
29
|
|
28
30
|
##
|
29
31
|
# Main base module
|
32
|
+
#
|
30
33
|
module Bigcommerce
|
31
34
|
##
|
32
35
|
# Lightstep module
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -38,7 +40,7 @@ module Bigcommerce
|
|
38
40
|
max_buffered_spans: 1_000,
|
39
41
|
max_log_records: 1_000,
|
40
42
|
max_reporting_interval_seconds: 3.0,
|
41
|
-
redis_excluded_commands: %w
|
43
|
+
redis_excluded_commands: %w[ping],
|
42
44
|
redis_allow_root_spans: false,
|
43
45
|
enabled: true
|
44
46
|
}.freeze
|
@@ -103,7 +105,7 @@ module Bigcommerce
|
|
103
105
|
|
104
106
|
self.verbosity = ENV.fetch('LIGHTSTEP_VERBOSITY', 1).to_i
|
105
107
|
self.logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
106
|
-
self.enabled = ENV.fetch('LIGHTSTEP_ENABLED', 1).to_i
|
108
|
+
self.enabled = ENV.fetch('LIGHTSTEP_ENABLED', 1).to_i.positive?
|
107
109
|
end
|
108
110
|
|
109
111
|
##
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -23,9 +25,9 @@ module Bigcommerce
|
|
23
25
|
HTTP_STATUS_INTERNAL_ERROR = 500
|
24
26
|
HTTP_STATUS_SERVICE_UNAVAIL = 503
|
25
27
|
|
26
|
-
OT_TAG_TRACE_ID = 'ot-tracer-traceid'
|
27
|
-
OT_TAG_SPAN_ID = 'ot-tracer-spanid'
|
28
|
-
OT_TAG_SAMPLED = 'ot-tracer-sampled'
|
28
|
+
OT_TAG_TRACE_ID = 'ot-tracer-traceid'
|
29
|
+
OT_TAG_SPAN_ID = 'ot-tracer-spanid'
|
30
|
+
OT_TAG_SAMPLED = 'ot-tracer-sampled'
|
29
31
|
|
30
32
|
def initialize(app, service_name = nil)
|
31
33
|
@app = app
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Bigcommerce
|
2
4
|
module Lightstep
|
3
5
|
##
|
@@ -29,7 +31,7 @@ module Bigcommerce
|
|
29
31
|
span.set_tag('http.host', request.host)
|
30
32
|
begin
|
31
33
|
resp = yield
|
32
|
-
rescue StandardError =>
|
34
|
+
rescue StandardError => _e
|
33
35
|
span.set_tag('error', true)
|
34
36
|
span.set_tag('http.status_code', Bigcommerce::Lightstep.http1_error_code)
|
35
37
|
tracer.clear_active_span!
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -72,7 +74,7 @@ module Bigcommerce
|
|
72
74
|
end
|
73
75
|
begin
|
74
76
|
resp = yield
|
75
|
-
rescue StandardError =>
|
77
|
+
rescue StandardError => _e
|
76
78
|
span.set_tag('error', true)
|
77
79
|
raise # re-raise the error
|
78
80
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -27,7 +29,7 @@ module Bigcommerce
|
|
27
29
|
|
28
30
|
wrap unless @wrapped
|
29
31
|
@wrapped = true
|
30
|
-
rescue ::LoadError =>
|
32
|
+
rescue ::LoadError => _e
|
31
33
|
@wrapped = false
|
32
34
|
# noop
|
33
35
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -39,7 +41,7 @@ module Bigcommerce
|
|
39
41
|
if enabled?
|
40
42
|
# enable the tracer (for fork support)
|
41
43
|
tracer.enable
|
42
|
-
elsif tracer
|
44
|
+
elsif tracer&.enabled?
|
43
45
|
# We are not enabled and the tracer is currently on
|
44
46
|
# https://github.com/lightstep/lightstep-tracer-ruby/blob/master/lib/lightstep/tracer.rb#L129-L130
|
45
47
|
# we have to set this through instance_variable_set because of a bug in the core lightstep gem which
|
@@ -62,6 +64,7 @@ module Bigcommerce
|
|
62
64
|
self.active_span = span
|
63
65
|
|
64
66
|
# run the process
|
67
|
+
result = nil
|
65
68
|
begin
|
66
69
|
result = yield span
|
67
70
|
rescue StandardError
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -25,12 +27,12 @@ module Bigcommerce
|
|
25
27
|
class Transport < ::LightStep::Transport::Base
|
26
28
|
class InvalidAccessTokenError < StandardError; end
|
27
29
|
|
28
|
-
ENCRYPTION_TLS = 'tls'
|
29
|
-
ENCRYPTION_NONE = 'none'
|
30
|
-
HEADER_ACCESS_TOKEN = 'LightStep-Access-Token'
|
31
|
-
LIGHTSTEP_HOST = 'collector.lightstep.com'
|
30
|
+
ENCRYPTION_TLS = 'tls'
|
31
|
+
ENCRYPTION_NONE = 'none'
|
32
|
+
HEADER_ACCESS_TOKEN = 'LightStep-Access-Token'
|
33
|
+
LIGHTSTEP_HOST = 'collector.lightstep.com'
|
32
34
|
LIGHTSTEP_PORT = 443
|
33
|
-
REPORTS_API_ENDPOINT = '/api/v0/reports'
|
35
|
+
REPORTS_API_ENDPOINT = '/api/v0/reports'
|
34
36
|
|
35
37
|
# Initialize the transport
|
36
38
|
# @param host [String] host of the domain to the endpoind to push data
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -15,6 +17,6 @@
|
|
15
17
|
#
|
16
18
|
module Bigcommerce
|
17
19
|
module Lightstep
|
18
|
-
VERSION = '1.
|
20
|
+
VERSION = '1.4.0'
|
19
21
|
end
|
20
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: 1.
|
4
|
+
version: 1.4.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: 2019-
|
11
|
+
date: 2019-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -141,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
|
145
|
-
rubygems_version: 2.6.12
|
144
|
+
rubygems_version: 3.0.2
|
146
145
|
signing_key:
|
147
146
|
specification_version: 4
|
148
147
|
summary: Gem for lightstep distributed tracing
|