appsignal 3.0.14-java → 3.0.18-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/.rubocop.yml +0 -3
- data/.semaphore/semaphore.yml +381 -110
- data/CHANGELOG.md +56 -0
- data/appsignal.gemspec +0 -2
- data/build_matrix.yml +40 -23
- data/ext/agent.yml +25 -25
- data/ext/appsignal_extension.c +201 -0
- data/gemfiles/rails-7.0.gemfile +7 -0
- data/lib/appsignal/cli/diagnose.rb +69 -34
- data/lib/appsignal/config.rb +89 -57
- data/lib/appsignal/extension/jruby.rb +147 -0
- data/lib/appsignal/extension.rb +5 -0
- data/lib/appsignal/integrations/sidekiq.rb +5 -1
- data/lib/appsignal/span.rb +92 -0
- data/lib/appsignal/transaction.rb +12 -1
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +4 -10
- data/script/{install_lintje → lint_git} +4 -0
- data/spec/lib/appsignal/cli/diagnose_spec.rb +27 -23
- data/spec/lib/appsignal/config_spec.rb +104 -20
- data/spec/lib/appsignal/event_formatter_spec.rb +2 -2
- data/spec/lib/appsignal/hooks/activejob_spec.rb +34 -6
- data/spec/lib/appsignal/integrations/padrino_spec.rb +8 -2
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +22 -5
- data/spec/lib/appsignal/span_spec.rb +141 -0
- data/spec/lib/appsignal/transaction_spec.rb +25 -0
- data/spec/lib/appsignal/utils/data_spec.rb +0 -2
- data/spec/lib/appsignal/utils/json_spec.rb +0 -2
- data/spec/lib/appsignal_spec.rb +1 -1
- metadata +8 -4
@@ -0,0 +1,141 @@
|
|
1
|
+
require "appsignal/span"
|
2
|
+
|
3
|
+
describe Appsignal::Span do
|
4
|
+
before :context do
|
5
|
+
start_agent
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:namespace) { "web" }
|
9
|
+
let(:root) { Appsignal::Span.new(namespace) }
|
10
|
+
|
11
|
+
describe "creating a span" do
|
12
|
+
it "creates an empty span" do
|
13
|
+
expect(root.to_h["namespace"]).to eq "web"
|
14
|
+
expect(root.to_h["trace_id"].length).to eq 16
|
15
|
+
expect(root.to_h["span_id"].length).to eq 8
|
16
|
+
expect(root.to_h["parent_span_id"]).to be_empty
|
17
|
+
expect(root.to_h["name"]).to be_empty
|
18
|
+
expect(root.to_h["start_time"]).to be > 1_600_000_000
|
19
|
+
expect(root.to_h["closed"]).to be false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#child" do
|
24
|
+
let(:child) { root.child }
|
25
|
+
|
26
|
+
it "creates a child span" do
|
27
|
+
expect(child.to_h["namespace"]).to be_empty
|
28
|
+
expect(child.to_h["trace_id"].length).to eq 16
|
29
|
+
expect(child.to_h["span_id"].length).to eq 8
|
30
|
+
expect(child.to_h["parent_span_id"]).to eq root.to_h["span_id"]
|
31
|
+
expect(child.to_h["name"]).to be_empty
|
32
|
+
expect(child.to_h["start_time"]).to be > 1_600_000_000
|
33
|
+
expect(child.to_h["closed"]).to be false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#add_error" do
|
38
|
+
it "adds an error" do
|
39
|
+
begin
|
40
|
+
raise "Error"
|
41
|
+
rescue => error
|
42
|
+
root.add_error(error)
|
43
|
+
end
|
44
|
+
|
45
|
+
error = root.to_h["error"]
|
46
|
+
expect(error["name"]).to eq "RuntimeError"
|
47
|
+
expect(error["message"]).to eq "Error"
|
48
|
+
expect(error["backtrace"]).not_to be_empty
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "set_sample_data" do
|
53
|
+
it "sets sample data" do
|
54
|
+
root.set_sample_data(:params, "key" => "value")
|
55
|
+
|
56
|
+
sample_data = root.to_h["sample_data"]
|
57
|
+
expect(sample_data["params"]).to eq "{\"key\":\"value\"}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#name=" do
|
62
|
+
it "sets the name" do
|
63
|
+
root.name = "Span name"
|
64
|
+
|
65
|
+
expect(root.to_h["name"]).to eq "Span name"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "#[]=" do
|
70
|
+
let(:attributes) { root.to_h["attributes"] }
|
71
|
+
|
72
|
+
it "sets a string attribute" do
|
73
|
+
root["string"] = "attribute"
|
74
|
+
|
75
|
+
expect(attributes["string"]).to eq "attribute"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "sets an integer attribute" do
|
79
|
+
root["integer"] = 1001
|
80
|
+
|
81
|
+
expect(attributes["integer"]).to eq 1001
|
82
|
+
end
|
83
|
+
|
84
|
+
it "sets a bigint attribute" do
|
85
|
+
root["bigint"] = 1 << 64
|
86
|
+
|
87
|
+
expect(attributes["bigint"]).to eq "bigint:#{1 << 64}"
|
88
|
+
end
|
89
|
+
|
90
|
+
it "sets a boolean attribute" do
|
91
|
+
root["true"] = true
|
92
|
+
root["false"] = false
|
93
|
+
|
94
|
+
expect(attributes["true"]).to eq true
|
95
|
+
expect(attributes["false"]).to eq false
|
96
|
+
end
|
97
|
+
|
98
|
+
it "sets a float attribute" do
|
99
|
+
root["float"] = 10.01
|
100
|
+
|
101
|
+
expect(attributes["float"]).to eq 10.01
|
102
|
+
end
|
103
|
+
|
104
|
+
it "raises an error for other types" do
|
105
|
+
expect do
|
106
|
+
root["something"] = Object.new
|
107
|
+
end.to raise_error TypeError
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "#instrument" do
|
112
|
+
it "closes the span after yielding" do
|
113
|
+
root.instrument do
|
114
|
+
# Nothing happening
|
115
|
+
end
|
116
|
+
expect(root.closed?).to eq true
|
117
|
+
end
|
118
|
+
|
119
|
+
context "with an error raised in the passed block" do
|
120
|
+
it "closes the span after yielding" do
|
121
|
+
expect do
|
122
|
+
root.instrument do
|
123
|
+
raise ExampleException, "foo"
|
124
|
+
end
|
125
|
+
end.to raise_error(ExampleException, "foo")
|
126
|
+
expect(root.closed?).to eq true
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe "#close" do
|
132
|
+
it "closes a span" do
|
133
|
+
expect(root.closed?).to eq false
|
134
|
+
|
135
|
+
root.close
|
136
|
+
|
137
|
+
expect(root.to_h).to be_nil
|
138
|
+
expect(root.closed?).to eq true
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -1341,6 +1341,31 @@ describe Appsignal::Transaction do
|
|
1341
1341
|
end
|
1342
1342
|
end
|
1343
1343
|
|
1344
|
+
describe "#cleaned_error_message" do
|
1345
|
+
let(:error) { StandardError.new("Error message") }
|
1346
|
+
subject { transaction.send(:cleaned_error_message, error) }
|
1347
|
+
|
1348
|
+
it "returns the error message" do
|
1349
|
+
expect(subject).to eq "Error message"
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
context "with a PG::UniqueViolation" do
|
1353
|
+
module PG
|
1354
|
+
class UniqueViolation < StandardError; end
|
1355
|
+
end
|
1356
|
+
|
1357
|
+
let(:error) do
|
1358
|
+
PG::UniqueViolation.new(
|
1359
|
+
"ERROR: duplicate key value violates unique constraint \"index_users_on_email\" DETAIL: Key (email)=(test@test.com) already exists."
|
1360
|
+
)
|
1361
|
+
end
|
1362
|
+
|
1363
|
+
it "returns a sanizited error message" do
|
1364
|
+
expect(subject).to eq "ERROR: duplicate key value violates unique constraint \"index_users_on_email\" DETAIL: Key (email)=(?) already exists."
|
1365
|
+
end
|
1366
|
+
end
|
1367
|
+
end
|
1368
|
+
|
1344
1369
|
describe ".to_hash / .to_h" do
|
1345
1370
|
subject { transaction.to_hash }
|
1346
1371
|
|
data/spec/lib/appsignal_spec.rb
CHANGED
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: 3.0.
|
4
|
+
version: 3.0.18
|
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:
|
13
|
+
date: 2022-01-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- gemfiles/rails-5.1.gemfile
|
186
186
|
- gemfiles/rails-5.2.gemfile
|
187
187
|
- gemfiles/rails-6.0.gemfile
|
188
|
+
- gemfiles/rails-7.0.gemfile
|
188
189
|
- gemfiles/resque-1.gemfile
|
189
190
|
- gemfiles/resque-2.gemfile
|
190
191
|
- gemfiles/sequel-435.gemfile
|
@@ -271,6 +272,7 @@ files:
|
|
271
272
|
- lib/appsignal/rack/rails_instrumentation.rb
|
272
273
|
- lib/appsignal/rack/sinatra_instrumentation.rb
|
273
274
|
- lib/appsignal/rack/streaming_listener.rb
|
275
|
+
- lib/appsignal/span.rb
|
274
276
|
- lib/appsignal/system.rb
|
275
277
|
- lib/appsignal/transaction.rb
|
276
278
|
- lib/appsignal/transmitter.rb
|
@@ -287,7 +289,7 @@ files:
|
|
287
289
|
- mono.yml
|
288
290
|
- resources/appsignal.yml.erb
|
289
291
|
- resources/cacert.pem
|
290
|
-
- script/
|
292
|
+
- script/lint_git
|
291
293
|
- spec/.rubocop.yml
|
292
294
|
- spec/lib/appsignal/auth_check_spec.rb
|
293
295
|
- spec/lib/appsignal/capistrano2_spec.rb
|
@@ -359,6 +361,7 @@ files:
|
|
359
361
|
- spec/lib/appsignal/rack/rails_instrumentation_spec.rb
|
360
362
|
- spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb
|
361
363
|
- spec/lib/appsignal/rack/streaming_listener_spec.rb
|
364
|
+
- spec/lib/appsignal/span_spec.rb
|
362
365
|
- spec/lib/appsignal/system_spec.rb
|
363
366
|
- spec/lib/appsignal/transaction_spec.rb
|
364
367
|
- spec/lib/appsignal/transmitter_spec.rb
|
@@ -433,7 +436,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
433
436
|
- !ruby/object:Gem::Version
|
434
437
|
version: '0'
|
435
438
|
requirements: []
|
436
|
-
rubygems_version: 3.
|
439
|
+
rubygems_version: 3.3.4
|
437
440
|
signing_key:
|
438
441
|
specification_version: 4
|
439
442
|
summary: Logs performance and exception data from your app to appsignal.com
|
@@ -509,6 +512,7 @@ test_files:
|
|
509
512
|
- spec/lib/appsignal/rack/rails_instrumentation_spec.rb
|
510
513
|
- spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb
|
511
514
|
- spec/lib/appsignal/rack/streaming_listener_spec.rb
|
515
|
+
- spec/lib/appsignal/span_spec.rb
|
512
516
|
- spec/lib/appsignal/system_spec.rb
|
513
517
|
- spec/lib/appsignal/transaction_spec.rb
|
514
518
|
- spec/lib/appsignal/transmitter_spec.rb
|