appsignal 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGELOG.md +3 -0
- data/lib/appsignal/agent.rb +13 -11
- data/lib/appsignal/railtie.rb +1 -2
- data/lib/appsignal/transaction.rb +4 -0
- data/lib/appsignal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTcwZjA0MDRjYTRkNTkxOGI1MDJmNjc0YmNkYzdjNGZlYjgzODgyYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzU4ZGExMGQ3NjdhYTMxNDdjNmUyMmUyYjg2MjU2YWYzZGQ4YmEzMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWIwMmI4YjU2NDEzOWExNTVlMTM2YWRlYjU4MDEwMjZiMDMyODgwYTEwNWM5
|
10
|
+
MzJiYTA3YjE1YzgyZDgyZTJlZTFjZWM0YTIyMDFmMGY3NTVhMzU5OTQ4YmJj
|
11
|
+
YTMxMzU4M2M5ZDBlY2E4OTk4ZTQyMjU1MDM5ZDMwMmZkMmRjZWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGE2NTU5ZjY1NGM5ZTFkMDgzMjJiZDJiZGJkYTA4NzhhYTU2MjVhNDNmNTIy
|
14
|
+
YmUzYzFlNWMzZmZjM2JjYzQ1YjNhMGJhNDc1MzlkM2I4NmVjZjYwMmMwZjcx
|
15
|
+
ZmYxZWVlNWQ4ZTM5OWVkNTRkNGQzYTM0NmQ4MjBkOGI5YjVhNDY=
|
data/CHANGELOG.md
CHANGED
data/lib/appsignal/agent.rb
CHANGED
@@ -11,6 +11,7 @@ module Appsignal
|
|
11
11
|
@aggregator_semaphore = Mutex.new
|
12
12
|
@retry_request = true
|
13
13
|
@thread = Thread.new do
|
14
|
+
Appsignal.logger.debug('Starting agent thread')
|
14
15
|
while true do
|
15
16
|
send_queue if aggregator.has_transactions?
|
16
17
|
Appsignal.logger.debug("Sleeping #{sleep_time}")
|
@@ -22,17 +23,18 @@ module Appsignal
|
|
22
23
|
ACTION,
|
23
24
|
Appsignal.config.fetch(:api_key)
|
24
25
|
)
|
25
|
-
Appsignal.logger.info(
|
26
|
+
Appsignal.logger.info('Started Appsignal agent')
|
26
27
|
end
|
27
28
|
|
28
29
|
def enqueue(transaction)
|
30
|
+
Appsignal.logger.debug('Enqueueing transaction')
|
29
31
|
aggregator_semaphore.synchronize do
|
30
32
|
aggregator.add(transaction)
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
36
|
def send_queue
|
35
|
-
Appsignal.logger.debug(
|
37
|
+
Appsignal.logger.debug('Sending queue')
|
36
38
|
aggregator_to_be_sent = nil
|
37
39
|
aggregator_semaphore.synchronize do
|
38
40
|
aggregator_to_be_sent = aggregator
|
@@ -51,7 +53,7 @@ module Appsignal
|
|
51
53
|
def forked!
|
52
54
|
@forked = true
|
53
55
|
@aggregator = Aggregator.new
|
54
|
-
Appsignal.logger.info(
|
56
|
+
Appsignal.logger.info('Forked the Appsignal agent')
|
55
57
|
end
|
56
58
|
|
57
59
|
def forked?
|
@@ -59,7 +61,7 @@ module Appsignal
|
|
59
61
|
end
|
60
62
|
|
61
63
|
def shutdown(send_current_queue=false)
|
62
|
-
Appsignal.logger.info(
|
64
|
+
Appsignal.logger.info('Shutting down the agent')
|
63
65
|
ActiveSupport::Notifications.unsubscribe(Appsignal.subscriber)
|
64
66
|
Thread.kill(thread) if thread
|
65
67
|
send_queue if send_current_queue && @aggregator.has_transactions?
|
@@ -72,25 +74,25 @@ module Appsignal
|
|
72
74
|
case code.to_i
|
73
75
|
when 200 # ok
|
74
76
|
when 420 # Enhance Your Calm
|
77
|
+
Appsignal.logger.info 'Increasing sleep time since the server told us to'
|
75
78
|
@sleep_time = sleep_time * 1.5
|
76
79
|
when 413 # Request Entity Too Large
|
80
|
+
Appsignal.logger.info 'Decreasing sleep time since our last push was too large'
|
77
81
|
@sleep_time = sleep_time / 1.5
|
78
82
|
when 429
|
79
|
-
Appsignal.logger.error
|
83
|
+
Appsignal.logger.error 'Too many requests sent'
|
80
84
|
shutdown
|
81
85
|
when 406
|
82
|
-
Appsignal.logger.error
|
83
|
-
"communicate with the API anymore, please upgrade."
|
86
|
+
Appsignal.logger.error 'Your appsignal gem cannot communicate with the API anymore, please upgrade.'
|
84
87
|
shutdown
|
85
88
|
when 402
|
86
|
-
Appsignal.logger.error
|
89
|
+
Appsignal.logger.error 'Payment required'
|
87
90
|
shutdown
|
88
91
|
when 401
|
89
|
-
Appsignal.logger.error
|
92
|
+
Appsignal.logger.error 'API token cannot be authorized'
|
90
93
|
shutdown
|
91
94
|
else
|
92
|
-
Appsignal.logger.error "Unknown Appsignal response code: "
|
93
|
-
"'#{code}'"
|
95
|
+
Appsignal.logger.error "Unknown Appsignal response code: '#{code}'"
|
94
96
|
end
|
95
97
|
end
|
96
98
|
end
|
data/lib/appsignal/railtie.rb
CHANGED
@@ -18,8 +18,7 @@ module Appsignal
|
|
18
18
|
if Appsignal.active?
|
19
19
|
Appsignal.logger.info("Activating appsignal-#{Appsignal::VERSION}")
|
20
20
|
at_exit { Appsignal.agent.shutdown(true) }
|
21
|
-
app.middleware.
|
22
|
-
insert_before(ActionDispatch::RemoteIp, Appsignal::Listener)
|
21
|
+
app.middleware.insert_before(ActionDispatch::RemoteIp, Appsignal::Listener)
|
23
22
|
|
24
23
|
Appsignal.subscriber = ActiveSupport::Notifications.subscribe(/^[^!]/) do |*args|
|
25
24
|
if Appsignal::Transaction.current
|
@@ -16,6 +16,7 @@ module Appsignal
|
|
16
16
|
HTTP_PRAGMA HTTP_REFERER).freeze
|
17
17
|
|
18
18
|
def self.create(key, env)
|
19
|
+
Appsignal.logger.debug("Creating transaction: #{key}")
|
19
20
|
Thread.current[:appsignal_transaction_id] = key
|
20
21
|
Appsignal.transactions[key] = Appsignal::Transaction.new(key, env)
|
21
22
|
end
|
@@ -108,10 +109,13 @@ module Appsignal
|
|
108
109
|
end
|
109
110
|
|
110
111
|
def complete!
|
112
|
+
Appsignal.logger.debug("Completing transaction: #{@request_id}")
|
111
113
|
Thread.current[:appsignal_transaction_id] = nil
|
112
114
|
current_transaction = Appsignal.transactions.delete(@request_id)
|
113
115
|
if process_action_event || exception?
|
114
116
|
Appsignal.enqueue(current_transaction)
|
117
|
+
else
|
118
|
+
Appsignal.logger.debug("No process_action_event or exception: #{@request_id}")
|
115
119
|
end
|
116
120
|
end
|
117
121
|
|
data/lib/appsignal/version.rb
CHANGED