bc-lightstep-ruby 1.1.8 → 1.2.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +10 -7
- data/bc-lightstep-ruby.gemspec +1 -1
- data/lib/bigcommerce/lightstep.rb +3 -47
- data/lib/bigcommerce/lightstep/configuration.rb +8 -0
- data/lib/bigcommerce/lightstep/middleware/faraday.rb +2 -2
- 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: c2b20374a58de581ce773fa99fb7638be8b1bcc850838a982267c84c9e382a35
|
4
|
+
data.tar.gz: 4c142c796b5be6d4613e22241a20358caf0f9d21d7d80600e1a8909e2011fb55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ebdd12a9a51e45ec80cd21c44b94b8798c3bb5b6fd14c968da7daf80bb2e91f50979e71ac9e5cacb750047b92027804328144f0e274998d066c18b266cf59ff
|
7
|
+
data.tar.gz: 2cb510ec6d18e4046b73c1aec3abbc73b4675b06cd791591c0b3be1c899258a9c41518ffba92af72f7858ed1de19f9a7e499ebaef799f11a664bdeb3730424a4
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@ Changelog for the bc-lightstep-ruby gem.
|
|
2
2
|
|
3
3
|
h3. Pending Release
|
4
4
|
|
5
|
+
h3. 1.2.0
|
6
|
+
|
7
|
+
- Bump lightstep gem to 0.13
|
8
|
+
- Add LIGHTSTEP_MAX_BUFFERED_SPANS config ENV + setting for maximum number of spans to buffer
|
9
|
+
- Add LIGHTSTEP_MAX_LOG_RECORDS config ENV + setting for maximum number of log records that can be on a span
|
10
|
+
- Add LIGHTSTEP_MAX_REPORTING_INTERVAL_SECONDS config ENV + setting for max reporting flush interval to collector
|
11
|
+
|
5
12
|
h3. 1.1.8
|
6
13
|
|
7
14
|
- Handle issue that occurs if lightstep is disabled but the start_span method is still called
|
data/README.md
CHANGED
@@ -40,13 +40,16 @@ bc-lightstep-ruby can be automatically configured from these ENV vars, if you'd
|
|
40
40
|
|
41
41
|
| Name | Description |
|
42
42
|
| ---- | ----------- |
|
43
|
-
| LIGHTSTEP_ENABLED | Flag to determine whether to broadcast spans. Defaults to 1
|
44
|
-
| LIGHTSTEP_COMPONENT_NAME | The component name to use |
|
45
|
-
| LIGHTSTEP_ACCESS_TOKEN | The access token to use to connect to the collector |
|
46
|
-
| LIGHTSTEP_HOST | Host of the collector.
|
47
|
-
| LIGHTSTEP_PORT | Port of the collector.
|
48
|
-
| LIGHTSTEP_SSL_VERIFY_PEER | If using 443 as the port, toggle SSL verification.
|
49
|
-
|
|
43
|
+
| LIGHTSTEP_ENABLED | Flag to determine whether to broadcast spans. Defaults to (1) enabled, 0 will disable.| 1 |
|
44
|
+
| LIGHTSTEP_COMPONENT_NAME | The component name to use | '' |
|
45
|
+
| LIGHTSTEP_ACCESS_TOKEN | The access token to use to connect to the collector | '' |
|
46
|
+
| LIGHTSTEP_HOST | Host of the collector. | `lightstep-collector.linkerd` |
|
47
|
+
| LIGHTSTEP_PORT | Port of the collector. | `4140` |
|
48
|
+
| LIGHTSTEP_SSL_VERIFY_PEER | If using 443 as the port, toggle SSL verification. | true |
|
49
|
+
| LIGHTSTEP_MAX_BUFFERED_SPANS | The maximum number of spans to buffer before dropping. | `1_000` |
|
50
|
+
| LIGHTSTEP_MAX_LOG_RECORDS | Maximum number of log records on a span to accept. | `1_000` |
|
51
|
+
| LIGHTSTEP_MAX_REPORTING_INTERVAL_SECONDS | The maximum number of seconds to wait before flushing the report to the collector. | 3.0 |
|
52
|
+
| LIGHTSTEP_VERBOSITY | The verbosity level of lightstep logs. | 1 |
|
50
53
|
|
51
54
|
Most systems will only need to customize the component name.
|
52
55
|
|
data/bc-lightstep-ruby.gemspec
CHANGED
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
36
|
spec.add_development_dependency 'pry'
|
37
37
|
|
38
|
-
spec.add_runtime_dependency 'lightstep', '~> 0.
|
38
|
+
spec.add_runtime_dependency 'lightstep', '~> 0.13.0'
|
39
39
|
spec.add_runtime_dependency 'faraday', '~> 0.8'
|
40
40
|
end
|
@@ -41,53 +41,9 @@ module Bigcommerce
|
|
41
41
|
component_name: component_name,
|
42
42
|
transport: transport_factory.build
|
43
43
|
)
|
44
|
+
::LightStep.instance.max_span_records = ::Bigcommerce::Lightstep.max_buffered_spans
|
45
|
+
::LightStep.instance.max_log_records = ::Bigcommerce::Lightstep.max_log_records
|
46
|
+
::LightStep.instance.report_period_seconds = ::Bigcommerce::Lightstep.max_reporting_interval_seconds
|
44
47
|
end
|
45
48
|
end
|
46
49
|
end
|
47
|
-
|
48
|
-
# :nocov:
|
49
|
-
module LightStep
|
50
|
-
##
|
51
|
-
# Monkey patch of the LightStep library to make it not swallow reporting errors
|
52
|
-
#
|
53
|
-
class Reporter
|
54
|
-
def flush
|
55
|
-
reset_on_fork
|
56
|
-
|
57
|
-
return if @span_records.empty?
|
58
|
-
|
59
|
-
now = ::LightStep.micros(Time.now)
|
60
|
-
|
61
|
-
span_records = @span_records.slice!(0, @span_records.length)
|
62
|
-
dropped_spans = 0
|
63
|
-
@dropped_spans.update do |old|
|
64
|
-
dropped_spans = old
|
65
|
-
0
|
66
|
-
end
|
67
|
-
|
68
|
-
report_request = {
|
69
|
-
runtime: @runtime,
|
70
|
-
oldest_micros: @report_start_time,
|
71
|
-
youngest_micros: now,
|
72
|
-
span_records: span_records,
|
73
|
-
internal_metrics: {
|
74
|
-
counts: [
|
75
|
-
{ name: 'spans.dropped', int64_value: dropped_spans }
|
76
|
-
]
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
@report_start_time = now
|
81
|
-
|
82
|
-
begin
|
83
|
-
@transport.report(report_request)
|
84
|
-
rescue StandardError => e
|
85
|
-
Bigcommerce::Lightstep.logger.error "Failed to send request to collector: #{e.message}"
|
86
|
-
# an error occurs, add the previous dropped_spans and count of spans
|
87
|
-
# that would have been recorded
|
88
|
-
@dropped_spans.increment(dropped_spans + span_records.length)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
# :nocov:
|
@@ -35,6 +35,9 @@ module Bigcommerce
|
|
35
35
|
verbosity: 1,
|
36
36
|
http1_error_code: 500,
|
37
37
|
http1_error_code_minimum: 500,
|
38
|
+
max_buffered_spans: 1_000,
|
39
|
+
max_log_records: 1_000,
|
40
|
+
max_reporting_interval_seconds: 3.0,
|
38
41
|
enabled: true
|
39
42
|
}.freeze
|
40
43
|
|
@@ -91,6 +94,11 @@ module Bigcommerce
|
|
91
94
|
self.host = ENV.fetch('LIGHTSTEP_HOST', 'lightstep-collector.linkerd')
|
92
95
|
self.port = ENV.fetch('LIGHTSTEP_PORT', 4140).to_i
|
93
96
|
self.ssl_verify_peer = ENV.fetch('LIGHTSTEP_SSL_VERIFY_PEER', true)
|
97
|
+
|
98
|
+
self.max_buffered_spans = ENV.fetch('LIGHTSTEP_MAX_BUFFERED_SPANS', 1_000).to_i
|
99
|
+
self.max_log_records = ENV.fetch('LIGHTSTEP_MAX_LOG_RECORDS', 1_000).to_i
|
100
|
+
self.max_reporting_interval_seconds = ENV.fetch('LIGHTSTEP_MAX_REPORTING_INTERVAL_SECONDS', 3.0).to_f
|
101
|
+
|
94
102
|
self.verbosity = ENV.fetch('LIGHTSTEP_VERBOSITY', 1).to_i
|
95
103
|
self.logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
96
104
|
self.enabled = ENV.fetch('LIGHTSTEP_ENABLED', 1).to_i > 0
|
@@ -75,8 +75,8 @@ module Bigcommerce
|
|
75
75
|
#
|
76
76
|
def inject_ot_tags!(request_env, span)
|
77
77
|
request_env[:request_headers].merge!(
|
78
|
-
OT_TAG_TRACE_ID => span.
|
79
|
-
OT_TAG_SPAN_ID => span.
|
78
|
+
OT_TAG_TRACE_ID => span.context.trace_id.to_s,
|
79
|
+
OT_TAG_SPAN_ID => span.context.id.to_s,
|
80
80
|
OT_TAG_SAMPLED => 'true'
|
81
81
|
)
|
82
82
|
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.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: 2018-
|
11
|
+
date: 2018-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.13.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.13.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: faraday
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|