tunemygc 1.0.17 → 1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/tunemygc/cli.rb +3 -7
- data/lib/tunemygc/network.rb +9 -0
- data/lib/tunemygc/spies.rb +1 -1
- data/lib/tunemygc/syncer.rb +3 -6
- data/lib/tunemygc/version.rb +1 -1
- data/lib/tunemygc.rb +7 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c2faef3f82c3891c957e4de799006540ec4b86c
|
4
|
+
data.tar.gz: 5e12afc1345d92163f7d1ac2d805d8aef48570d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31bb0d362295f2738b385e3b8e108da6ff95374d50c7c6a77a790e02ebaa1fb1210c3446b070a159e1957abdb4520517c0f02adaea01676594cde8f24ea99812
|
7
|
+
data.tar.gz: d4750545d48d6d7e4ff556542f4c6e1d0521aebe14fa1318bc95916a6e341a772631765f30096290bc11511190faf28b93c1bcc838a512b0433bf67ce97794f0
|
data/Gemfile.lock
CHANGED
data/lib/tunemygc/cli.rb
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'certified'
|
5
|
-
require 'timeout'
|
3
|
+
require 'tunemygc/network'
|
6
4
|
require 'optparse'
|
7
5
|
|
8
6
|
module TuneMyGc
|
9
7
|
class CLI
|
10
|
-
TIMEOUT = 30
|
11
|
-
|
12
8
|
attr_reader :uri, :client, :options
|
13
9
|
|
14
10
|
def self.start(args)
|
@@ -36,7 +32,7 @@ module TuneMyGc
|
|
36
32
|
@uri = URI("http://#{TuneMyGc::HOST}")
|
37
33
|
@client = Net::HTTP.new(@uri.host, @uri.port)
|
38
34
|
@client.use_ssl = (uri.port == 443)
|
39
|
-
@client.read_timeout =
|
35
|
+
@client.read_timeout = NETWORK_TIMEOUT
|
40
36
|
register if options[:email]
|
41
37
|
fetch_config if options[:config]
|
42
38
|
end
|
@@ -80,7 +76,7 @@ module TuneMyGc
|
|
80
76
|
|
81
77
|
private
|
82
78
|
def timeout(&block)
|
83
|
-
Timeout.timeout(
|
79
|
+
Timeout.timeout(NETWORK_TIMEOUT + 1){ block.call }
|
84
80
|
end
|
85
81
|
end
|
86
82
|
end
|
data/lib/tunemygc/spies.rb
CHANGED
@@ -16,7 +16,7 @@ module TuneMyGc
|
|
16
16
|
s = if ENV['RUBY_GC_SPY']
|
17
17
|
ENV['RUBY_GC_SPY'].classify
|
18
18
|
else
|
19
|
-
'ActionController'
|
19
|
+
TuneMyGc.rails? ? 'ActionController' : 'Manual'
|
20
20
|
end
|
21
21
|
unless @spies.include?(s)
|
22
22
|
raise NotImplementedError, "TuneMyGC spy #{s.underscore.inspect} not supported. Valid spies are #{@spies.map(&:underscore)}"
|
data/lib/tunemygc/syncer.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'certified'
|
5
|
-
require 'timeout'
|
3
|
+
require 'tunemygc/network'
|
6
4
|
|
7
5
|
module TuneMyGc
|
8
6
|
class Syncer
|
9
|
-
TIMEOUT = 30 #seconds
|
10
7
|
ENVIRONMENT = [ENV['RUBY_GC_TOKEN'], RUBY_VERSION, Rails.version, ENV.select {|k,v| k =~ /RUBY_GC_/ }, TuneMyGc::VERSION, GC::OPTS, GC::INTERNAL_CONSTANTS].freeze
|
11
8
|
|
12
9
|
attr_reader :uri, :client
|
@@ -15,7 +12,7 @@ module TuneMyGc
|
|
15
12
|
@uri = URI("http://#{host}/ruby")
|
16
13
|
@client = Net::HTTP.new(@uri.host, @uri.port)
|
17
14
|
@client.use_ssl = (uri.port == 443)
|
18
|
-
@client.read_timeout =
|
15
|
+
@client.read_timeout = NETWORK_TIMEOUT
|
19
16
|
end
|
20
17
|
|
21
18
|
def sync(snapshotter)
|
@@ -44,7 +41,7 @@ module TuneMyGc
|
|
44
41
|
|
45
42
|
private
|
46
43
|
def timeout(&block)
|
47
|
-
Timeout.timeout(
|
44
|
+
Timeout.timeout(NETWORK_TIMEOUT + 1){ block.call }
|
48
45
|
end
|
49
46
|
|
50
47
|
def sync_with_tuner(snapshotter)
|
data/lib/tunemygc/version.rb
CHANGED
data/lib/tunemygc.rb
CHANGED
@@ -7,12 +7,18 @@ module TuneMyGc
|
|
7
7
|
HEADERS = { "Content-Type" => "application/json",
|
8
8
|
"Accept" => "application/json",
|
9
9
|
"User-Agent" => "TuneMyGC #{TuneMyGc::VERSION}"}.freeze
|
10
|
+
|
11
|
+
def self.rails?
|
12
|
+
defined?(Rails) && Rails.version >= "4.0"
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
if ENV["RUBY_GC_TUNE"]
|
13
|
-
if
|
17
|
+
if TuneMyGc.rails?
|
18
|
+
puts "[TuneMyGC] Rails detected, loading railtie"
|
14
19
|
require 'tunemygc/railtie'
|
15
20
|
else
|
21
|
+
puts "[TuneMyGC] Rails not detected, loading minimal agent"
|
16
22
|
require 'tunemygc/agent'
|
17
23
|
end
|
18
24
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tunemygc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bear Metal
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/tunemygc/cli.rb
|
142
142
|
- lib/tunemygc/configurator.rb
|
143
143
|
- lib/tunemygc/interposer.rb
|
144
|
+
- lib/tunemygc/network.rb
|
144
145
|
- lib/tunemygc/railtie.rb
|
145
146
|
- lib/tunemygc/snapshotter.rb
|
146
147
|
- lib/tunemygc/spies.rb
|