bc-lightstep-ruby 1.1.8 → 1.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: 7cb5dab38cc9f046ed427e5ecccad6cb61349a87af82bdf5b7531e7b48058765
4
- data.tar.gz: f55e6662e3cfec30437ff8b7357598f1fb24278340fb2e0c51ab2cb3ec573f47
3
+ metadata.gz: c2b20374a58de581ce773fa99fb7638be8b1bcc850838a982267c84c9e382a35
4
+ data.tar.gz: 4c142c796b5be6d4613e22241a20358caf0f9d21d7d80600e1a8909e2011fb55
5
5
  SHA512:
6
- metadata.gz: b1b59b7f0cfc79daaf4bb35f76970d2d1b7fe9eec5a96f86c043fd3dab03b597747b3f06a992172b5763ac5d9fa958a6026dece3f9d68f817aa3739feb44f574
7
- data.tar.gz: a8d02320ac6d91ff706b0b5778ee3a35d8d39958f77007745e36d5b528d5c5b0a8fd5e7bcc85785c97456bae0b94b75dae21e9601da49c5248e5ee5137c93206
6
+ metadata.gz: 9ebdd12a9a51e45ec80cd21c44b94b8798c3bb5b6fd14c968da7daf80bb2e91f50979e71ac9e5cacb750047b92027804328144f0e274998d066c18b266cf59ff
7
+ data.tar.gz: 2cb510ec6d18e4046b73c1aec3abbc73b4675b06cd791591c0b3be1c899258a9c41518ffba92af72f7858ed1de19f9a7e499ebaef799f11a664bdeb3730424a4
@@ -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 (enabled) and 0 will disable.|
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. Defaults to `lightstep-collector.linkerd` |
47
- | LIGHTSTEP_PORT | Port of the collector. Defaults to `4140` |
48
- | LIGHTSTEP_SSL_VERIFY_PEER | If using 443 as the port, toggle SSL verification. Defaults to true. |
49
- | LIGHTSTEP_VERBOSITY | The verbosity level of lightstep logs. Defaults to 1. |
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
 
@@ -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.11.2'
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.span_context.trace_id.to_s,
79
- OT_TAG_SPAN_ID => span.span_context.id.to_s,
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
@@ -15,6 +15,6 @@
15
15
  #
16
16
  module Bigcommerce
17
17
  module Lightstep
18
- VERSION = '1.1.8'.freeze
18
+ VERSION = '1.2.0'.freeze
19
19
  end
20
20
  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.1.8
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-09-20 00:00:00.000000000 Z
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.11.2
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.11.2
82
+ version: 0.13.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: faraday
85
85
  requirement: !ruby/object:Gem::Requirement