instana 1.3.3 → 1.4.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/README.md +1 -0
- data/lib/instana/agent.rb +24 -5
- 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: b99877f95d6100bd27c7baaf1c55480ee4144d94
|
4
|
+
data.tar.gz: 7ff1ffe1eda5611cc0abcf0be984929ec081971c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a97650d236dab27448c10643668081895a4d162d0f2b5d9706527b5d88d779723997a913d36b2bee50401b37a5c9d50394862035d5bde109c77c9c241dbd513
|
7
|
+
data.tar.gz: 893a53e42b37e577cab9e71ead189a15eb2f60a4c8cefd4b1eab9df4f0bf1aeb30a6b12eac731d444058a8c2ca6f6e37ef5b57eca214ddbda906c1a17ac9e937
|
data/README.md
CHANGED
@@ -20,6 +20,7 @@ Any and all feedback is welcome. Happy Ruby visibility.
|
|
20
20
|
[](http://rubyonrails.org/)
|
21
21
|
[](http://roda.jeremyevans.net/)
|
22
22
|
[](http://cuba.is/)
|
23
|
+
[](https://github.com/instana/mina-instana)
|
23
24
|
[](http://www.sinatrarb.com/)
|
24
25
|
[](http://padrinorb.com/)
|
25
26
|
[](https://rack.github.io/)
|
data/lib/instana/agent.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
require 'uri'
|
3
1
|
require 'json'
|
4
|
-
require '
|
2
|
+
require 'net/http'
|
3
|
+
require 'socket'
|
5
4
|
require 'sys/proctable'
|
5
|
+
require 'timers'
|
6
|
+
require 'uri'
|
6
7
|
include Sys
|
7
8
|
|
8
9
|
module Instana
|
@@ -173,6 +174,15 @@ module Instana
|
|
173
174
|
announce_payload[:pid] = pid_namespace? ? get_real_pid : Process.pid
|
174
175
|
announce_payload[:args] = @process[:arguments]
|
175
176
|
|
177
|
+
|
178
|
+
if @is_linux && !::Instana.test?
|
179
|
+
# We create an open socket to the host agent in case we are running in a container
|
180
|
+
# and the real pid needs to be detected.
|
181
|
+
socket = TCPSocket.new @discovered[:agent_host], @discovered[:agent_port]
|
182
|
+
announce_payload[:fd] = socket.fileno
|
183
|
+
announce_payload[:inode] = File.readlink("/proc/#{Process.pid}/fd/#{socket.fileno}")
|
184
|
+
end
|
185
|
+
|
176
186
|
uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{DISCOVERY_PATH}")
|
177
187
|
req = Net::HTTP::Put.new(uri)
|
178
188
|
req.body = announce_payload.to_json
|
@@ -193,6 +203,8 @@ module Instana
|
|
193
203
|
Instana.logger.error "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
|
194
204
|
Instana.logger.debug e.backtrace.join("\r\n")
|
195
205
|
return false
|
206
|
+
ensure
|
207
|
+
socket.close if socket
|
196
208
|
end
|
197
209
|
|
198
210
|
# Method to report metrics data to the host agent.
|
@@ -454,8 +466,15 @@ module Instana
|
|
454
466
|
#
|
455
467
|
def get_real_pid
|
456
468
|
raise RuntimeError.new("Unsupported platform: get_real_pid") unless @is_linux
|
457
|
-
|
458
|
-
|
469
|
+
|
470
|
+
sched_file = "/proc/#{Process.pid}/sched"
|
471
|
+
pid = Process.pid
|
472
|
+
|
473
|
+
if File.exist?(sched_file)
|
474
|
+
v = File.open(sched_file, &:readline)
|
475
|
+
pid = v.match(/\d+/).to_s.to_i
|
476
|
+
end
|
477
|
+
pid
|
459
478
|
end
|
460
479
|
|
461
480
|
# Determine whether the pid has changed since Agent start.
|
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.
|
4
|
+
version: 1.4.0
|
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-03-
|
11
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|