instana 1.7.7 → 1.7.8
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/Configuration.md +10 -0
- data/lib/instana/agent.rb +29 -11
- data/lib/instana/tracing/trace.rb +4 -1
- data/lib/instana/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 316edaafce9e919b5191950fcd3a8dfd7ca39ef6
|
4
|
+
data.tar.gz: 28b3899692291381011da1602da9b3512e5637ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37f348d6f49c0a6b4214e50d157349d6191fc61c17604d62e1a50ff32730201697220cced8986d4f0abec8e41eaeee95d342952b3b2fd97338bd7fd03c63a21a
|
7
|
+
data.tar.gz: d442ed00f217b08b4b29f64166c66ff1ecd4f551e238787587d203f887b450eb14933d0349b59f844530cc2e18e4790e57586498d3d4363274fc44891b7907e8
|
data/Configuration.md
CHANGED
@@ -48,6 +48,16 @@ Instrumentation can be disabled as:
|
|
48
48
|
::Instana.config[:rack][:enabled] = false
|
49
49
|
```
|
50
50
|
|
51
|
+
## Enable/Disable Backtrace Collection
|
52
|
+
|
53
|
+
Because backtraces are somewhat expensive in Ruby, backtrace collection is disabled by default but can be enabled with the following code:
|
54
|
+
|
55
|
+
```Ruby
|
56
|
+
::Instana.config[:collect_backtraces] = true
|
57
|
+
```
|
58
|
+
|
59
|
+
This will in-turn enable CodeView in your dashboard to get code level insights.
|
60
|
+
|
51
61
|
## Rack Middleware
|
52
62
|
|
53
63
|
This gem will detect and automagically insert the Instana Rack middleware into the middleware stack when a [supported framework](https://instana.atlassian.net/wiki/display/DOCS/Ruby) is present. We are currently adding support for more frameworks. If you are using a yet to be instrumented framework, you can insert the Instana Rack middleware with the following:
|
data/lib/instana/agent.rb
CHANGED
@@ -252,7 +252,7 @@ module Instana
|
|
252
252
|
if response.body && response.body.length > 2
|
253
253
|
# The host agent returned something indicating that is has a request for us that we
|
254
254
|
# need to process.
|
255
|
-
|
255
|
+
handle_agent_tasks(response.body)
|
256
256
|
end
|
257
257
|
|
258
258
|
if response.code.to_i == 200
|
@@ -267,30 +267,48 @@ module Instana
|
|
267
267
|
Instana.logger.debug e.backtrace.join("\r\n")
|
268
268
|
end
|
269
269
|
|
270
|
-
# When
|
271
|
-
#
|
270
|
+
# When request(s) are received by the host agent, it is sent here
|
271
|
+
# for handling & processing.
|
272
272
|
#
|
273
|
-
# @param json_string [String] the
|
273
|
+
# @param json_string [String] the requests from the host agent
|
274
274
|
#
|
275
|
-
def
|
276
|
-
|
275
|
+
def handle_agent_tasks(json_string)
|
276
|
+
tasks = Oj.load(json_string)
|
277
|
+
|
278
|
+
if tasks.is_a?(Hash)
|
279
|
+
process_agent_task(tasks)
|
280
|
+
elsif tasks.is_a?(Array)
|
281
|
+
tasks.each do |t|
|
282
|
+
process_agent_task(t)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
277
286
|
|
278
|
-
|
279
|
-
|
280
|
-
|
287
|
+
# Process a task sent from the host agent.
|
288
|
+
#
|
289
|
+
# @param task [String] the request json from the host agent
|
290
|
+
#
|
291
|
+
def process_agent_task(task)
|
292
|
+
if task.key?("action")
|
293
|
+
if task["action"] == "ruby.source"
|
294
|
+
payload = ::Instana::Util.get_rb_source(task["args"]["file"])
|
281
295
|
else
|
282
|
-
payload = { :error => "Unrecognized action: #{
|
296
|
+
payload = { :error => "Unrecognized action: #{task["action"]}. An newer Instana gem may be required for this. Current version: #{::Instana::VERSION}" }
|
283
297
|
end
|
284
298
|
else
|
285
299
|
payload = { :error => "Instana Ruby: No action specified in request." }
|
286
300
|
end
|
287
301
|
|
288
|
-
path = "com.instana.plugin.ruby/response.#{@process[:report_pid]}?messageId=#{URI.encode(
|
302
|
+
path = "com.instana.plugin.ruby/response.#{@process[:report_pid]}?messageId=#{URI.encode(task['messageId'])}"
|
289
303
|
uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}")
|
290
304
|
req = Net::HTTP::Post.new(uri)
|
291
305
|
req.body = Oj.dump(payload)
|
292
306
|
::Instana.logger.debug "Responding to agent request: #{req.inspect}"
|
293
307
|
make_host_agent_request(req)
|
308
|
+
|
309
|
+
rescue StandardError => e
|
310
|
+
Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
|
311
|
+
Instana.logger.debug e.backtrace.join("\r\n")
|
294
312
|
end
|
295
313
|
|
296
314
|
# Accept and report spans to the host agent.
|
@@ -80,6 +80,7 @@ module Instana
|
|
80
80
|
# @param kvs [Hash] list of key values to be reported in the span
|
81
81
|
#
|
82
82
|
def add_info(kvs, span = nil)
|
83
|
+
return unless @current_span
|
83
84
|
span ||= @current_span
|
84
85
|
|
85
86
|
# Pass on to the OT span interface which will properly
|
@@ -94,7 +95,7 @@ module Instana
|
|
94
95
|
def add_error(e, span = nil)
|
95
96
|
# Return if we've already logged this exception and it
|
96
97
|
# is just propogating up the spans.
|
97
|
-
return if e && e.instance_variable_get(:@instana_logged)
|
98
|
+
return if e && e.instance_variable_get(:@instana_logged) || @current_span.nil?
|
98
99
|
span ||= @current_span
|
99
100
|
span.add_error(e)
|
100
101
|
end
|
@@ -105,6 +106,8 @@ module Instana
|
|
105
106
|
# @param kvs [Hash] list of key values to be reported in the span
|
106
107
|
#
|
107
108
|
def end_span(kvs = {}, end_time = ::Instana::Util.now_in_ms)
|
109
|
+
return unless @current_span
|
110
|
+
|
108
111
|
@current_span.close(end_time)
|
109
112
|
add_info(kvs) if kvs && !kvs.empty?
|
110
113
|
@current_span = @current_span.parent unless @current_span.is_root?
|
data/lib/instana/version.rb
CHANGED
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.7.
|
4
|
+
version: 1.7.8
|
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-
|
11
|
+
date: 2017-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|