instana 1.5.0 → 1.5.1

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
  SHA1:
3
- metadata.gz: bead9a4a515329922c151505eae7f209c49be9d2
4
- data.tar.gz: bb7eb569bb0127e6d245858f3bbe595b1c8a62d4
3
+ metadata.gz: bacfa79d8738e22df4c39e377e79d9cb379b2677
4
+ data.tar.gz: e925ce5389ab885c75a73988b4500638f30cb51d
5
5
  SHA512:
6
- metadata.gz: cbe325aa85a8bca25ae4aaa0cd4317d2476d9b475d1fbd497722ccd3ea54472482f42f78cc1d7d035c4305344fd3fbc9e8531feb1dd4dcd5208aab20c14f5ae6
7
- data.tar.gz: 4cfd9167eec7ad906cea0259c238ed47efa07748a6ba8aaa8de243b4a957632576b8ffebc98ae308d729226c714d1a06bd7ac6c43676e17b1aefb017a575dc9d
6
+ metadata.gz: 8691ec75ccce17eff2f1d97c536e80e2875a39fa72928951c4f45a77ff00d8c7b1fa71ed08aedbce2305784c9d102f4fc8a89945061be15b32eaa67758743548
7
+ data.tar.gz: d6252569230dd5a6dc5567485cf0b2fc3f2689cdc55077d4f401913b1420a08fb0190e2465d2f827a854a801c35a62b922db597ec4d9d10332386824c00fe8f7
data/Configuration.md CHANGED
@@ -123,50 +123,3 @@ The gem can be configured to use your application logger instead:
123
123
 
124
124
  Setting `INSTANA_GEM_DEV` to a non nil value will enable extra logging output generally useful
125
125
  for development.
126
-
127
- #### Extended Debug Logging
128
-
129
- _Note: To use this, you must leave the gem original logger intact and not replace it as described above._
130
-
131
- The gem allows the debug level to be configured that affects
132
- what extra debug info it reports. It allows for:
133
-
134
- * `:agent` - shows all agent state related debug messages
135
- * `:agent_comm` - outputs all request/response pairs to and from the
136
- host agent
137
- * `:trace` - outputs debug messages related to tracing and trace management
138
-
139
- Log messages can be generated for these channels using:
140
-
141
- ```Ruby
142
- ::Instana.logger.agent("agent specific log msg")
143
- ::Instana.logger.agent_comm("agent communication specific log msg")
144
- ```
145
-
146
- To set the debug log level:
147
-
148
- ```Ruby
149
- ::Instana.logger.debug_level = [:agent, :agent_comm, :trace]
150
- # or
151
- ::Instana.logger.debug_level = [:agent_comm]
152
- # or
153
- ::Instana.logger.debug_level = :agent
154
- ```
155
-
156
- or to reset it:
157
-
158
- ```Ruby
159
- ::Instana.logger.debug_level = nil
160
- ```
161
-
162
- Example output:
163
- ```bash
164
- [2] pry(main)> Instana.logger.debug_level = :agent_comm
165
- => :agent_comm
166
-
167
- D, [2016-12-01T11:45:12.876527 #74127] DEBUG -- : Instana: POST Req -> -body-: http://127.0.0.1:42699/com.instana.plugin.ruby.74127 ->
168
- -{"gc":{"heap_live":171890,"heap_free":522},"memory":{"rss_size":51212.0}}- Resp -> body:#<Net::HTTPOK:0x007faee2161078> -> -[]-
169
-
170
- [3] pry(main)> Instana.logger.debug_level = nil
171
- => nil
172
- ```
data/README.md CHANGED
@@ -24,6 +24,7 @@ Any and all feedback is welcome. Happy Ruby visibility.
24
24
  [![sinatra](https://s3.amazonaws.com/instana/sinatra-logo.png?1)](http://www.sinatrarb.com/)
25
25
  [![padrino](https://s3.amazonaws.com/instana/padrino-logo.png?1)](http://padrinorb.com/)
26
26
  [![rack](https://s3.amazonaws.com/instana/rack-logo.png?1)](https://rack.github.io/)
27
+ [![rack](https://user-images.githubusercontent.com/395132/27842764-27e0e452-610d-11e7-811f-8575f83b8944.png?1)](http://www.grpc.io/)
27
28
 
28
29
  ## Installation
29
30
 
data/Rakefile CHANGED
@@ -41,8 +41,6 @@ task :environment do
41
41
  end
42
42
 
43
43
  task :console => :environment do
44
- # Possible debug levels: :agent, :agent_comm, :trace, :agent_response, :tracing
45
- # ::Instana.logger.debug_level = [ :agent, :agent_comm ]
46
44
  ARGV.clear
47
45
  Pry.start
48
46
  end
data/lib/instana/agent.rb CHANGED
@@ -63,7 +63,7 @@ module Instana
63
63
  # the host agent.
64
64
  #
65
65
  def after_fork
66
- ::Instana.logger.agent "after_fork hook called. Falling back to unannounced state and spawning a new background agent thread."
66
+ ::Instana.logger.debug "after_fork hook called. Falling back to unannounced state and spawning a new background agent thread."
67
67
 
68
68
  # Reseed the random number generator for this
69
69
  # new thread.
@@ -170,7 +170,7 @@ module Instana
170
170
  #
171
171
  def announce_sensor
172
172
  unless @discovered
173
- ::Instana.logger.agent("#{__method__} called but discovery hasn't run yet!")
173
+ ::Instana.logger.debug("#{__method__} called but discovery hasn't run yet!")
174
174
  return false
175
175
  end
176
176
 
@@ -195,7 +195,7 @@ module Instana
195
195
  req = Net::HTTP::Put.new(uri)
196
196
  req.body = announce_payload.to_json
197
197
 
198
- ::Instana.logger.agent "Announce: http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{DISCOVERY_PATH} - payload: #{req.body}"
198
+ ::Instana.logger.debug "Announce: http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{DISCOVERY_PATH} - payload: #{req.body}"
199
199
 
200
200
  response = make_host_agent_request(req)
201
201
 
@@ -223,7 +223,7 @@ module Instana
223
223
  #
224
224
  def report_metrics(payload)
225
225
  unless @discovered
226
- ::Instana.logger.agent("#{__method__} called but discovery hasn't run yet!")
226
+ ::Instana.logger.debug("#{__method__} called but discovery hasn't run yet!")
227
227
  return false
228
228
  end
229
229
 
@@ -275,7 +275,7 @@ module Instana
275
275
  uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}")
276
276
  req = Net::HTTP::Post.new(uri)
277
277
  req.body = payload.to_json
278
- ::Instana.logger.agent_response "Responding to agent: #{req.inspect}"
278
+ ::Instana.logger.debug "Responding to agent request: #{req.inspect}"
279
279
  make_host_agent_request(req)
280
280
  end
281
281
 
@@ -288,7 +288,7 @@ module Instana
288
288
  return unless @state == :announced
289
289
 
290
290
  unless @discovered
291
- ::Instana.logger.agent("#{__method__} called but discovery hasn't run yet!")
291
+ ::Instana.logger.debug("#{__method__} called but discovery hasn't run yet!")
292
292
  return false
293
293
  end
294
294
 
@@ -397,7 +397,7 @@ module Instana
397
397
  return true if ENV['INSTANA_GEM_TEST']
398
398
 
399
399
  if forked?
400
- ::Instana.logger.agent "Instana: detected fork. Calling after_fork"
400
+ ::Instana.logger.debug "Instana: detected fork. Calling after_fork"
401
401
  after_fork
402
402
  end
403
403
 
@@ -417,7 +417,7 @@ module Instana
417
417
  # `:announced`, `:unannounced`
418
418
  #
419
419
  def transition_to(state)
420
- ::Instana.logger.agent("Transitioning to #{state}")
420
+ ::Instana.logger.debug("Transitioning to #{state}")
421
421
  case state
422
422
  when :announced
423
423
  # announce successful; set state
@@ -456,7 +456,7 @@ module Instana
456
456
  end
457
457
 
458
458
  response = @httpclient.request(req)
459
- ::Instana.logger.agent_comm "#{req.method}->#{req.uri} body:(#{req.body}) Response:#{response} body:(#{response.body})"
459
+ # ::Instana.logger.debug "#{req.method}->#{req.uri} body:(#{req.body}) Response:#{response} body:(#{response.body})"
460
460
 
461
461
  response
462
462
  rescue Errno::ECONNREFUSED
@@ -5,7 +5,7 @@ if defined?(::Rails)
5
5
  ::Instana.logger = ::Rails.logger if ::Rails.logger
6
6
 
7
7
  if ::Rails::VERSION::MAJOR < 3
8
- ::Rails.configuration.after_initialization do
8
+ ::Rails.configuration.after_initialize do
9
9
  ::Instana.logger.info "Instrumenting Rack"
10
10
  ::Rails.configuration.middleware.insert 0, ::Instana::Rack
11
11
  end
@@ -2,7 +2,6 @@ require "logger"
2
2
 
3
3
  module Instana
4
4
  class XLogger < Logger
5
- LEVELS = [:agent, :agent_comm, :trace, :agent_response, :tracing].freeze
6
5
  STAMP = "Instana: ".freeze
7
6
 
8
7
  def initialize(*args)
@@ -11,63 +10,11 @@ module Instana
11
10
  self.level = Logger::DEBUG
12
11
  elsif ENV.key?('INSTANA_GEM_DEV')
13
12
  self.level = Logger::DEBUG
14
- self.debug_level = nil
15
13
  else
16
14
  self.level = Logger::WARN
17
15
  end
18
16
  end
19
17
 
20
- # Sets the debug level for this logger. The debug level is broken up into various
21
- # sub-levels as defined in LEVELS:
22
- #
23
- # :agent - All agent related messages such as state & announcements
24
- # :agent_comm - Output all payload comm sent between this Ruby gem and the host agent
25
- # :agent_response - Outputs messages related to handling requests received by the host agent
26
- # :trace - Output all traces reported to the host agent
27
- # :tracing - Output messages related to tracing components, spans and management
28
- #
29
- # To use:
30
- # ::Instana.logger.debug_level = [:agent_comm, :trace]
31
- #
32
- def debug_level=(levels)
33
- return unless levels
34
-
35
- LEVELS.each do |l|
36
- instance_variable_set("@level_#{l}", false)
37
- end
38
-
39
- levels = [ levels ] unless levels.is_a?(Array)
40
- levels.each do |l|
41
- next unless LEVELS.include?(l)
42
- instance_variable_set("@level_#{l}", true)
43
- end
44
- end
45
-
46
- def agent(msg)
47
- return unless @level_agent
48
- self.debug(msg)
49
- end
50
-
51
- def agent_comm(msg)
52
- return unless @level_agent_comm
53
- self.debug(msg)
54
- end
55
-
56
- def agent_response(msg)
57
- return unless @level_agent_response
58
- self.debug(msg)
59
- end
60
-
61
- def trace(msg)
62
- return unless @level_trace
63
- self.debug(msg)
64
- end
65
-
66
- def tracing(msg)
67
- return unless @level_tracing
68
- self.debug(msg)
69
- end
70
-
71
18
  def error(msg)
72
19
  super(STAMP + msg)
73
20
  end
@@ -89,4 +36,3 @@ module Instana
89
36
  end
90
37
  end
91
38
  end
92
-
@@ -25,7 +25,7 @@ module Instana
25
25
  #
26
26
  # @param [Trace] the trace to be added to the queue
27
27
  def add(trace)
28
- ::Instana.logger.trace("Queuing completed trace id: #{trace.id}")
28
+ ::Instana.logger.debug("Queuing completed trace id: #{trace.id}")
29
29
  @queue.push(trace)
30
30
  end
31
31
 
@@ -33,7 +33,7 @@ module Instana
33
33
  #
34
34
  # @param [Trace] the trace to be added to the queue
35
35
  def stage(trace)
36
- ::Instana.logger.trace("Staging incomplete trace id: #{trace.id}")
36
+ ::Instana.logger.debug("Staging incomplete trace id: #{trace.id}")
37
37
  @staging_queue.add(trace)
38
38
  end
39
39
 
@@ -46,7 +46,7 @@ module Instana
46
46
  if @staging_queue.size > 0
47
47
  @staging_queue.delete_if do |t|
48
48
  if t.complete?
49
- ::Instana.logger.trace("Moving staged complete trace to main queue: #{t.id}")
49
+ ::Instana.logger.debug("Moving staged complete trace to main queue: #{t.id}")
50
50
  add(t)
51
51
  true
52
52
  elsif t.discard?
@@ -160,7 +160,7 @@ module Instana
160
160
  end
161
161
  }
162
162
  unless candidate
163
- ::Instana.logger.trace("Couldn't find staged trace with trace_id: #{trace_id}")
163
+ ::Instana.logger.debug("Couldn't find staged trace with trace_id: #{trace_id}")
164
164
  end
165
165
  candidate
166
166
  end
@@ -355,7 +355,7 @@ module Instana
355
355
  end
356
356
 
357
357
  if ::Instana.tracer.current_span.id != id
358
- ::Instana.logger.tracing "Closing a span that isn't active. This will result in a broken trace: #{self.inspect}"
358
+ ::Instana.logger.debug "Closing a span that isn't active. This will result in a broken trace: #{self.inspect}"
359
359
  end
360
360
 
361
361
  if is_root?
@@ -1,4 +1,4 @@
1
1
  module Instana
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  VERSION_FULL = "instana-#{VERSION}"
4
4
  end
data/test/test_helper.rb CHANGED
@@ -27,9 +27,6 @@ end
27
27
 
28
28
  Minitest::Reporters.use! MiniTest::Reporters::SpecReporter.new
29
29
 
30
- # Set this (or a subset) if you want increased debug output
31
- #::Instana.logger.debug_level = [ :agent, :agent_comm, :trace ]
32
-
33
30
  # Used to reset the gem to boot state. It clears out any queued and/or staged
34
31
  # traces and resets the tracer to no active trace.
35
32
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-04 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler