appsignal 3.9.2-java → 3.9.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +3135 -0
- data/.rubocop.yml +28 -20
- data/.rubocop_todo.yml +7 -33
- data/CHANGELOG.md +38 -0
- data/Rakefile +79 -64
- data/appsignal.gemspec +1 -1
- data/build_matrix.yml +109 -179
- data/ext/base.rb +1 -1
- data/gemfiles/hanami-2.1.gemfile +7 -0
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/config.rb +1 -1
- data/lib/appsignal/demo.rb +0 -1
- data/lib/appsignal/environment.rb +5 -1
- data/lib/appsignal/extension/jruby.rb +1 -1
- data/lib/appsignal/helpers/instrumentation.rb +1 -1
- data/lib/appsignal/integrations/grape.rb +19 -47
- data/lib/appsignal/integrations/hanami.rb +8 -7
- data/lib/appsignal/integrations/padrino.rb +46 -43
- data/lib/appsignal/integrations/railtie.rb +0 -3
- data/lib/appsignal/integrations/sinatra.rb +0 -1
- data/lib/appsignal/probes/gvl.rb +24 -2
- data/lib/appsignal/probes/sidekiq.rb +1 -1
- data/lib/appsignal/probes.rb +1 -1
- data/lib/appsignal/rack/abstract_middleware.rb +62 -28
- data/lib/appsignal/rack/event_handler.rb +12 -3
- data/lib/appsignal/rack/grape_middleware.rb +40 -0
- data/lib/appsignal/rack/hanami_middleware.rb +1 -11
- data/lib/appsignal/rack/rails_instrumentation.rb +14 -55
- data/lib/appsignal/utils/integration_memory_logger.rb +78 -0
- data/lib/appsignal/utils.rb +1 -0
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +34 -33
- data/spec/.rubocop.yml +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +1 -1
- data/spec/lib/appsignal/cli/install_spec.rb +3 -3
- data/spec/lib/appsignal/config_spec.rb +7 -5
- data/spec/lib/appsignal/demo_spec.rb +38 -41
- data/spec/lib/appsignal/hooks/action_cable_spec.rb +86 -167
- data/spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb +8 -20
- data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +38 -84
- data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +16 -37
- data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +4 -4
- data/spec/lib/appsignal/hooks/activejob_spec.rb +111 -200
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +54 -91
- data/spec/lib/appsignal/hooks/dry_monitor_spec.rb +14 -32
- data/spec/lib/appsignal/hooks/excon_spec.rb +8 -12
- data/spec/lib/appsignal/hooks/net_http_spec.rb +7 -42
- data/spec/lib/appsignal/hooks/rake_spec.rb +9 -19
- data/spec/lib/appsignal/hooks/redis_client_spec.rb +18 -30
- data/spec/lib/appsignal/hooks/redis_spec.rb +10 -16
- data/spec/lib/appsignal/hooks/resque_spec.rb +42 -62
- data/spec/lib/appsignal/hooks/shoryuken_spec.rb +33 -74
- data/spec/lib/appsignal/integrations/hanami_spec.rb +79 -21
- data/spec/lib/appsignal/integrations/http_spec.rb +12 -20
- data/spec/lib/appsignal/integrations/net_http_spec.rb +33 -0
- data/spec/lib/appsignal/integrations/object_spec.rb +29 -36
- data/spec/lib/appsignal/integrations/padrino_spec.rb +47 -70
- data/spec/lib/appsignal/integrations/que_spec.rb +43 -70
- data/spec/lib/appsignal/integrations/railtie_spec.rb +26 -67
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +86 -160
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +0 -1
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +28 -39
- data/spec/lib/appsignal/probes/gvl_spec.rb +80 -3
- data/spec/lib/appsignal/probes_spec.rb +7 -4
- data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +215 -106
- data/spec/lib/appsignal/rack/event_handler_spec.rb +81 -78
- data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +2 -12
- data/spec/lib/appsignal/rack/grape_middleware_spec.rb +234 -0
- data/spec/lib/appsignal/rack/hanami_middleware_spec.rb +2 -16
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +67 -131
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +36 -44
- data/spec/lib/appsignal/rack/streaming_listener_spec.rb +68 -86
- data/spec/lib/appsignal/transaction_spec.rb +76 -90
- data/spec/lib/appsignal/utils/integration_memory_logger_spec.rb +163 -0
- data/spec/lib/appsignal_spec.rb +363 -342
- data/spec/support/helpers/dependency_helper.rb +6 -1
- data/spec/support/helpers/std_streams_helper.rb +1 -1
- data/spec/support/helpers/transaction_helpers.rb +8 -0
- data/spec/support/matchers/transaction.rb +185 -0
- data/spec/support/mocks/dummy_app.rb +20 -0
- data/spec/support/shared_examples/instrument.rb +17 -12
- data/spec/support/testing.rb +18 -9
- metadata +15 -10
- data/.semaphore/semaphore.yml +0 -2347
- data/script/lint_git +0 -22
- data/spec/lib/appsignal/integrations/grape_spec.rb +0 -239
- data/spec/support/matchers/be_completed.rb +0 -5
- /data/gemfiles/{hanami.gemfile → hanami-2.0.gemfile} +0 -0
@@ -5,22 +5,13 @@ shared_examples "activesupport instrument override" do
|
|
5
5
|
end
|
6
6
|
|
7
7
|
expect(return_value).to eq "value"
|
8
|
-
expect(transaction
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
"child_gc_duration" => kind_of(Float),
|
16
|
-
"count" => 1,
|
17
|
-
"duration" => kind_of(Float),
|
18
|
-
"gc_duration" => kind_of(Float),
|
19
|
-
"name" => "sql.active_record",
|
20
|
-
"start" => kind_of(Float),
|
21
|
-
"title" => ""
|
22
|
-
}
|
23
|
-
])
|
8
|
+
expect(transaction).to include_event(
|
9
|
+
"body" => "SQL",
|
10
|
+
"body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
|
11
|
+
"count" => 1,
|
12
|
+
"name" => "sql.active_record",
|
13
|
+
"title" => ""
|
14
|
+
)
|
24
15
|
end
|
25
16
|
|
26
17
|
it "instruments an ActiveSupport::Notifications.instrument event with no registered formatter" do
|
@@ -29,53 +20,34 @@ shared_examples "activesupport instrument override" do
|
|
29
20
|
end
|
30
21
|
|
31
22
|
expect(return_value).to eq "value"
|
32
|
-
expect(transaction
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
"child_gc_duration" => kind_of(Float),
|
40
|
-
"count" => 1,
|
41
|
-
"duration" => kind_of(Float),
|
42
|
-
"gc_duration" => kind_of(Float),
|
43
|
-
"name" => "no-registered.formatter",
|
44
|
-
"start" => kind_of(Float),
|
45
|
-
"title" => ""
|
46
|
-
}
|
47
|
-
])
|
23
|
+
expect(transaction).to include_event(
|
24
|
+
"body" => "",
|
25
|
+
"body_format" => Appsignal::EventFormatter::DEFAULT,
|
26
|
+
"count" => 1,
|
27
|
+
"name" => "no-registered.formatter",
|
28
|
+
"title" => ""
|
29
|
+
)
|
48
30
|
end
|
49
31
|
|
50
32
|
it "converts non-string names to strings" do
|
51
33
|
as.instrument(:not_a_string) {} # rubocop:disable Lint/EmptyBlock
|
52
|
-
expect(transaction
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
"child_gc_duration" => kind_of(Float),
|
60
|
-
"count" => 1,
|
61
|
-
"duration" => kind_of(Float),
|
62
|
-
"gc_duration" => kind_of(Float),
|
63
|
-
"name" => "not_a_string",
|
64
|
-
"start" => kind_of(Float),
|
65
|
-
"title" => ""
|
66
|
-
}
|
67
|
-
])
|
34
|
+
expect(transaction).to include_event(
|
35
|
+
"body" => "",
|
36
|
+
"body_format" => Appsignal::EventFormatter::DEFAULT,
|
37
|
+
"count" => 1,
|
38
|
+
"name" => "not_a_string",
|
39
|
+
"title" => ""
|
40
|
+
)
|
68
41
|
end
|
69
42
|
|
70
43
|
it "does not instrument events whose name starts with a bang" do
|
71
|
-
expect(Appsignal::Transaction.current).not_to receive(:start_event)
|
72
|
-
expect(Appsignal::Transaction.current).not_to receive(:finish_event)
|
73
|
-
|
74
44
|
return_value = as.instrument("!sql.active_record", :sql => "SQL") do
|
75
45
|
"value"
|
76
46
|
end
|
77
47
|
|
78
48
|
expect(return_value).to eq "value"
|
49
|
+
|
50
|
+
expect(transaction).to_not include_events
|
79
51
|
end
|
80
52
|
|
81
53
|
context "when an error is raised in an instrumented block" do
|
@@ -86,22 +58,13 @@ shared_examples "activesupport instrument override" do
|
|
86
58
|
end
|
87
59
|
end.to raise_error(ExampleException, "foo")
|
88
60
|
|
89
|
-
expect(transaction
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
"child_gc_duration" => kind_of(Float),
|
97
|
-
"count" => 1,
|
98
|
-
"duration" => kind_of(Float),
|
99
|
-
"gc_duration" => kind_of(Float),
|
100
|
-
"name" => "sql.active_record",
|
101
|
-
"start" => kind_of(Float),
|
102
|
-
"title" => ""
|
103
|
-
}
|
104
|
-
])
|
61
|
+
expect(transaction).to include_event(
|
62
|
+
"body" => "SQL",
|
63
|
+
"body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
|
64
|
+
"count" => 1,
|
65
|
+
"name" => "sql.active_record",
|
66
|
+
"title" => ""
|
67
|
+
)
|
105
68
|
end
|
106
69
|
end
|
107
70
|
|
@@ -113,22 +76,13 @@ shared_examples "activesupport instrument override" do
|
|
113
76
|
end
|
114
77
|
end.to throw_symbol(:foo)
|
115
78
|
|
116
|
-
expect(transaction
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
"child_gc_duration" => kind_of(Float),
|
124
|
-
"count" => 1,
|
125
|
-
"duration" => kind_of(Float),
|
126
|
-
"gc_duration" => kind_of(Float),
|
127
|
-
"name" => "sql.active_record",
|
128
|
-
"start" => kind_of(Float),
|
129
|
-
"title" => ""
|
130
|
-
}
|
131
|
-
])
|
79
|
+
expect(transaction).to include_event(
|
80
|
+
"body" => "SQL",
|
81
|
+
"body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
|
82
|
+
"count" => 1,
|
83
|
+
"name" => "sql.active_record",
|
84
|
+
"title" => ""
|
85
|
+
)
|
132
86
|
end
|
133
87
|
end
|
134
88
|
|
@@ -139,7 +93,7 @@ shared_examples "activesupport instrument override" do
|
|
139
93
|
Appsignal::Transaction.complete_current!
|
140
94
|
end
|
141
95
|
|
142
|
-
expect(transaction
|
96
|
+
expect(transaction).to_not include_events
|
143
97
|
end
|
144
98
|
end
|
145
99
|
end
|
@@ -5,54 +5,33 @@ shared_examples "activesupport start finish override" do
|
|
5
5
|
instrumenter.start("sql.active_record", :sql => "SQL")
|
6
6
|
instrumenter.finish("sql.active_record", {})
|
7
7
|
|
8
|
-
expect(transaction
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
"child_gc_duration" => kind_of(Float),
|
16
|
-
"count" => 1,
|
17
|
-
"duration" => kind_of(Float),
|
18
|
-
"gc_duration" => kind_of(Float),
|
19
|
-
"name" => "sql.active_record",
|
20
|
-
"start" => kind_of(Float),
|
21
|
-
"title" => ""
|
22
|
-
}
|
23
|
-
])
|
8
|
+
expect(transaction).to include_event(
|
9
|
+
"body" => "",
|
10
|
+
"body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
|
11
|
+
"count" => 1,
|
12
|
+
"name" => "sql.active_record",
|
13
|
+
"title" => ""
|
14
|
+
)
|
24
15
|
end
|
25
16
|
|
26
17
|
it "instruments an ActiveSupport::Notifications.start/finish event with payload on finish" do
|
27
18
|
instrumenter.start("sql.active_record", {})
|
28
19
|
instrumenter.finish("sql.active_record", :sql => "SQL")
|
29
20
|
|
30
|
-
expect(transaction
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
"child_gc_duration" => kind_of(Float),
|
38
|
-
"count" => 1,
|
39
|
-
"duration" => kind_of(Float),
|
40
|
-
"gc_duration" => kind_of(Float),
|
41
|
-
"name" => "sql.active_record",
|
42
|
-
"start" => kind_of(Float),
|
43
|
-
"title" => ""
|
44
|
-
}
|
45
|
-
])
|
21
|
+
expect(transaction).to include_event(
|
22
|
+
"body" => "SQL",
|
23
|
+
"body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
|
24
|
+
"count" => 1,
|
25
|
+
"name" => "sql.active_record",
|
26
|
+
"title" => ""
|
27
|
+
)
|
46
28
|
end
|
47
29
|
|
48
30
|
it "does not instrument events whose name starts with a bang" do
|
49
|
-
expect(Appsignal::Transaction.current).not_to receive(:start_event)
|
50
|
-
expect(Appsignal::Transaction.current).not_to receive(:finish_event)
|
51
|
-
|
52
31
|
instrumenter.start("!sql.active_record", {})
|
53
32
|
instrumenter.finish("!sql.active_record", {})
|
54
33
|
|
55
|
-
expect(transaction
|
34
|
+
expect(transaction).to_not include_events
|
56
35
|
end
|
57
36
|
|
58
37
|
context "when a transaction is completed in an instrumented block" do
|
@@ -63,7 +42,7 @@ shared_examples "activesupport start finish override" do
|
|
63
42
|
Appsignal::Transaction.complete_current!
|
64
43
|
instrumenter.finish("sql.active_record", {})
|
65
44
|
|
66
|
-
expect(transaction
|
45
|
+
expect(transaction).to_not include_events
|
67
46
|
end
|
68
47
|
end
|
69
48
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative "
|
1
|
+
require_relative "active_support_notifications/instrument_shared_examples"
|
2
2
|
|
3
3
|
describe Appsignal::Hooks::ActiveSupportNotificationsHook do
|
4
4
|
if active_support_present?
|
@@ -23,19 +23,19 @@ describe Appsignal::Hooks::ActiveSupportNotificationsHook do
|
|
23
23
|
it_behaves_like "activesupport instrument override"
|
24
24
|
|
25
25
|
if defined?(::ActiveSupport::Notifications::Fanout::Handle)
|
26
|
-
require_relative "
|
26
|
+
require_relative "active_support_notifications/start_finish_shared_examples"
|
27
27
|
|
28
28
|
it_behaves_like "activesupport start finish override"
|
29
29
|
end
|
30
30
|
|
31
31
|
if ::ActiveSupport::Notifications::Instrumenter.method_defined?(:start)
|
32
|
-
require_relative "
|
32
|
+
require_relative "active_support_notifications/start_finish_shared_examples"
|
33
33
|
|
34
34
|
it_behaves_like "activesupport start finish override"
|
35
35
|
end
|
36
36
|
|
37
37
|
if ::ActiveSupport::Notifications::Instrumenter.method_defined?(:finish_with_state)
|
38
|
-
require_relative "
|
38
|
+
require_relative "active_support_notifications/finish_with_state_shared_examples"
|
39
39
|
|
40
40
|
it_behaves_like "activesupport finish_with_state override"
|
41
41
|
end
|