traceview 3.8.1 → 3.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +43 -0
  3. data/.travis.yml +5 -4
  4. data/CHANGELOG.md +114 -114
  5. data/Gemfile +5 -6
  6. data/README.md +3 -3
  7. data/Rakefile +18 -21
  8. data/examples/DNT.md +3 -3
  9. data/examples/carrying_context.rb +26 -31
  10. data/examples/instrumenting_metal_controller.rb +1 -1
  11. data/examples/puma_on_heroku_config.rb +3 -3
  12. data/examples/tracing_async_threads.rb +9 -9
  13. data/examples/tracing_background_jobs.rb +5 -7
  14. data/examples/tracing_forked_processes.rb +13 -14
  15. data/examples/unicorn_on_heroku_config.rb +4 -4
  16. data/gemfiles/rails50.gemfile +1 -1
  17. data/lib/joboe_metal.rb +2 -5
  18. data/lib/oboe/backward_compatibility.rb +3 -5
  19. data/lib/oboe_metal.rb +37 -43
  20. data/lib/traceview/api/logging.rb +1 -2
  21. data/lib/traceview/base.rb +3 -0
  22. data/lib/traceview/config.rb +19 -3
  23. data/lib/traceview/frameworks/rails/inst/action_controller.rb +2 -2
  24. data/lib/traceview/frameworks/rails/inst/{action_controller5_api.rb → action_controller_api.rb} +0 -0
  25. data/lib/traceview/frameworks/rails/inst/connection_adapters/utils.rb +2 -2
  26. data/lib/traceview/frameworks/rails/inst/connection_adapters/utils5x.rb +3 -4
  27. data/lib/traceview/inst/httpclient.rb +12 -12
  28. data/lib/traceview/inst/mongo2.rb +7 -8
  29. data/lib/traceview/inst/moped.rb +334 -343
  30. data/lib/traceview/inst/rack.rb +14 -2
  31. data/lib/traceview/inst/redis.rb +104 -110
  32. data/lib/traceview/inst/sequel.rb +43 -37
  33. data/lib/traceview/inst/twitter-cassandra.rb +12 -6
  34. data/lib/traceview/support.rb +34 -32
  35. data/lib/traceview/util.rb +7 -4
  36. data/lib/traceview/version.rb +1 -1
  37. data/test/instrumentation/curb_test.rb +2 -24
  38. data/test/instrumentation/httpclient_test.rb +7 -18
  39. data/test/instrumentation/{cassandra_test.rb → twitter-cassandra_test.rb} +32 -0
  40. data/test/minitest_helper.rb +0 -3
  41. data/test/settings +0 -0
  42. data/test/support/avw_handling_test.rb +13 -23
  43. data/test/support/config_test.rb +1 -1
  44. data/test/support/tracing_mode_test.rb +44 -0
  45. metadata +10 -6
@@ -6,16 +6,14 @@
6
6
  require 'math'
7
7
  require 'oboe'
8
8
 
9
- Oboe::Config[:tracing_mode] = :always
10
- Oboe::Config[:verbose] = true
9
+ TraceView::Config[:tracing_mode] = :always
10
+ TraceView::Config[:verbose] = true
11
11
 
12
12
  # The parent process/loop which collects data
13
- while true do
14
-
13
+ Kernel.loop do
15
14
  # For each loop, we instrument the work retrieval. These traces
16
15
  # will show up as layer 'get_the_work'.
17
- Oboe::API.start_trace('get_the_work') do
18
-
16
+ TraceView::API.start_trace('get_the_work') do
19
17
  work = get_the_work
20
18
 
21
19
  # Loop through work and pass to `do_the_work` method
@@ -23,11 +21,11 @@ while true do
23
21
  work.each do |job|
24
22
  fork do
25
23
  # Since the context is copied from the parent process, we clear it
26
- # and start a new trace via `Oboe::API.start_trace`.
27
- Oboe::Context.clear
24
+ # and start a new trace via `TraceView::API.start_trace`.
25
+ TraceView::Context.clear
28
26
  result = nil
29
27
 
30
- Oboe::API.start_trace('do_the_work', nil, :job_id => job.id) do
28
+ TraceView::API.start_trace('do_the_work', nil, :job_id => job.id) do
31
29
  result = do_the_work(job)
32
30
  end
33
31
 
@@ -75,11 +73,11 @@ end
75
73
  #
76
74
  # To do this:
77
75
  # 1. Don't clear the context in the child process
78
- # 2. Use `Oboe::API.trace` instead
76
+ # 2. Use `TraceView::API.trace` instead
79
77
  # 3. Pass the `Async` flag to mark this child as asynchronous
80
78
  #
81
- while true do
82
- Oboe::API.start_trace('get_the_work') do
79
+ Kernel.loop do
80
+ TraceView::API.start_trace('get_the_work') do
83
81
 
84
82
  work = get_the_work
85
83
 
@@ -87,9 +85,9 @@ while true do
87
85
  fork do
88
86
  result = nil
89
87
  # 1 Don't clear context
90
- # 2 Use `Oboe::API.trace` instead
88
+ # 2 Use `TraceView::API.trace` instead
91
89
  # 3 Pass the Async flag
92
- Oboe::API.trace('do_the_work', { :job_id => job.id, 'Async' => 1 }) do
90
+ TraceView::API.trace('do_the_work', { :job_id => job.id, :Async => 1 }) do
93
91
  result = do_the_work(job)
94
92
  end
95
93
 
@@ -97,4 +95,5 @@ while true do
97
95
  end
98
96
  end
99
97
  end
98
+ sleep 5
100
99
  end
@@ -11,8 +11,8 @@ before_fork do |server, worker|
11
11
  defined?(ActiveRecord::Base) and
12
12
  ActiveRecord::Base.connection.disconnect!
13
13
 
14
- defined?(::Oboe) and
15
- ::Oboe.disconnect!
14
+ defined?(::TraceView) and
15
+ ::TraceView.disconnect!
16
16
  end
17
17
 
18
18
  after_fork do |server, worker|
@@ -23,6 +23,6 @@ after_fork do |server, worker|
23
23
  defined?(ActiveRecord::Base) and
24
24
  ActiveRecord::Base.establish_connection
25
25
 
26
- defined?(::Oboe) and
27
- ::Oboe.reconnect!
26
+ defined?(::TraceView) and
27
+ ::TraceView.reconnect!
28
28
  end
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rails', '>= 5.0.0.beta3', '< 5.1'
3
+ gem 'rails', '>= 5.0.0.rc1', '< 5.1'
4
4
  gem 'sass-rails', '~> 5.0'
5
5
  gem 'uglifier', '>= 1.3.0'
6
6
  gem 'coffee-rails', '~> 4.1.0'
data/lib/joboe_metal.rb CHANGED
@@ -146,10 +146,7 @@ module TraceView
146
146
  def sample?(opts = {})
147
147
  begin
148
148
  # Return false if no-op mode
149
- return false if !TraceView.loaded
150
-
151
- # Return false if never or through mode without AVW flag
152
- return false if TraceView.never? || (TraceView.through? && !opts.key?('X-TV-Meta'))
149
+ return false unless TraceView.loaded
153
150
 
154
151
  return true if ENV.key?('TRACEVIEW_GEM_TEST') && !opts.key?('X-TV-Meta')
155
152
 
@@ -163,7 +160,7 @@ module TraceView
163
160
  opts[:xtrace] ||= nil
164
161
  opts['X-TV-Meta'] ||= nil
165
162
 
166
- sr_cfg = Java::ComTracelyticsJoboe::LayerUtil.shouldTraceRequest( opts[:layer], { 'X-Trace' => opts[:xtrace], 'X-TV-Meta' => opts['X-TV-Meta'] })
163
+ sr_cfg = Java::ComTracelyticsJoboe::LayerUtil.shouldTraceRequest(opts[:layer], { 'X-Trace' => opts[:xtrace], 'X-TV-Meta' => opts['X-TV-Meta'] })
167
164
 
168
165
  # Store the returned SampleRateConfig into TraceView::Config
169
166
  if sr_cfg
@@ -18,7 +18,7 @@ module Oboe
18
18
  # Notify of deprecation only once
19
19
  unless @deprecated_notified
20
20
  TraceView.logger.warn "[traceview/warn] Note that Oboe::API has been renamed to TraceView::API. (#{sym}:#{args})"
21
- TraceView.logger.warn "[traceview/warn] Oboe::API will be deprecated in a future version."
21
+ TraceView.logger.warn '[traceview/warn] Oboe::API will be deprecated in a future version.'
22
22
  TraceView.logger.warn "[traceview/warn] Caller: #{Kernel.caller[0]}"
23
23
  @deprecated_notified = true
24
24
  end
@@ -38,7 +38,7 @@ module Oboe
38
38
  # Notify of deprecation only once
39
39
  unless @deprecated_notified
40
40
  TraceView.logger.warn "[traceview/warn] Note that Oboe::Config has been renamed to TraceView::Config. (#{sym}:#{args})"
41
- TraceView.logger.warn "[traceview/warn] Oboe::Config will be deprecated in a future version."
41
+ TraceView.logger.warn '[traceview/warn] Oboe::Config will be deprecated in a future version.'
42
42
  TraceView.logger.warn "[traceview/warn] Caller: #{Kernel.caller[0]}"
43
43
  @deprecated_notified = true
44
44
  end
@@ -57,7 +57,7 @@ module Oboe
57
57
  # Notify of deprecation only once
58
58
  unless @deprecated_notified
59
59
  TraceView.logger.warn "[traceview/warn] Note that Oboe::Ruby has been renamed to TraceView::Ruby. (#{sym}:#{args})"
60
- TraceView.logger.warn "[traceview/warn] Oboe::Ruby will be deprecated in a future version."
60
+ TraceView.logger.warn '[traceview/warn] Oboe::Ruby will be deprecated in a future version.'
61
61
  TraceView.logger.warn "[traceview/warn] Caller: #{Kernel.caller[0]}"
62
62
  @deprecated_notified = true
63
63
  end
@@ -66,7 +66,6 @@ module Oboe
66
66
  end
67
67
  end
68
68
 
69
-
70
69
  #
71
70
  # Support for OboeMethodProfiling
72
71
  #
@@ -79,4 +78,3 @@ module OboeMethodProfiling
79
78
  include TraceViewMethodProfiling::ClassMethods
80
79
  end
81
80
  end
82
-
data/lib/oboe_metal.rb CHANGED
@@ -12,7 +12,6 @@ module TraceView
12
12
 
13
13
  class Reporter
14
14
  class << self
15
-
16
15
  ##
17
16
  # start
18
17
  #
@@ -25,7 +24,7 @@ module TraceView
25
24
  Oboe_metal::Context.init
26
25
 
27
26
  if ENV.key?('TRACEVIEW_GEM_TEST')
28
- TraceView.reporter = TraceView::FileReporter.new('/tmp/trace_output.bson')
27
+ TraceView.reporter = TraceView::FileReporter.new(TRACE_FILE)
29
28
  else
30
29
  TraceView.reporter = TraceView::UdpReporter.new(TraceView::Config[:reporter_host], TraceView::Config[:reporter_port])
31
30
  end
@@ -58,7 +57,7 @@ module TraceView
58
57
  # Truncates the trace output file to zero
59
58
  #
60
59
  def clear_all_traces
61
- File.truncate($trace_file, 0)
60
+ File.truncate(TRACE_FILE, 0)
62
61
  end
63
62
 
64
63
  ##
@@ -67,7 +66,7 @@ module TraceView
67
66
  # Retrieves all traces written to the trace file
68
67
  #
69
68
  def get_all_traces
70
- io = File.open($trace_file, 'r')
69
+ io = File.open(TRACE_FILE, 'r')
71
70
  contents = io.readlines(nil)
72
71
 
73
72
  return contents if contents.empty?
@@ -84,11 +83,11 @@ module TraceView
84
83
  s = StringIO.new(contents[0])
85
84
 
86
85
  until s.eof?
87
- if ::BSON.respond_to? :read_bson_document
88
- traces << BSON.read_bson_document(s)
89
- else
90
- traces << BSON::Document.from_bson(s)
91
- end
86
+ traces << if ::BSON.respond_to? :read_bson_document
87
+ BSON.read_bson_document(s)
88
+ else
89
+ BSON::Document.from_bson(s)
90
+ end
92
91
  end
93
92
  else
94
93
  bbb = BSON::ByteBuffer.new(contents[0])
@@ -110,43 +109,38 @@ module TraceView
110
109
 
111
110
  class << self
112
111
  def sample?(opts = {})
113
- begin
114
- # Return false if no-op mode
115
- return false if !TraceView.loaded
116
-
117
- # Return false if never or through mode without AVW flag
118
- return false if TraceView.never? || (TraceView.through? && !opts.key?('X-TV-Meta'))
119
-
120
- # Assure defaults since SWIG enforces Strings
121
- layer = opts[:layer] ? opts[:layer].to_s.strip.freeze : TV_STR_BLANK
122
- xtrace = opts[:xtrace] ? opts[:xtrace].to_s.strip : TV_STR_BLANK
123
- tv_meta = opts['X-TV-Meta'] ? opts['X-TV-Meta'].to_s.strip : TV_STR_BLANK
124
-
125
- rv = TraceView::Context.sampleRequest(layer, xtrace, tv_meta)
126
-
127
- if rv == 0
128
- if ENV.key?('TRACEVIEW_GEM_TEST')
129
- # When in test, always trace and don't clear
130
- # the stored sample rate/source
131
- TraceView.sample_rate ||= -1
132
- TraceView.sample_source ||= -1
133
- true
134
- else
135
- TraceView.sample_rate = -1
136
- TraceView.sample_source = -1
137
- false
138
- end
139
- else
140
- # liboboe version > 1.3.1 returning a bit masked integer with SampleRate and
141
- # source embedded
142
- TraceView.sample_rate = (rv & SAMPLE_RATE_MASK)
143
- TraceView.sample_source = (rv & SAMPLE_SOURCE_MASK) >> 24
112
+ # Return false if no-op mode
113
+ return false unless TraceView.loaded
114
+
115
+ # Assure defaults since SWIG enforces Strings
116
+ layer = opts[:layer] ? opts[:layer].to_s.strip.freeze : TV_STR_BLANK
117
+ xtrace = opts[:xtrace] ? opts[:xtrace].to_s.strip : TV_STR_BLANK
118
+ tv_meta = opts['X-TV-Meta'] ? opts['X-TV-Meta'].to_s.strip : TV_STR_BLANK
119
+
120
+ rv = TraceView::Context.sampleRequest(layer, xtrace, tv_meta)
121
+
122
+ if rv == 0
123
+ if ENV.key?('TRACEVIEW_GEM_TEST')
124
+ # When in test, always trace and don't clear
125
+ # the stored sample rate/source
126
+ TraceView.sample_rate ||= -1
127
+ TraceView.sample_source ||= -1
144
128
  true
129
+ else
130
+ TraceView.sample_rate = -1
131
+ TraceView.sample_source = -1
132
+ false
145
133
  end
146
- rescue StandardError => e
147
- TraceView.logger.debug "[oboe/error] sample? error: #{e.inspect}"
148
- false
134
+ else
135
+ # liboboe version > 1.3.1 returning a bit masked integer with SampleRate and
136
+ # source embedded
137
+ TraceView.sample_rate = (rv & SAMPLE_RATE_MASK)
138
+ TraceView.sample_source = (rv & SAMPLE_SOURCE_MASK) >> 24
139
+ true
149
140
  end
141
+ rescue StandardError => e
142
+ TraceView.logger.debug "[oboe/error] sample? error: #{e.inspect}"
143
+ false
150
144
  end
151
145
 
152
146
  def set_tracing_mode(mode)
@@ -86,8 +86,7 @@ module TraceView
86
86
  # TraceView::API.log_start(:layer_name, nil, { :id => @user.id })
87
87
  #
88
88
  def log_start(layer, xtrace = nil, opts = {})
89
- return if !TraceView.loaded || TraceView.never? ||
90
- (opts.key?(:URL) && ::TraceView::Util.static_asset?(opts[:URL]))
89
+ return if !TraceView.loaded || (opts.key?(:URL) && ::TraceView::Util.static_asset?(opts[:URL]))
91
90
 
92
91
  # For entry only layers (DelayedJob workers, Sidekiq workers), auto-set the tracing mode
93
92
  # Don't do this if tracing mode is already :always or :never
@@ -26,6 +26,9 @@ TV_STR_BLANK = ''.freeze
26
26
  TV_STR_LAYER = 'Layer'.freeze
27
27
  TV_STR_LABEL = 'Label'.freeze
28
28
 
29
+ # Used in tests to store local trace data
30
+ TRACE_FILE = '/tmp/traceview_traces.bson'.freeze
31
+
29
32
  ##
30
33
  # This module is the base module for the various implementations of TraceView reporting.
31
34
  # Current variations as of 2014-09-10 are a c-extension, JRuby (using TraceView Java
@@ -30,6 +30,13 @@ module TraceView
30
30
  @@config
31
31
  end
32
32
 
33
+ ##
34
+ # initialize
35
+ #
36
+ # Initializer method to set everything up with a
37
+ # default configuration.
38
+ #
39
+ # rubocop:disable Metrics/AbcSize
33
40
  def self.initialize(_data = {})
34
41
  # Setup default instrumentation values
35
42
  @@instrumentation.each do |k|
@@ -144,7 +151,7 @@ module TraceView
144
151
  # Requests with positive matches (non nil) will not be traced.
145
152
  # See lib/traceview/util.rb: TraceView::Util.static_asset?
146
153
  #
147
- @@config[:dnt_regexp] = "\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|ttf|woff|svg|less)$"
154
+ @@config[:dnt_regexp] = '\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|ttf|woff|svg|less)$'
148
155
  @@config[:dnt_opts] = Regexp::IGNORECASE
149
156
 
150
157
  # In Rails, raised exceptions with rescue handlers via
@@ -202,6 +209,7 @@ module TraceView
202
209
 
203
210
  @@config[:verbose] = ENV.key?('TRACEVIEW_GEM_VERBOSE') ? true : false
204
211
  end
212
+ # rubocop:enable Metrics/AbcSize
205
213
 
206
214
  def self.update!(data)
207
215
  data.each do |key, value|
@@ -210,18 +218,25 @@ module TraceView
210
218
  end
211
219
 
212
220
  def self.merge!(data)
213
- self.update!(data)
221
+ update!(data)
214
222
  end
215
223
 
216
224
  def self.[](key)
217
225
  if key == :resque
218
- TraceView.logger.warn "[traceview/warn] :resque config is deprecated. It is now split into :resqueclient and :resqueworker."
226
+ TraceView.logger.warn '[traceview/warn] :resque config is deprecated. It is now split into :resqueclient and :resqueworker.'
219
227
  TraceView.logger.warn "[traceview/warn] Called from #{Kernel.caller[0]}"
220
228
  end
221
229
 
222
230
  @@config[key.to_sym]
223
231
  end
224
232
 
233
+ ##
234
+ # []=
235
+ #
236
+ # Config variable assignment method. Here we validate and store the
237
+ # assigned value(s) and trigger any secondary action needed.
238
+ #
239
+ # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
225
240
  def self.[]=(key, value)
226
241
  @@config[key.to_sym] = value
227
242
 
@@ -271,6 +286,7 @@ module TraceView
271
286
  @@config[key.to_sym] = value.to_sym
272
287
  end
273
288
  end
289
+ # rubocop:enable Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
274
290
 
275
291
  def self.method_missing(sym, *args)
276
292
  class_var_name = "@@#{sym}"
@@ -83,10 +83,10 @@ if defined?(ActionController::Base) && TraceView::Config[:action_controller][:en
83
83
  end
84
84
  end
85
85
 
86
- # ActionController::API (Rails 5+)
86
+ # ActionController::API - Rails 5+ or via the rails-api gem
87
87
  if defined?(ActionController::API) && TraceView::Config[:action_controller_api][:enabled]
88
88
  TraceView.logger.info '[traceview/loading] Instrumenting actioncontroller api' if TraceView::Config[:verbose]
89
- require "traceview/frameworks/rails/inst/action_controller#{Rails::VERSION::MAJOR}_api"
89
+ require "traceview/frameworks/rails/inst/action_controller_api"
90
90
  ::ActionController::API.send(:prepend, ::TraceView::Inst::ActionControllerAPI)
91
91
  end
92
92
 
@@ -50,7 +50,7 @@ module TraceView
50
50
  def ignore_payload?(name)
51
51
  %w(SCHEMA EXPLAIN CACHE).include?(name.to_s) ||
52
52
  (name && name.to_sym == :skip_logging) ||
53
- name == 'ActiveRecord::SchemaMigration Load'
53
+ name == 'ActiveRecord::SchemaMigration Load'
54
54
  end
55
55
 
56
56
  # def cfg
@@ -107,7 +107,7 @@ module TraceView
107
107
 
108
108
  def begin_db_transaction_with_traceview
109
109
  if TraceView.tracing?
110
- TraceView::API.trace('activerecord', { :Query => 'BEGIN' }) do
110
+ TraceView::API.trace('activerecord', :Query => 'BEGIN') do
111
111
  begin_db_transaction_without_traceview
112
112
  end
113
113
  else
@@ -17,7 +17,7 @@ module TraceView
17
17
  # Report raw SQL and any binds if they exist
18
18
  opts[:Query] = sql.to_s
19
19
  if binds && !binds.empty?
20
- opts[:QueryArgs] = binds.map { |i| i.value }
20
+ opts[:QueryArgs] = binds.map(&:value)
21
21
  end
22
22
  end
23
23
 
@@ -47,7 +47,7 @@ module TraceView
47
47
  TraceView.logger.debug e.backtrace.join('\n')
48
48
  end
49
49
 
50
- return opts || {}
50
+ opts || {}
51
51
  end
52
52
 
53
53
  # We don't want to trace framework caches. Only instrument SQL that
@@ -55,11 +55,10 @@ module TraceView
55
55
  def ignore_payload?(name)
56
56
  %w(SCHEMA EXPLAIN CACHE).include?(name.to_s) ||
57
57
  (name && name.to_sym == :skip_logging) ||
58
- name == 'ActiveRecord::SchemaMigration Load'
58
+ name == 'ActiveRecord::SchemaMigration Load'
59
59
  end
60
60
 
61
61
  def exec_query_with_traceview(sql, name = nil, binds = [], prepare: false)
62
-
63
62
  if TraceView.tracing? && !ignore_payload?(name)
64
63
 
65
64
  opts = extract_trace_details(sql, name, binds)
@@ -39,7 +39,7 @@ module TraceView
39
39
 
40
40
  def do_request_with_traceview(method, uri, query, body, header, &block)
41
41
  # If we're not tracing, just do a fast return.
42
- if !TraceView.tracing?
42
+ unless TraceView.tracing?
43
43
  return do_request_without_traceview(method, uri, query, body, header, &block)
44
44
  end
45
45
 
@@ -55,11 +55,11 @@ module TraceView
55
55
  TraceView::API.log_entry(:httpclient, kvs)
56
56
  kvs.clear
57
57
 
58
- req_context = TraceView::Context.toString()
58
+ req_context = TraceView::Context.toString
59
59
 
60
60
  # Be aware of various ways to call/use httpclient
61
61
  if header.is_a?(Array)
62
- header.push ["X-Trace", req_context]
62
+ header.push ['X-Trace', req_context]
63
63
  elsif header.is_a?(Hash)
64
64
  header['X-Trace'] = req_context unless blacklisted
65
65
  end
@@ -71,8 +71,8 @@ module TraceView
71
71
  kvs[:HTTPStatus] = response.status_code
72
72
 
73
73
  # If we get a redirect, report the location header
74
- if ((300..308).to_a.include? response.status.to_i) && response.headers.key?("Location")
75
- kvs[:Location] = response.headers["Location"]
74
+ if ((300..308).to_a.include? response.status.to_i) && response.headers.key?('Location')
75
+ kvs[:Location] = response.headers['Location']
76
76
  end
77
77
 
78
78
  if response_context && !blacklisted
@@ -95,7 +95,7 @@ module TraceView
95
95
  # we stowaway the context in the request headers to be picked up
96
96
  # (and removed from req headers) in do_get_stream.
97
97
  if header.is_a?(Array)
98
- header.push ["traceview.context", TraceView::Context.toString]
98
+ header.push ['traceview.context', TraceView::Context.toString]
99
99
  elsif header.is_a?(Hash)
100
100
  header['traceview.context'] = TraceView::Context.toString
101
101
  end
@@ -105,13 +105,13 @@ module TraceView
105
105
  end
106
106
 
107
107
  def do_get_stream_with_traceview(req, proxy, conn)
108
- unless req.headers.key?("traceview.context")
108
+ unless req.headers.key?('traceview.context')
109
109
  return do_get_stream_without_traceview(req, proxy, conn)
110
110
  end
111
111
 
112
112
  # Pickup context and delete the headers stowaway
113
- TraceView::Context.fromString req.headers["traceview.context"]
114
- req.header.delete "traceview.context"
113
+ TraceView::Context.fromString req.headers['traceview.context']
114
+ req.header.delete 'traceview.context'
115
115
 
116
116
  begin
117
117
  response = nil
@@ -129,7 +129,7 @@ module TraceView
129
129
  TraceView::API.log_entry(:httpclient, kvs)
130
130
  kvs.clear
131
131
 
132
- req_context = TraceView::Context.toString()
132
+ req_context = TraceView::Context.toString
133
133
  req.header.add('X-Trace', req_context)
134
134
 
135
135
  # The core httpclient call
@@ -146,8 +146,8 @@ module TraceView
146
146
  kvs[:HTTPStatus] = response.status_code
147
147
 
148
148
  # If we get a redirect, report the location header
149
- if ((300..308).to_a.include? response.status.to_i) && response.headers.key?("Location")
150
- kvs[:Location] = response.headers["Location"]
149
+ if ((300..308).to_a.include? response.status.to_i) && response.headers.key?('Location')
150
+ kvs[:Location] = response.headers['Location']
151
151
  end
152
152
 
153
153
  if response_context && !blacklisted