appsignal 4.0.3-java → 4.0.4-java
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/appsignal/check_in/cron.rb +2 -34
- data/lib/appsignal/check_in/scheduler.rb +192 -0
- data/lib/appsignal/check_in.rb +18 -0
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/hooks/at_exit.rb +2 -1
- data/lib/appsignal/rack/body_wrapper.rb +15 -0
- data/lib/appsignal/transmitter.rb +30 -7
- data/lib/appsignal/utils/ndjson.rb +15 -0
- data/lib/appsignal/utils.rb +1 -0
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +1 -0
- data/spec/lib/appsignal/check_in/cron_spec.rb +210 -0
- data/spec/lib/appsignal/check_in/scheduler_spec.rb +484 -0
- data/spec/lib/appsignal/environment_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/at_exit_spec.rb +11 -0
- data/spec/lib/appsignal/rack/body_wrapper_spec.rb +29 -21
- data/spec/lib/appsignal/transmitter_spec.rb +48 -2
- data/spec/lib/appsignal_spec.rb +5 -0
- data/spec/support/helpers/take_at_most_helper.rb +21 -0
- metadata +7 -3
- data/spec/lib/appsignal/check_in_spec.rb +0 -136
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-08-
|
13
|
+
date: 2024-08-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- lib/appsignal/capistrano.rb
|
203
203
|
- lib/appsignal/check_in.rb
|
204
204
|
- lib/appsignal/check_in/cron.rb
|
205
|
+
- lib/appsignal/check_in/scheduler.rb
|
205
206
|
- lib/appsignal/cli.rb
|
206
207
|
- lib/appsignal/cli/demo.rb
|
207
208
|
- lib/appsignal/cli/diagnose.rb
|
@@ -309,6 +310,7 @@ files:
|
|
309
310
|
- lib/appsignal/utils/integration_logger.rb
|
310
311
|
- lib/appsignal/utils/integration_memory_logger.rb
|
311
312
|
- lib/appsignal/utils/json.rb
|
313
|
+
- lib/appsignal/utils/ndjson.rb
|
312
314
|
- lib/appsignal/utils/query_params_sanitizer.rb
|
313
315
|
- lib/appsignal/utils/rails_helper.rb
|
314
316
|
- lib/appsignal/utils/stdout_and_logger_message.rb
|
@@ -322,7 +324,8 @@ files:
|
|
322
324
|
- spec/lib/appsignal/auth_check_spec.rb
|
323
325
|
- spec/lib/appsignal/capistrano2_spec.rb
|
324
326
|
- spec/lib/appsignal/capistrano3_spec.rb
|
325
|
-
- spec/lib/appsignal/
|
327
|
+
- spec/lib/appsignal/check_in/cron_spec.rb
|
328
|
+
- spec/lib/appsignal/check_in/scheduler_spec.rb
|
326
329
|
- spec/lib/appsignal/cli/demo_spec.rb
|
327
330
|
- spec/lib/appsignal/cli/diagnose/paths_spec.rb
|
328
331
|
- spec/lib/appsignal/cli/diagnose/utils_spec.rb
|
@@ -450,6 +453,7 @@ files:
|
|
450
453
|
- spec/support/helpers/rails_helper.rb
|
451
454
|
- spec/support/helpers/std_streams_helper.rb
|
452
455
|
- spec/support/helpers/system_helpers.rb
|
456
|
+
- spec/support/helpers/take_at_most_helper.rb
|
453
457
|
- spec/support/helpers/time_helpers.rb
|
454
458
|
- spec/support/helpers/transaction_helpers.rb
|
455
459
|
- spec/support/helpers/wait_for_helper.rb
|
@@ -1,136 +0,0 @@
|
|
1
|
-
describe Appsignal::CheckIn::Cron do
|
2
|
-
let(:config) { project_fixture_config }
|
3
|
-
let(:cron_checkin) { described_class.new(:identifier => "cron-checkin-name") }
|
4
|
-
let(:transmitter) { Appsignal::Transmitter.new("http://cron_checkins/", config) }
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
allow(Appsignal).to receive(:active?).and_return(true)
|
8
|
-
config.logger = Logger.new(StringIO.new)
|
9
|
-
allow(Appsignal::CheckIn::Cron).to receive(:transmitter).and_return(transmitter)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "when Appsignal is not active" do
|
13
|
-
it "should not transmit any events" do
|
14
|
-
allow(Appsignal).to receive(:active?).and_return(false)
|
15
|
-
expect(transmitter).not_to receive(:transmit)
|
16
|
-
|
17
|
-
cron_checkin.start
|
18
|
-
cron_checkin.finish
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "#start" do
|
23
|
-
it "should send a cron check-in start" do
|
24
|
-
expect(transmitter).to receive(:transmit).with(hash_including(
|
25
|
-
:identifier => "cron-checkin-name",
|
26
|
-
:kind => "start",
|
27
|
-
:check_in_type => "cron"
|
28
|
-
)).and_return(Net::HTTPResponse.new(nil, "200", nil))
|
29
|
-
|
30
|
-
expect(Appsignal.internal_logger).to receive(:debug).with(
|
31
|
-
"Transmitted cron check-in `cron-checkin-name` (#{cron_checkin.digest}) start event"
|
32
|
-
)
|
33
|
-
expect(Appsignal.internal_logger).not_to receive(:error)
|
34
|
-
|
35
|
-
cron_checkin.start
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should log an error if it fails" do
|
39
|
-
expect(transmitter).to receive(:transmit).with(hash_including(
|
40
|
-
:identifier => "cron-checkin-name",
|
41
|
-
:kind => "start",
|
42
|
-
:check_in_type => "cron"
|
43
|
-
)).and_return(Net::HTTPResponse.new(nil, "499", nil))
|
44
|
-
|
45
|
-
expect(Appsignal.internal_logger).not_to receive(:debug)
|
46
|
-
expect(Appsignal.internal_logger).to receive(:error).with(
|
47
|
-
"Failed to transmit cron check-in start event: status code was 499"
|
48
|
-
)
|
49
|
-
|
50
|
-
cron_checkin.start
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "#finish" do
|
55
|
-
it "should send a cron check-in finish" do
|
56
|
-
expect(transmitter).to receive(:transmit).with(hash_including(
|
57
|
-
:identifier => "cron-checkin-name",
|
58
|
-
:kind => "finish",
|
59
|
-
:check_in_type => "cron"
|
60
|
-
)).and_return(Net::HTTPResponse.new(nil, "200", nil))
|
61
|
-
|
62
|
-
expect(Appsignal.internal_logger).to receive(:debug).with(
|
63
|
-
"Transmitted cron check-in `cron-checkin-name` (#{cron_checkin.digest}) finish event"
|
64
|
-
)
|
65
|
-
expect(Appsignal.internal_logger).not_to receive(:error)
|
66
|
-
|
67
|
-
cron_checkin.finish
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should log an error if it fails" do
|
71
|
-
expect(transmitter).to receive(:transmit).with(hash_including(
|
72
|
-
:identifier => "cron-checkin-name",
|
73
|
-
:kind => "finish",
|
74
|
-
:check_in_type => "cron"
|
75
|
-
)).and_return(Net::HTTPResponse.new(nil, "499", nil))
|
76
|
-
|
77
|
-
expect(Appsignal.internal_logger).not_to receive(:debug)
|
78
|
-
expect(Appsignal.internal_logger).to receive(:error).with(
|
79
|
-
"Failed to transmit cron check-in finish event: status code was 499"
|
80
|
-
)
|
81
|
-
|
82
|
-
cron_checkin.finish
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe ".cron" do
|
87
|
-
describe "when a block is given" do
|
88
|
-
it "should send a cron check-in start and finish and return the block output" do
|
89
|
-
expect(transmitter).to receive(:transmit).with(hash_including(
|
90
|
-
:kind => "start",
|
91
|
-
:identifier => "cron-checkin-with-block",
|
92
|
-
:check_in_type => "cron"
|
93
|
-
)).and_return(nil)
|
94
|
-
|
95
|
-
expect(transmitter).to receive(:transmit).with(hash_including(
|
96
|
-
:kind => "finish",
|
97
|
-
:identifier => "cron-checkin-with-block",
|
98
|
-
:check_in_type => "cron"
|
99
|
-
)).and_return(nil)
|
100
|
-
|
101
|
-
output = Appsignal::CheckIn.cron("cron-checkin-with-block") { "output" }
|
102
|
-
expect(output).to eq("output")
|
103
|
-
end
|
104
|
-
|
105
|
-
it "should not send a cron check-in finish event when an error is raised" do
|
106
|
-
expect(transmitter).to receive(:transmit).with(hash_including(
|
107
|
-
:kind => "start",
|
108
|
-
:identifier => "cron-checkin-with-block",
|
109
|
-
:check_in_type => "cron"
|
110
|
-
)).and_return(nil)
|
111
|
-
|
112
|
-
expect(transmitter).not_to receive(:transmit).with(hash_including(
|
113
|
-
:kind => "finish",
|
114
|
-
:identifier => "cron-checkin-with-block",
|
115
|
-
:check_in_type => "cron"
|
116
|
-
))
|
117
|
-
|
118
|
-
expect do
|
119
|
-
Appsignal::CheckIn.cron("cron-checkin-with-block") { raise "error" }
|
120
|
-
end.to raise_error(RuntimeError, "error")
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe "when no block is given" do
|
125
|
-
it "should only send a cron check-in finish event" do
|
126
|
-
expect(transmitter).to receive(:transmit).with(hash_including(
|
127
|
-
:kind => "finish",
|
128
|
-
:identifier => "cron-checkin-without-block",
|
129
|
-
:check_in_type => "cron"
|
130
|
-
)).and_return(nil)
|
131
|
-
|
132
|
-
Appsignal::CheckIn.cron("cron-checkin-without-block")
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|