corn 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -7
  2. data/lib/corn/post.rb +14 -13
  3. metadata +51 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 6b6b345c60ef516a140324b6b3dd8eb3a88eee84
4
- data.tar.gz: 0f6a5d0a10a48c6435b3b3bd3066e97d0fbe67fb
5
- SHA512:
6
- metadata.gz: 75be86a19958acc4d0052f291ce091f4ac98fdd9690c62756eb65c78b3f818eb2839a0ad7fe896830731c41ca69688874b519b071389cfd497d59f1ae0f912fd
7
- data.tar.gz: 0490385b78fca2ab7cc5aac0dcc07bf70eed6c9787f3b2515de0f16eff8bb994274c29872da3028564441b1729c1a2fc5875c942b28ae70156502b0f2d0b4a12
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3ce59d3b72f284db34d07ce896040fa38633a346
4
+ data.tar.gz: 7c0f808633dc19752eea4fc865665c6cc67f0f2e
5
+ SHA512:
6
+ metadata.gz: 42f77f91d007c9fce606299e14c0b991313ac4d92af218c95cbc1737848876b3d1845365ac1d87b59d0e67f12bc3440d5f85ed04d7439078d8d5503db6d2d9e6
7
+ data.tar.gz: 38d9d3f6b32cacf7973bf8c4186c7015ea01348df29d409b9d4a6676c06257981cf3e4cf2e10bdc3a7598151d12f98d0de249393a56d062eec2f01e23c404c00
data/lib/corn/post.rb CHANGED
@@ -19,7 +19,7 @@ module Corn
19
19
  sleep 1
20
20
  end
21
21
  rescue => e
22
- log("Corn post thread stopped by error #{e.message}\n#{e.backtrace.join("\n")}")
22
+ Corn.logger.error("Corn post thread stopped by error #{e.message}\n#{e.backtrace.join("\n")}")
23
23
  end
24
24
  end
25
25
  end
@@ -29,25 +29,26 @@ module Corn
29
29
  end
30
30
 
31
31
  def http_post(data, name)
32
- url = URI.parse(submit_url)
33
- req = Net::HTTP::Post.new(url.path)
32
+ uri = URI.parse(submit_url)
33
+ req = Net::HTTP::Post.new(uri.path)
34
34
  req.set_form_data("data" => data, 'client_id' => Corn.client_id, 'name' => name)
35
- res = Net::HTTP.start(url.host, url.port) do |http|
36
- http.use_ssl = url.scheme == 'https'
37
- http.request(req)
35
+
36
+ http = Net::HTTP.new(uri.host, uri.port)
37
+ if uri.scheme == 'https'
38
+ http.use_ssl = true
39
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE if ENV['CORN_SKIP_SSL_VERIFY']
40
+ end
41
+ res = http.request(req)
42
+ Corn.logger.info("Corn report submitted to #{submit_url}")
43
+ unless res.is_a?(Net::HTTPSuccess)
44
+ Corn.logger.error("Post failed: #{res.message}(#{res.code}), response body: \n#{res.body}")
38
45
  end
39
- log("Corn report submitted to #{submit_url}")
40
46
  rescue Exception => e
41
- log("post to #{submit_url} failed: #{e.message}")
42
- log(e.backtrace.join("\n"))
47
+ Corn.logger.error("post to #{submit_url} failed: #{e.message}\n#{e.backtrace.join("\n")}")
43
48
  end
44
49
 
45
50
  def submit_url
46
51
  Corn.submit_url
47
52
  end
48
-
49
- def log(msg)
50
- Corn.logger.info msg
51
- end
52
53
  end
53
54
  end
metadata CHANGED
@@ -1,64 +1,68 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: corn
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.2
5
5
  platform: ruby
6
- authors:
7
- - Xiao Li
8
- autorequire:
6
+ authors:
7
+ - Xiao Li
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-15 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: sampling_prof
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0.4'
20
- requirement: !ruby/object:Gem::Requirement
21
- requirements:
22
- - - '>='
23
- - !ruby/object:Gem::Version
24
- version: '0.4'
25
- prerelease: false
26
- type: :runtime
11
+
12
+ date: 2014-06-15 00:00:00 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sampling_prof
16
+ prerelease: false
17
+ requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: "0.4"
22
+ type: :runtime
23
+ version_requirements: *id001
27
24
  description: |
28
25
  Corn collects your application's profiling data by sampling_prof gem, and submits the result to server, so that you can merge multiple server's profiling data and do analysis together.
29
- email:
30
- - swing1979@gmail.com
26
+
27
+ email:
28
+ - swing1979@gmail.com
31
29
  executables: []
30
+
32
31
  extensions: []
32
+
33
33
  extra_rdoc_files: []
34
- files:
35
- - README.md
36
- - lib/corn.rb
37
- - lib/corn/post.rb
38
- - lib/corn/rack.rb
39
- - lib/corn/rack/slow_request_profiler.rb
34
+
35
+ files:
36
+ - README.md
37
+ - lib/corn.rb
38
+ - lib/corn/post.rb
39
+ - lib/corn/rack.rb
40
+ - lib/corn/rack/slow_request_profiler.rb
40
41
  homepage: https://github.com/xli/corn
41
- licenses:
42
- - MIT
42
+ licenses:
43
+ - MIT
43
44
  metadata: {}
44
- post_install_message:
45
+
46
+ post_install_message:
45
47
  rdoc_options: []
46
- require_paths:
47
- - lib
48
- required_ruby_version: !ruby/object:Gem::Requirement
49
- requirements:
50
- - - '>='
51
- - !ruby/object:Gem::Version
52
- version: '0'
53
- required_rubygems_version: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - '>='
56
- - !ruby/object:Gem::Version
57
- version: '0'
48
+
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - &id002
54
+ - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - *id002
58
60
  requirements: []
59
- rubyforge_project:
61
+
62
+ rubyforge_project:
60
63
  rubygems_version: 2.1.9
61
- signing_key:
64
+ signing_key:
62
65
  specification_version: 4
63
66
  summary: Corn submits profiling data to Corn server.
64
67
  test_files: []
68
+