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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edab5ea70a5d450b7947bd53af538d7a125bcf26
4
- data.tar.gz: 5153bc0167c5758d290995c39de56702d91e6617
3
+ metadata.gz: 2c2faef3f82c3891c957e4de799006540ec4b86c
4
+ data.tar.gz: 5e12afc1345d92163f7d1ac2d805d8aef48570d0
5
5
  SHA512:
6
- metadata.gz: 87096291b0dd67012742a0be010d8d60d487e0cc201004709cc60ed9a77311fec247930837d70b0afbe38250489c9a9743e83172612ebca7128183caf74674db
7
- data.tar.gz: 665c300107d8a324a1b161f22ba75fec80fbc642095d75dc7ac2e7554355cbc39a91ce94209fa139b5885541d0e115d3985a61e2c4a52f4eed4acd7a275c61a4
6
+ metadata.gz: 31bb0d362295f2738b385e3b8e108da6ff95374d50c7c6a77a790e02ebaa1fb1210c3446b070a159e1957abdb4520517c0f02adaea01676594cde8f24ea99812
7
+ data.tar.gz: d4750545d48d6d7e4ff556542f4c6e1d0521aebe14fa1318bc95916a6e341a772631765f30096290bc11511190faf28b93c1bcc838a512b0433bf67ce97794f0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tunemygc (1.0.16)
4
+ tunemygc (1.0.17)
5
5
  activesupport (~> 4.1)
6
6
  certified (~> 1.0, >= 1.0.0)
7
7
 
data/lib/tunemygc/cli.rb CHANGED
@@ -1,14 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'net/http'
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 = 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(TIMEOUT + 1){ block.call }
79
+ Timeout.timeout(NETWORK_TIMEOUT + 1){ block.call }
84
80
  end
85
81
  end
86
82
  end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require 'net/http'
4
+ require 'certified'
5
+ require 'timeout'
6
+
7
+ module TuneMyGc
8
+ NETWORK_TIMEOUT = 30 #seconds
9
+ end
@@ -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)}"
@@ -1,12 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'net/http'
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 = 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(TIMEOUT + 1){ block.call }
44
+ Timeout.timeout(NETWORK_TIMEOUT + 1){ block.call }
48
45
  end
49
46
 
50
47
  def sync_with_tuner(snapshotter)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module TuneMyGc
4
- VERSION = "1.0.17"
4
+ VERSION = "1.0.18"
5
5
  end
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 defined?(Rails) && Rails.version >= "4.0"
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.17
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