appsignal 4.0.6-java → 4.0.7-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Rakefile +9 -9
  4. data/appsignal.gemspec +22 -1
  5. data/ext/agent.rb +27 -27
  6. data/lib/appsignal/check_in.rb +1 -1
  7. data/lib/appsignal/config.rb +1 -3
  8. data/lib/appsignal/integrations/resque.rb +1 -6
  9. data/lib/appsignal/utils/hash_sanitizer.rb +4 -0
  10. data/lib/appsignal/version.rb +1 -1
  11. metadata +2 -192
  12. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
  13. data/.github/ISSUE_TEMPLATE/chore.md +0 -14
  14. data/.github/workflows/ci.yml +0 -3285
  15. data/.github/workflows/create_release_from_tag.yml +0 -62
  16. data/.gitignore +0 -35
  17. data/.gitmodules +0 -3
  18. data/.rspec +0 -4
  19. data/.yardopts +0 -8
  20. data/benchmark.rake +0 -139
  21. data/gemfiles/capistrano2.gemfile +0 -6
  22. data/gemfiles/capistrano3.gemfile +0 -7
  23. data/gemfiles/dry-monitor.gemfile +0 -5
  24. data/gemfiles/grape.gemfile +0 -5
  25. data/gemfiles/hanami-2.0.gemfile +0 -7
  26. data/gemfiles/hanami-2.1.gemfile +0 -7
  27. data/gemfiles/http5.gemfile +0 -5
  28. data/gemfiles/no_dependencies.gemfile +0 -10
  29. data/gemfiles/padrino.gemfile +0 -7
  30. data/gemfiles/psych-3.gemfile +0 -5
  31. data/gemfiles/psych-4.gemfile +0 -5
  32. data/gemfiles/que-1.gemfile +0 -5
  33. data/gemfiles/que-2.gemfile +0 -5
  34. data/gemfiles/rails-6.0.gemfile +0 -10
  35. data/gemfiles/rails-6.1.gemfile +0 -11
  36. data/gemfiles/rails-7.0.gemfile +0 -11
  37. data/gemfiles/rails-7.1.gemfile +0 -11
  38. data/gemfiles/rails-7.2.gemfile +0 -11
  39. data/gemfiles/redis-4.gemfile +0 -5
  40. data/gemfiles/redis-5.gemfile +0 -6
  41. data/gemfiles/resque-2.gemfile +0 -6
  42. data/gemfiles/sequel.gemfile +0 -10
  43. data/gemfiles/sinatra.gemfile +0 -5
  44. data/gemfiles/webmachine1.gemfile +0 -7
  45. data/gemfiles/webmachine2.gemfile +0 -6
  46. data/mono.yml +0 -16
  47. data/spec/.rubocop.yml +0 -7
  48. data/spec/lib/appsignal/auth_check_spec.rb +0 -84
  49. data/spec/lib/appsignal/capistrano2_spec.rb +0 -227
  50. data/spec/lib/appsignal/capistrano3_spec.rb +0 -284
  51. data/spec/lib/appsignal/check_in/cron_spec.rb +0 -210
  52. data/spec/lib/appsignal/check_in/scheduler_spec.rb +0 -557
  53. data/spec/lib/appsignal/cli/demo_spec.rb +0 -46
  54. data/spec/lib/appsignal/cli/diagnose/paths_spec.rb +0 -16
  55. data/spec/lib/appsignal/cli/diagnose/utils_spec.rb +0 -86
  56. data/spec/lib/appsignal/cli/diagnose_spec.rb +0 -1553
  57. data/spec/lib/appsignal/cli/helpers_spec.rb +0 -179
  58. data/spec/lib/appsignal/cli/install_spec.rb +0 -848
  59. data/spec/lib/appsignal/cli_spec.rb +0 -56
  60. data/spec/lib/appsignal/config_spec.rb +0 -1380
  61. data/spec/lib/appsignal/demo_spec.rb +0 -83
  62. data/spec/lib/appsignal/environment_spec.rb +0 -190
  63. data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +0 -60
  64. data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +0 -21
  65. data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +0 -21
  66. data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +0 -52
  67. data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +0 -21
  68. data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +0 -84
  69. data/spec/lib/appsignal/event_formatter/rom/sql_formatter_spec.rb +0 -22
  70. data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +0 -30
  71. data/spec/lib/appsignal/event_formatter/view_component/render_formatter_spec.rb +0 -41
  72. data/spec/lib/appsignal/event_formatter_spec.rb +0 -193
  73. data/spec/lib/appsignal/extension/jruby_spec.rb +0 -46
  74. data/spec/lib/appsignal/extension_install_failure_spec.rb +0 -20
  75. data/spec/lib/appsignal/extension_spec.rb +0 -178
  76. data/spec/lib/appsignal/garbage_collection_spec.rb +0 -98
  77. data/spec/lib/appsignal/hooks/action_cable_spec.rb +0 -345
  78. data/spec/lib/appsignal/hooks/action_mailer_spec.rb +0 -55
  79. data/spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb +0 -23
  80. data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +0 -99
  81. data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +0 -47
  82. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +0 -47
  83. data/spec/lib/appsignal/hooks/activejob_spec.rb +0 -650
  84. data/spec/lib/appsignal/hooks/at_exit_spec.rb +0 -105
  85. data/spec/lib/appsignal/hooks/celluloid_spec.rb +0 -40
  86. data/spec/lib/appsignal/hooks/data_mapper_spec.rb +0 -40
  87. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +0 -38
  88. data/spec/lib/appsignal/hooks/dry_monitor_spec.rb +0 -83
  89. data/spec/lib/appsignal/hooks/excon_spec.rb +0 -67
  90. data/spec/lib/appsignal/hooks/gvl_spec.rb +0 -145
  91. data/spec/lib/appsignal/hooks/http_spec.rb +0 -37
  92. data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +0 -46
  93. data/spec/lib/appsignal/hooks/mri_spec.rb +0 -23
  94. data/spec/lib/appsignal/hooks/net_http_spec.rb +0 -18
  95. data/spec/lib/appsignal/hooks/passenger_spec.rb +0 -30
  96. data/spec/lib/appsignal/hooks/puma_spec.rb +0 -80
  97. data/spec/lib/appsignal/hooks/que_spec.rb +0 -19
  98. data/spec/lib/appsignal/hooks/rake_spec.rb +0 -144
  99. data/spec/lib/appsignal/hooks/redis_client_spec.rb +0 -218
  100. data/spec/lib/appsignal/hooks/redis_spec.rb +0 -124
  101. data/spec/lib/appsignal/hooks/resque_spec.rb +0 -27
  102. data/spec/lib/appsignal/hooks/sequel_spec.rb +0 -44
  103. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +0 -29
  104. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +0 -115
  105. data/spec/lib/appsignal/hooks/unicorn_spec.rb +0 -63
  106. data/spec/lib/appsignal/hooks/webmachine_spec.rb +0 -24
  107. data/spec/lib/appsignal/hooks_spec.rb +0 -124
  108. data/spec/lib/appsignal/integrations/data_mapper_spec.rb +0 -74
  109. data/spec/lib/appsignal/integrations/delayed_job_plugin_spec.rb +0 -454
  110. data/spec/lib/appsignal/integrations/http_spec.rb +0 -111
  111. data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +0 -154
  112. data/spec/lib/appsignal/integrations/net_http_spec.rb +0 -33
  113. data/spec/lib/appsignal/integrations/object_spec.rb +0 -347
  114. data/spec/lib/appsignal/integrations/puma_spec.rb +0 -150
  115. data/spec/lib/appsignal/integrations/que_spec.rb +0 -187
  116. data/spec/lib/appsignal/integrations/railtie_spec.rb +0 -457
  117. data/spec/lib/appsignal/integrations/resque_spec.rb +0 -155
  118. data/spec/lib/appsignal/integrations/shoryuken_spec.rb +0 -165
  119. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +0 -640
  120. data/spec/lib/appsignal/integrations/webmachine_spec.rb +0 -136
  121. data/spec/lib/appsignal/loaders/grape_spec.rb +0 -12
  122. data/spec/lib/appsignal/loaders/hanami_spec.rb +0 -92
  123. data/spec/lib/appsignal/loaders/padrino_spec.rb +0 -273
  124. data/spec/lib/appsignal/loaders/sinatra_spec.rb +0 -44
  125. data/spec/lib/appsignal/loaders_spec.rb +0 -144
  126. data/spec/lib/appsignal/logger_spec.rb +0 -205
  127. data/spec/lib/appsignal/marker_spec.rb +0 -51
  128. data/spec/lib/appsignal/probes/gvl_spec.rb +0 -164
  129. data/spec/lib/appsignal/probes/mri_spec.rb +0 -162
  130. data/spec/lib/appsignal/probes/sidekiq_spec.rb +0 -333
  131. data/spec/lib/appsignal/probes_spec.rb +0 -414
  132. data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +0 -370
  133. data/spec/lib/appsignal/rack/body_wrapper_spec.rb +0 -319
  134. data/spec/lib/appsignal/rack/event_handler_spec.rb +0 -441
  135. data/spec/lib/appsignal/rack/grape_middleware_spec.rb +0 -201
  136. data/spec/lib/appsignal/rack/hanami_middleware_spec.rb +0 -36
  137. data/spec/lib/appsignal/rack/instrumentation_middleware_spec.rb +0 -38
  138. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +0 -126
  139. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +0 -217
  140. data/spec/lib/appsignal/rack_spec.rb +0 -243
  141. data/spec/lib/appsignal/sample_data_spec.rb +0 -238
  142. data/spec/lib/appsignal/span_spec.rb +0 -141
  143. data/spec/lib/appsignal/system_spec.rb +0 -126
  144. data/spec/lib/appsignal/transaction_spec.rb +0 -2115
  145. data/spec/lib/appsignal/transmitter_spec.rb +0 -198
  146. data/spec/lib/appsignal/utils/data_spec.rb +0 -166
  147. data/spec/lib/appsignal/utils/hash_sanitizer_spec.rb +0 -182
  148. data/spec/lib/appsignal/utils/integration_logger_spec.rb +0 -21
  149. data/spec/lib/appsignal/utils/integration_memory_logger_spec.rb +0 -153
  150. data/spec/lib/appsignal/utils/json_spec.rb +0 -44
  151. data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +0 -192
  152. data/spec/lib/appsignal_spec.rb +0 -1919
  153. data/spec/lib/puma/appsignal_spec.rb +0 -334
  154. data/spec/spec_helper.rb +0 -179
  155. data/spec/support/fixtures/generated_config.yml +0 -24
  156. data/spec/support/fixtures/projects/broken/config/appsignal.yml +0 -1
  157. data/spec/support/fixtures/projects/valid/config/appsignal.yml +0 -57
  158. data/spec/support/fixtures/projects/valid/log/.gitkeep +0 -0
  159. data/spec/support/fixtures/projects/valid_with_rails_app/config/application.rb +0 -16
  160. data/spec/support/fixtures/projects/valid_with_rails_app/config/appsignal.yml +0 -56
  161. data/spec/support/fixtures/projects/valid_with_rails_app/config/environment.rb +0 -10
  162. data/spec/support/fixtures/projects/valid_with_rails_app/log/.gitkeep +0 -0
  163. data/spec/support/fixtures/uploaded_file.txt +0 -0
  164. data/spec/support/hanami/hanami_app.rb +0 -29
  165. data/spec/support/helpers/action_mailer_helpers.rb +0 -25
  166. data/spec/support/helpers/activejob_helpers.rb +0 -27
  167. data/spec/support/helpers/api_request_helper.rb +0 -60
  168. data/spec/support/helpers/cli_helpers.rb +0 -40
  169. data/spec/support/helpers/config_helpers.rb +0 -66
  170. data/spec/support/helpers/dependency_helper.rb +0 -155
  171. data/spec/support/helpers/directory_helper.rb +0 -27
  172. data/spec/support/helpers/env_helpers.rb +0 -41
  173. data/spec/support/helpers/environment_metdata_helper.rb +0 -16
  174. data/spec/support/helpers/example_exception.rb +0 -13
  175. data/spec/support/helpers/example_standard_error.rb +0 -13
  176. data/spec/support/helpers/loader_helper.rb +0 -21
  177. data/spec/support/helpers/log_helpers.rb +0 -36
  178. data/spec/support/helpers/rails_helper.rb +0 -28
  179. data/spec/support/helpers/std_streams_helper.rb +0 -94
  180. data/spec/support/helpers/system_helpers.rb +0 -8
  181. data/spec/support/helpers/take_at_most_helper.rb +0 -21
  182. data/spec/support/helpers/time_helpers.rb +0 -11
  183. data/spec/support/helpers/transaction_helpers.rb +0 -122
  184. data/spec/support/helpers/wait_for_helper.rb +0 -39
  185. data/spec/support/matchers/contains_log.rb +0 -26
  186. data/spec/support/matchers/have_colorized_text.rb +0 -28
  187. data/spec/support/matchers/transaction.rb +0 -200
  188. data/spec/support/mocks/appsignal_mock.rb +0 -18
  189. data/spec/support/mocks/dummy_app.rb +0 -20
  190. data/spec/support/mocks/fake_gc_profiler.rb +0 -19
  191. data/spec/support/mocks/fake_gvl_tools.rb +0 -28
  192. data/spec/support/mocks/hash_like.rb +0 -10
  193. data/spec/support/mocks/mock_probe.rb +0 -13
  194. data/spec/support/mocks/puma_mock.rb +0 -43
  195. data/spec/support/shared_examples/instrument.rb +0 -48
  196. data/spec/support/stubs/appsignal/loaders/loader_stub.rb +0 -7
  197. data/spec/support/stubs/delayed_job.rb +0 -0
  198. data/spec/support/stubs/sidekiq/api.rb +0 -4
  199. data/spec/support/testing.rb +0 -203
  200. data/support/bundler_wrapper +0 -12
  201. data/support/install_deps +0 -33
@@ -1,155 +0,0 @@
1
- require "appsignal/integrations/resque"
2
-
3
- if DependencyHelper.resque_present?
4
- describe Appsignal::Integrations::ResqueIntegration do
5
- def perform_rescue_job(klass, options = {})
6
- payload = { "class" => klass.to_s }.merge(options)
7
- job = ::Resque::Job.new(queue, payload)
8
- keep_transactions { job.perform }
9
- end
10
-
11
- let(:queue) { "default" }
12
- let(:namespace) { Appsignal::Transaction::BACKGROUND_JOB }
13
- let(:options) { {} }
14
- before do
15
- start_agent(:options => options)
16
-
17
- class ResqueTestJob
18
- def self.perform(*_args)
19
- end
20
- end
21
-
22
- class ResqueErrorTestJob
23
- def self.perform
24
- raise "resque job error"
25
- end
26
- end
27
-
28
- expect(Appsignal).to receive(:stop) # Resque calls stop after every job
29
- end
30
- around do |example|
31
- keep_transactions { example.run }
32
- end
33
- after do
34
- Object.send(:remove_const, :ResqueTestJob)
35
- Object.send(:remove_const, :ResqueErrorTestJob)
36
- end
37
-
38
- it "tracks a transaction on perform" do
39
- perform_rescue_job(ResqueTestJob)
40
-
41
- transaction = last_transaction
42
- expect(transaction).to have_id
43
- expect(transaction).to have_namespace(namespace)
44
- expect(transaction).to have_action("ResqueTestJob#perform")
45
- expect(transaction).to_not have_error
46
- expect(transaction).to_not include_metadata
47
- expect(transaction).to_not include_breadcrumbs
48
- expect(transaction).to include_tags("queue" => queue)
49
- expect(transaction).to include_event("name" => "perform.resque")
50
- end
51
-
52
- context "with error" do
53
- it "tracks the error on the transaction" do
54
- expect do
55
- perform_rescue_job(ResqueErrorTestJob)
56
- end.to raise_error(RuntimeError, "resque job error")
57
-
58
- transaction = last_transaction
59
- expect(transaction).to have_id
60
- expect(transaction).to have_namespace(namespace)
61
- expect(transaction).to have_action("ResqueErrorTestJob#perform")
62
- expect(transaction).to have_error("RuntimeError", "resque job error")
63
- expect(transaction).to_not include_metadata
64
- expect(transaction).to_not include_breadcrumbs
65
- expect(transaction).to include_tags("queue" => queue)
66
- expect(transaction).to include_event("name" => "perform.resque")
67
- end
68
- end
69
-
70
- context "with arguments" do
71
- let(:options) { { :filter_parameters => ["foo"] } }
72
-
73
- it "filters out configured arguments" do
74
- perform_rescue_job(
75
- ResqueTestJob,
76
- "args" => [
77
- "foo",
78
- {
79
- "foo" => "secret",
80
- "bar" => "Bar",
81
- "baz" => { "1" => "foo" }
82
- }
83
- ]
84
- )
85
-
86
- transaction = last_transaction
87
- expect(transaction).to have_id
88
- expect(transaction).to have_namespace(namespace)
89
- expect(transaction).to have_action("ResqueTestJob#perform")
90
- expect(transaction).to_not have_error
91
- expect(transaction).to_not include_metadata
92
- expect(transaction).to_not include_breadcrumbs
93
- expect(transaction).to include_tags("queue" => queue)
94
- expect(transaction).to include_event("name" => "perform.resque")
95
- expect(transaction).to include_params(
96
- [
97
- "foo",
98
- {
99
- "foo" => "[FILTERED]",
100
- "bar" => "Bar",
101
- "baz" => { "1" => "foo" }
102
- }
103
- ]
104
- )
105
- end
106
- end
107
-
108
- context "with active job" do
109
- before do
110
- module ActiveJobMock
111
- module QueueAdapters
112
- module ResqueAdapter
113
- module JobWrapper
114
- class << self
115
- def perform(job_data)
116
- # Basic ActiveJob stub for this test.
117
- # I haven't found a way to run Resque in a testing mode.
118
- Appsignal.set_action(job_data["job_class"])
119
- end
120
- end
121
- end
122
- end
123
- end
124
- end
125
-
126
- stub_const "ActiveJob", ActiveJobMock
127
- end
128
- after { Object.send(:remove_const, :ActiveJobMock) }
129
-
130
- it "does not set arguments but lets the ActiveJob integration handle it" do
131
- perform_rescue_job(
132
- ResqueTestJob,
133
- "class" => "ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper",
134
- "args" => [
135
- {
136
- "job_class" => "ResqueTestJobByActiveJob#perform",
137
- "arguments" => ["an argument", "second argument"]
138
- }
139
- ]
140
- )
141
-
142
- transaction = last_transaction
143
- expect(transaction).to have_id
144
- expect(transaction).to have_namespace(namespace)
145
- expect(transaction).to have_action("ResqueTestJobByActiveJob#perform")
146
- expect(transaction).to_not have_error
147
- expect(transaction).to_not include_metadata
148
- expect(transaction).to_not include_breadcrumbs
149
- expect(transaction).to include_tags("queue" => queue)
150
- expect(transaction).to include_event("name" => "perform.resque")
151
- expect(transaction).to_not include_params
152
- end
153
- end
154
- end
155
- end
@@ -1,165 +0,0 @@
1
- require "appsignal/integrations/shoryuken"
2
-
3
- describe Appsignal::Integrations::ShoryukenMiddleware do
4
- class DemoShoryukenWorker
5
- end
6
-
7
- let(:time) { "2010-01-01 10:01:00UTC" }
8
- let(:worker_instance) { DemoShoryukenWorker.new }
9
- let(:queue) { "some-funky-queue-name" }
10
- let(:sqs_msg) { double(:message_id => "msg1", :attributes => {}) }
11
- let(:body) { {} }
12
- let(:options) { {} }
13
- before { start_agent(:options => options) }
14
- around { |example| keep_transactions { example.run } }
15
-
16
- def perform_shoryuken_job(&block)
17
- block ||= lambda {}
18
- Timecop.freeze(Time.parse(time)) do
19
- described_class.new.call(
20
- worker_instance,
21
- queue,
22
- sqs_msg,
23
- body,
24
- &block
25
- )
26
- end
27
- end
28
-
29
- context "with a performance call" do
30
- let(:sent_timestamp) { Time.parse("1976-11-18 0:00:00UTC").to_i * 1000 }
31
- let(:sqs_msg) do
32
- double(:message_id => "msg1", :attributes => { "SentTimestamp" => sent_timestamp })
33
- end
34
-
35
- context "with complex argument" do
36
- let(:body) { { :foo => "Foo", :bar => "Bar" } }
37
-
38
- it "wraps the job in a transaction with the correct params" do
39
- expect { perform_shoryuken_job }.to change { created_transactions.length }.by(1)
40
-
41
- transaction = last_transaction
42
- expect(transaction).to have_id
43
- expect(transaction).to have_namespace(Appsignal::Transaction::BACKGROUND_JOB)
44
- expect(transaction).to have_action("DemoShoryukenWorker#perform")
45
- expect(transaction).to_not have_error
46
- expect(transaction).to include_event(
47
- "body" => "",
48
- "body_format" => Appsignal::EventFormatter::DEFAULT,
49
- "count" => 1,
50
- "name" => "perform_job.shoryuken",
51
- "title" => ""
52
- )
53
- expect(transaction).to include_params("foo" => "Foo", "bar" => "Bar")
54
- expect(transaction).to include_tags(
55
- "message_id" => "msg1",
56
- "queue" => queue,
57
- "SentTimestamp" => sent_timestamp
58
- )
59
- expect(transaction).to have_queue_start(sent_timestamp)
60
- expect(transaction).to be_completed
61
- end
62
-
63
- context "with parameter filtering" do
64
- let(:options) { { :filter_parameters => ["foo"] } }
65
-
66
- it "filters selected arguments" do
67
- perform_shoryuken_job
68
-
69
- expect(last_transaction).to include_params("foo" => "[FILTERED]", "bar" => "Bar")
70
- end
71
- end
72
- end
73
-
74
- context "with a string as an argument" do
75
- let(:body) { "foo bar" }
76
-
77
- it "handles string arguments" do
78
- perform_shoryuken_job
79
-
80
- expect(last_transaction).to include_params("params" => body)
81
- end
82
- end
83
-
84
- context "with primitive type as argument" do
85
- let(:body) { 1 }
86
-
87
- it "handles primitive types as arguments" do
88
- perform_shoryuken_job
89
-
90
- expect(last_transaction).to include_params("params" => body)
91
- end
92
- end
93
- end
94
-
95
- context "with exception" do
96
- it "sets the exception on the transaction" do
97
- expect do
98
- expect do
99
- perform_shoryuken_job { raise ExampleException, "error message" }
100
- end.to raise_error(ExampleException)
101
- end.to change { created_transactions.length }.by(1)
102
-
103
- transaction = last_transaction
104
- expect(transaction).to have_id
105
- expect(transaction).to have_action("DemoShoryukenWorker#perform")
106
- expect(transaction).to have_namespace(Appsignal::Transaction::BACKGROUND_JOB)
107
- expect(transaction).to have_error("ExampleException", "error message")
108
- expect(transaction).to be_completed
109
- end
110
- end
111
-
112
- context "with batched jobs" do
113
- let(:sqs_msg) do
114
- [
115
- double(
116
- :message_id => "msg2",
117
- :attributes => {
118
- "SentTimestamp" => (Time.parse("1976-11-18 01:00:00UTC").to_i * 1000).to_s
119
- }
120
- ),
121
- double(
122
- :message_id => "msg1",
123
- :attributes => { "SentTimestamp" => sent_timestamp.to_s }
124
- )
125
- ]
126
- end
127
- let(:body) do
128
- [
129
- "foo bar",
130
- { :id => "123", :foo => "Foo", :bar => "Bar" }
131
- ]
132
- end
133
- let(:sent_timestamp) { Time.parse("1976-11-18 01:00:00UTC").to_i * 1000 }
134
-
135
- it "creates a transaction for the batch" do
136
- expect do
137
- perform_shoryuken_job {} # rubocop:disable Lint/EmptyBlock
138
- end.to change { created_transactions.length }.by(1)
139
-
140
- transaction = last_transaction
141
- expect(transaction).to have_id
142
- expect(transaction).to have_action("DemoShoryukenWorker#perform")
143
- expect(transaction).to have_namespace(Appsignal::Transaction::BACKGROUND_JOB)
144
- expect(transaction).to_not have_error
145
- expect(transaction).to include_event(
146
- "body" => "",
147
- "body_format" => Appsignal::EventFormatter::DEFAULT,
148
- "count" => 1,
149
- "name" => "perform_job.shoryuken",
150
- "title" => ""
151
- )
152
- expect(transaction).to include_params(
153
- "msg2" => "foo bar",
154
- "msg1" => { "id" => "123", "foo" => "Foo", "bar" => "Bar" }
155
- )
156
- expect(transaction).to include_tags(
157
- "batch" => true,
158
- "queue" => "some-funky-queue-name",
159
- "SentTimestamp" => sent_timestamp.to_s # Earliest/oldest timestamp from messages
160
- )
161
- # Queue time based on earliest/oldest timestamp from messages
162
- expect(transaction).to have_queue_start(sent_timestamp)
163
- end
164
- end
165
- end