errplane 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/errplane/version.rb +1 -1
- data/lib/errplane/worker.rb +38 -31
- metadata +23 -23
data/lib/errplane/version.rb
CHANGED
data/lib/errplane/worker.rb
CHANGED
@@ -16,15 +16,15 @@ module Errplane
|
|
16
16
|
if Errplane.configuration.ignore_current_environment?
|
17
17
|
log :debug, "Current environment is ignored, skipping POST."
|
18
18
|
else
|
19
|
-
log :
|
19
|
+
log :debug, "Posting data:\n#{indent_lines(data, 13)}"
|
20
20
|
url = "/api/v2/time_series/applications/#{Errplane.configuration.application_id}/environments/#{Errplane.configuration.rails_environment}?api_key=#{Errplane.configuration.api_key}"
|
21
|
-
log :
|
21
|
+
log :debug, "Posting to: #{url}"
|
22
22
|
|
23
23
|
retry_count = 5
|
24
24
|
begin
|
25
25
|
http = Net::HTTP.new("api.errplane.com", "80")
|
26
26
|
response = http.post(url, data)
|
27
|
-
log :
|
27
|
+
log :debug, "Response code: #{response.code}"
|
28
28
|
rescue => e
|
29
29
|
retry_count -= 1
|
30
30
|
unless retry_count.zero?
|
@@ -40,43 +40,50 @@ module Errplane
|
|
40
40
|
def spawn_threads()
|
41
41
|
Errplane.configuration.queue_worker_threads.times do
|
42
42
|
log :debug, "Spawning background worker thread."
|
43
|
+
|
43
44
|
Thread.new do
|
44
45
|
while true
|
45
|
-
log :debug, "Checking background queue."
|
46
46
|
sleep Errplane.configuration.queue_worker_polling_interval
|
47
|
+
check_background_queue
|
48
|
+
end
|
49
|
+
end
|
47
50
|
|
48
|
-
|
49
|
-
|
50
|
-
log :debug, "Found data in the queue."
|
51
|
-
n = Errplane.queue.pop
|
51
|
+
end
|
52
|
+
end
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
when "active_support"
|
56
|
-
case n[:name].to_s
|
57
|
-
when "process_action.action_controller"
|
58
|
-
timediff = n[:finish] - n[:start]
|
59
|
-
line << "controllers/#{n[:payload][:controller]}/#{n[:payload][:action]} #{(timediff*1000).ceil} #{n[:finish].utc.to_i}"
|
60
|
-
line << "views #{n[:payload][:view_runtime].ceil} #{n[:finish].utc.to_i }"
|
61
|
-
line << "db #{n[:payload][:db_runtime].ceil} #{n[:finish].utc.to_i }"
|
62
|
-
end
|
63
|
-
when "exception"
|
64
|
-
Errplane.transmitter.deliver n[:data], n[:url]
|
65
|
-
when "custom"
|
66
|
-
s = "#{n[:name]} #{n[:value] || 1} #{n[:timestamp]}"
|
67
|
-
s << " #{Base64.encode64(n[:message])}" if n[:message]
|
68
|
-
line << s
|
69
|
-
end
|
70
|
-
rescue => e
|
71
|
-
log :info, "Instrumentation Error! #{e.inspect}"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
54
|
+
def check_background_queue
|
55
|
+
log :debug, "Checking background queue."
|
75
56
|
|
76
|
-
|
57
|
+
data = []
|
58
|
+
|
59
|
+
while !Errplane.queue.empty? && data.size < 200
|
60
|
+
log :debug, "Found data in the queue."
|
61
|
+
n = Errplane.queue.pop
|
62
|
+
|
63
|
+
begin
|
64
|
+
case n[:source]
|
65
|
+
when "active_support"
|
66
|
+
case n[:name].to_s
|
67
|
+
when "process_action.action_controller"
|
68
|
+
timediff = n[:finish] - n[:start]
|
69
|
+
data << "controllers/#{n[:payload][:controller]}/#{n[:payload][:action]} #{(timediff*1000).ceil} #{n[:finish].utc.to_i}"
|
70
|
+
data << "views #{n[:payload][:view_runtime].ceil} #{n[:finish].utc.to_i }"
|
71
|
+
data << "db #{n[:payload][:db_runtime].ceil} #{n[:finish].utc.to_i }"
|
72
|
+
end
|
73
|
+
when "exception"
|
74
|
+
Errplane.transmitter.deliver n[:data], n[:url]
|
75
|
+
when "custom"
|
76
|
+
line = "#{n[:name]} #{n[:value] || 1} #{n[:timestamp]}"
|
77
|
+
# adding the message in this way to ensure that the space between the timestamp and the base64 encoded part goes in.
|
78
|
+
line = "#{line} #{Base64.encode64(n[:message]).strip}" if n[:message]
|
79
|
+
data << line
|
77
80
|
end
|
81
|
+
rescue => e
|
82
|
+
log :info, "Instrumentation Error! #{e.inspect}"
|
78
83
|
end
|
79
84
|
end
|
85
|
+
|
86
|
+
post_data(data.join("\n")) unless data.empty?
|
80
87
|
end
|
81
88
|
end
|
82
89
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: errplane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-11-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &70177908401580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70177908401580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70177908396000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.3.14
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70177908396000
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: actionpack
|
38
|
-
requirement: &
|
38
|
+
requirement: &70177908395120 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.3.14
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70177908395120
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70177908394640 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70177908394640
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: fakeweb
|
60
|
-
requirement: &
|
60
|
+
requirement: &70177908394020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70177908394020
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard
|
71
|
-
requirement: &
|
71
|
+
requirement: &70177908393320 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70177908393320
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: guard-rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &70177908392600 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70177908392600
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rake
|
93
|
-
requirement: &
|
93
|
+
requirement: &70177908392120 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70177908392120
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rdoc
|
104
|
-
requirement: &
|
104
|
+
requirement: &70177908391640 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70177908391640
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rspec
|
115
|
-
requirement: &
|
115
|
+
requirement: &70177908391160 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70177908391160
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: tzinfo
|
126
|
-
requirement: &
|
126
|
+
requirement: &70177908390660 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70177908390660
|
135
135
|
description: This gem provides exception reporting with Errplane for Rails 3.x applications.
|
136
136
|
email:
|
137
137
|
- todd@errplane.com
|