tunemygc 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/tunemygc/snapshotter.rb +4 -0
- data/lib/tunemygc/syncer.rb +17 -6
- data/lib/tunemygc/version.rb +1 -1
- metadata +2 -3
- data/tunemygc-1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41abc48ffc1562a193e97168a0facaa7666be2f1
|
4
|
+
data.tar.gz: d1c8a2926de499ec7570b39fa488658ed25ea937
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f5e541a864122230c090f8c33a1f8f08db17ee376f2f4cda23af1c67c7e3c529f16ed5d9337731299bc8261f88e4ce1cce1e5d5d832676eeeecaae805364215
|
7
|
+
data.tar.gz: 85c5077715cd14909ea3bec3e111767580f9c4804706719010a8ce2455984956531e33652aa4d4e3eaa36cc5c5439e7d37b0788a9381ea292f169b3b134219bd
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/tunemygc/snapshotter.rb
CHANGED
@@ -4,12 +4,15 @@ require 'thread'
|
|
4
4
|
|
5
5
|
module TuneMyGc
|
6
6
|
class Snapshotter
|
7
|
+
UNITS_OF_WORK = /REQUEST_PROCESSING_STARTED|REQUEST_PROCESSING_ENDED/
|
7
8
|
MAX_SAMPLES = 1000
|
8
9
|
|
9
10
|
attr_reader :buffer
|
11
|
+
attr_accessor :unit_of_work
|
10
12
|
|
11
13
|
def initialize(buf = Queue.new)
|
12
14
|
@buffer = buf
|
15
|
+
@unit_of_work = false
|
13
16
|
end
|
14
17
|
|
15
18
|
def take(stage, timestamp = nil, meta = nil)
|
@@ -40,6 +43,7 @@ module TuneMyGc
|
|
40
43
|
private
|
41
44
|
def _buffer(snapshot)
|
42
45
|
if size < MAX_SAMPLES
|
46
|
+
self.unit_of_work = true if snapshot[3] =~ UNITS_OF_WORK
|
43
47
|
@buffer << snapshot
|
44
48
|
else
|
45
49
|
TuneMyGc.log "Discarding snapshot #{snapshot.inspect} (max samples threshold of #{MAX_SAMPLES} reached)"
|
data/lib/tunemygc/syncer.rb
CHANGED
@@ -19,13 +19,23 @@ module TuneMyGc
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def sync(snapshotter)
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
if sync_required?(snapshotter)
|
23
|
+
response = nil
|
24
|
+
timeout do
|
25
|
+
response = sync_with_tuner(snapshotter)
|
26
|
+
end
|
27
|
+
timeout do
|
28
|
+
process_config_callback(response)
|
29
|
+
end if response
|
30
|
+
else
|
31
|
+
TuneMyGc.log "Nothing to sync, discarding #{snapshotter.size} snapshots"
|
32
|
+
snapshotter.clear
|
25
33
|
end
|
26
|
-
|
27
|
-
|
28
|
-
|
34
|
+
end
|
35
|
+
|
36
|
+
def sync_required?(snapshotter)
|
37
|
+
return true if ENV['RUBY_GC_SYNC_ALWAYS']
|
38
|
+
snapshotter.unit_of_work
|
29
39
|
end
|
30
40
|
|
31
41
|
private
|
@@ -48,6 +58,7 @@ module TuneMyGc
|
|
48
58
|
end
|
49
59
|
data = ActiveSupport::JSON.encode(payload)
|
50
60
|
response = client.post(uri.path, data, TuneMyGc::HEADERS)
|
61
|
+
snapshotter.unit_of_work = false
|
51
62
|
if Net::HTTPNotFound === response
|
52
63
|
TuneMyGc.log "Invalid application token. Please generate one with 'bundle exec tunemygc <a_valid_email_address>' and set the RUBY_GC_TOKEN environment variable"
|
53
64
|
return false
|
data/lib/tunemygc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bear Metal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -140,7 +140,6 @@ files:
|
|
140
140
|
- test/test_railtie.rb
|
141
141
|
- test/test_snapshotter.rb
|
142
142
|
- test/test_syncer.rb
|
143
|
-
- tunemygc-1.0.gem
|
144
143
|
- tunemygc.gemspec
|
145
144
|
homepage: https://tunemygc.com
|
146
145
|
licenses:
|
data/tunemygc-1.0.gem
DELETED
Binary file
|