appsignal 3.5.4-java → 3.5.5-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.semaphore/semaphore.yml +147 -9
  3. data/CHANGELOG.md +17 -0
  4. data/README.md +2 -0
  5. data/build_matrix.yml +5 -9
  6. data/ext/Rakefile +7 -1
  7. data/ext/agent.rb +27 -27
  8. data/gemfiles/redis-4.gemfile +5 -0
  9. data/gemfiles/redis-5.gemfile +6 -0
  10. data/lib/appsignal/cli/diagnose.rb +1 -1
  11. data/lib/appsignal/config.rb +9 -4
  12. data/lib/appsignal/environment.rb +24 -13
  13. data/lib/appsignal/event_formatter.rb +1 -1
  14. data/lib/appsignal/extension/jruby.rb +4 -3
  15. data/lib/appsignal/extension.rb +1 -1
  16. data/lib/appsignal/helpers/instrumentation.rb +7 -7
  17. data/lib/appsignal/helpers/metrics.rb +3 -3
  18. data/lib/appsignal/hooks/redis.rb +1 -0
  19. data/lib/appsignal/hooks/redis_client.rb +27 -0
  20. data/lib/appsignal/hooks.rb +3 -2
  21. data/lib/appsignal/integrations/hanami.rb +1 -1
  22. data/lib/appsignal/integrations/padrino.rb +1 -1
  23. data/lib/appsignal/integrations/railtie.rb +1 -1
  24. data/lib/appsignal/integrations/redis_client.rb +20 -0
  25. data/lib/appsignal/integrations/sidekiq.rb +1 -1
  26. data/lib/appsignal/integrations/sinatra.rb +1 -1
  27. data/lib/appsignal/minutely.rb +4 -4
  28. data/lib/appsignal/probes/gvl.rb +1 -1
  29. data/lib/appsignal/probes/helpers.rb +1 -1
  30. data/lib/appsignal/probes/mri.rb +1 -1
  31. data/lib/appsignal/probes/sidekiq.rb +5 -5
  32. data/lib/appsignal/rack/generic_instrumentation.rb +1 -1
  33. data/lib/appsignal/rack/rails_instrumentation.rb +2 -2
  34. data/lib/appsignal/rack/sinatra_instrumentation.rb +2 -2
  35. data/lib/appsignal/rack/streaming_listener.rb +1 -1
  36. data/lib/appsignal/span.rb +2 -2
  37. data/lib/appsignal/transaction.rb +11 -11
  38. data/lib/appsignal/utils/deprecation_message.rb +2 -2
  39. data/lib/appsignal/version.rb +1 -1
  40. data/lib/appsignal.rb +37 -31
  41. data/spec/lib/appsignal/config_spec.rb +2 -2
  42. data/spec/lib/appsignal/hooks/activejob_spec.rb +1 -1
  43. data/spec/lib/appsignal/hooks/redis_client_spec.rb +222 -0
  44. data/spec/lib/appsignal/hooks/redis_spec.rb +98 -76
  45. data/spec/lib/appsignal/hooks_spec.rb +4 -4
  46. data/spec/lib/appsignal/integrations/railtie_spec.rb +2 -2
  47. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +3 -3
  48. data/spec/lib/appsignal/integrations/sinatra_spec.rb +2 -2
  49. data/spec/lib/appsignal/minutely_spec.rb +2 -2
  50. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +1 -1
  51. data/spec/lib/appsignal/transaction_spec.rb +4 -4
  52. data/spec/lib/appsignal_spec.rb +34 -32
  53. data/spec/spec_helper.rb +1 -1
  54. data/spec/support/helpers/config_helpers.rb +6 -2
  55. data/spec/support/helpers/dependency_helper.rb +9 -1
  56. data/spec/support/helpers/log_helpers.rb +2 -2
  57. metadata +7 -2
@@ -12,7 +12,7 @@ describe Appsignal do
12
12
  describe ".config=" do
13
13
  it "should set the config" do
14
14
  config = project_fixture_config
15
- expect(Appsignal.logger).to_not receive(:level=)
15
+ expect(Appsignal.internal_logger).to_not receive(:level=)
16
16
 
17
17
  Appsignal.config = config
18
18
  expect(Appsignal.config).to eq config
@@ -22,9 +22,9 @@ describe Appsignal do
22
22
  describe ".start" do
23
23
  context "with no config set beforehand" do
24
24
  it "should do nothing when config is not set and there is no valid config in the env" do
25
- expect(Appsignal.logger).to receive(:error)
25
+ expect(Appsignal.internal_logger).to receive(:error)
26
26
  .with("Push API key not set after loading config").once
27
- expect(Appsignal.logger).to receive(:error)
27
+ expect(Appsignal.internal_logger).to receive(:error)
28
28
  .with("Not starting, no valid config for this environment").once
29
29
  expect(Appsignal::Extension).to_not receive(:start)
30
30
  Appsignal.start
@@ -33,7 +33,7 @@ describe Appsignal do
33
33
  it "should create a config from the env" do
34
34
  ENV["APPSIGNAL_PUSH_API_KEY"] = "something"
35
35
  expect(Appsignal::Extension).to receive(:start)
36
- expect(Appsignal.logger).not_to receive(:error)
36
+ expect(Appsignal.internal_logger).not_to receive(:error)
37
37
  silence { Appsignal.start }
38
38
  expect(Appsignal.config[:push_api_key]).to eq("something")
39
39
  end
@@ -44,7 +44,7 @@ describe Appsignal do
44
44
 
45
45
  it "should initialize logging" do
46
46
  Appsignal.start
47
- expect(Appsignal.logger.level).to eq Logger::INFO
47
+ expect(Appsignal.internal_logger.level).to eq Logger::INFO
48
48
  end
49
49
 
50
50
  it "should start native" do
@@ -122,7 +122,7 @@ describe Appsignal do
122
122
 
123
123
  it "should change the log level" do
124
124
  Appsignal.start
125
- expect(Appsignal.logger.level).to eq Logger::DEBUG
125
+ expect(Appsignal.internal_logger.level).to eq Logger::DEBUG
126
126
  end
127
127
  end
128
128
  end
@@ -152,7 +152,7 @@ describe Appsignal do
152
152
 
153
153
  describe ".stop" do
154
154
  it "should call stop on the extension" do
155
- expect(Appsignal.logger).to receive(:debug).with("Stopping appsignal")
155
+ expect(Appsignal.internal_logger).to receive(:debug).with("Stopping appsignal")
156
156
  expect(Appsignal::Extension).to receive(:stop)
157
157
  Appsignal.stop
158
158
  expect(Appsignal.active?).to be_falsy
@@ -160,7 +160,7 @@ describe Appsignal do
160
160
 
161
161
  context "with context specified" do
162
162
  it "should log the context" do
163
- expect(Appsignal.logger).to receive(:debug).with("Stopping appsignal (something)")
163
+ expect(Appsignal.internal_logger).to receive(:debug).with("Stopping appsignal (something)")
164
164
  expect(Appsignal::Extension).to receive(:stop)
165
165
  Appsignal.stop("something")
166
166
  expect(Appsignal.active?).to be_falsy
@@ -222,9 +222,9 @@ describe Appsignal do
222
222
  Appsignal.config = project_fixture_config("not_active")
223
223
  Appsignal.start
224
224
  Appsignal.start_logger
225
- Appsignal.logger = test_logger(log_stream)
225
+ Appsignal.internal_logger = test_logger(log_stream)
226
226
  end
227
- after { Appsignal.logger = nil }
227
+ after { Appsignal.internal_logger = nil }
228
228
 
229
229
  it "should do nothing but still yield the block" do
230
230
  expect(Appsignal::Transaction).to_not receive(:create)
@@ -308,9 +308,9 @@ describe Appsignal do
308
308
  Appsignal.config = project_fixture_config
309
309
  Appsignal.start
310
310
  Appsignal.start_logger
311
- Appsignal.logger = test_logger(log_stream)
311
+ Appsignal.internal_logger = test_logger(log_stream)
312
312
  end
313
- after { Appsignal.logger = nil }
313
+ after { Appsignal.internal_logger = nil }
314
314
 
315
315
  describe ".monitor_transaction" do
316
316
  context "with a successful call" do
@@ -545,7 +545,8 @@ describe Appsignal do
545
545
  it "should not raise an exception when out of range" do
546
546
  expect(Appsignal::Extension).to receive(:set_gauge).with("key", 10,
547
547
  Appsignal::Extension.data_map_new).and_raise(RangeError)
548
- expect(Appsignal.logger).to receive(:warn).with("Gauge value 10 for key 'key' is too big")
548
+ expect(Appsignal.internal_logger).to receive(:warn)
549
+ .with("Gauge value 10 for key 'key' is too big")
549
550
  expect do
550
551
  Appsignal.set_gauge("key", 10)
551
552
  end.to_not raise_error
@@ -564,7 +565,7 @@ describe Appsignal do
564
565
  "this message."
565
566
  end
566
567
  before do
567
- Appsignal.logger = test_logger(log_stream)
568
+ Appsignal.internal_logger = test_logger(log_stream)
568
569
  capture_std_streams(std_stream, err_stream) { Appsignal.set_host_gauge("key", 0.1) }
569
570
  end
570
571
 
@@ -586,7 +587,7 @@ describe Appsignal do
586
587
  "this message."
587
588
  end
588
589
  before do
589
- Appsignal.logger = test_logger(log_stream)
590
+ Appsignal.internal_logger = test_logger(log_stream)
590
591
  capture_std_streams(std_stream, err_stream) { Appsignal.set_process_gauge("key", 0.1) }
591
592
  end
592
593
 
@@ -624,7 +625,7 @@ describe Appsignal do
624
625
  it "should not raise an exception when out of range" do
625
626
  expect(Appsignal::Extension).to receive(:increment_counter)
626
627
  .with("key", 10, Appsignal::Extension.data_map_new).and_raise(RangeError)
627
- expect(Appsignal.logger).to receive(:warn)
628
+ expect(Appsignal.internal_logger).to receive(:warn)
628
629
  .with("Counter value 10 for key 'key' is too big")
629
630
  expect do
630
631
  Appsignal.increment_counter("key", 10)
@@ -654,7 +655,7 @@ describe Appsignal do
654
655
  it "should not raise an exception when out of range" do
655
656
  expect(Appsignal::Extension).to receive(:add_distribution_value)
656
657
  .with("key", 10, Appsignal::Extension.data_map_new).and_raise(RangeError)
657
- expect(Appsignal.logger).to receive(:warn)
658
+ expect(Appsignal.internal_logger).to receive(:warn)
658
659
  .with("Distribution value 10 for key 'key' is too big")
659
660
  expect do
660
661
  Appsignal.add_distribution_value("key", 10)
@@ -663,8 +664,8 @@ describe Appsignal do
663
664
  end
664
665
  end
665
666
 
666
- describe ".logger" do
667
- subject { Appsignal.logger }
667
+ describe ".internal_logger" do
668
+ subject { Appsignal.internal_logger }
668
669
 
669
670
  it { is_expected.to be_a Logger }
670
671
  end
@@ -727,7 +728,7 @@ describe Appsignal do
727
728
  let(:error) { double }
728
729
 
729
730
  it "logs an error message" do
730
- expect(Appsignal.logger).to receive(:error).with(
731
+ expect(Appsignal.internal_logger).to receive(:error).with(
731
732
  "Appsignal.send_error: Cannot send error. " \
732
733
  "The given value is not an exception: #{error.inspect}"
733
734
  )
@@ -915,7 +916,7 @@ describe Appsignal do
915
916
  let(:error) { Object.new }
916
917
 
917
918
  it "logs an error" do
918
- expect(Appsignal.logger).to receive(:error).with(
919
+ expect(Appsignal.internal_logger).to receive(:error).with(
919
920
  "Appsignal.set_error: Cannot set error. " \
920
921
  "The given value is not an exception: #{error.inspect}"
921
922
  )
@@ -1128,7 +1129,7 @@ describe Appsignal do
1128
1129
  "production",
1129
1130
  :log_path => log_path
1130
1131
  )
1131
- Appsignal.logger.error("Log in memory")
1132
+ Appsignal.internal_logger.error("Log in memory")
1132
1133
  end
1133
1134
 
1134
1135
  context "when the log path is writable" do
@@ -1139,9 +1140,9 @@ describe Appsignal do
1139
1140
  capture_stdout(out_stream) do
1140
1141
  initialize_config
1141
1142
  Appsignal.start_logger
1142
- Appsignal.logger.error("Log to file")
1143
+ Appsignal.internal_logger.error("Log to file")
1143
1144
  end
1144
- expect(Appsignal.logger).to be_a(Appsignal::Utils::IntegrationLogger)
1145
+ expect(Appsignal.internal_logger).to be_a(Appsignal::Utils::IntegrationLogger)
1145
1146
  end
1146
1147
 
1147
1148
  it "logs to file" do
@@ -1163,8 +1164,8 @@ describe Appsignal do
1163
1164
  capture_stdout(out_stream) do
1164
1165
  initialize_config
1165
1166
  Appsignal.start_logger
1166
- Appsignal.logger.error("Log to not writable log file")
1167
- expect(Appsignal.logger).to be_a(Appsignal::Utils::IntegrationLogger)
1167
+ Appsignal.internal_logger.error("Log to not writable log file")
1168
+ expect(Appsignal.internal_logger).to be_a(Appsignal::Utils::IntegrationLogger)
1168
1169
  end
1169
1170
  end
1170
1171
 
@@ -1178,8 +1179,9 @@ describe Appsignal do
1178
1179
  end
1179
1180
 
1180
1181
  it "outputs a warning" do
1182
+ puts output
1181
1183
  expect(output).to include \
1182
- "[WARN] appsignal: Unable to start logger with log path '#{log_file}'.",
1184
+ "[WARN] appsignal: Unable to start internal logger with log path '#{log_file}'.",
1183
1185
  "[WARN] appsignal: Permission denied"
1184
1186
  end
1185
1187
  end
@@ -1193,9 +1195,9 @@ describe Appsignal do
1193
1195
  capture_stdout(out_stream) do
1194
1196
  initialize_config
1195
1197
  Appsignal.start_logger
1196
- Appsignal.logger.error("Log to not writable log path")
1198
+ Appsignal.internal_logger.error("Log to not writable log path")
1197
1199
  end
1198
- expect(Appsignal.logger).to be_a(Appsignal::Utils::IntegrationLogger)
1200
+ expect(Appsignal.internal_logger).to be_a(Appsignal::Utils::IntegrationLogger)
1199
1201
  end
1200
1202
  after do
1201
1203
  FileUtils.chmod 0o755, Appsignal::Config.system_tmp_dir
@@ -1222,9 +1224,9 @@ describe Appsignal do
1222
1224
  capture_stdout(out_stream) do
1223
1225
  initialize_config
1224
1226
  Appsignal.start_logger
1225
- Appsignal.logger.error("Log to stdout")
1227
+ Appsignal.internal_logger.error("Log to stdout")
1226
1228
  end
1227
- expect(Appsignal.logger).to be_a(Appsignal::Utils::IntegrationLogger)
1229
+ expect(Appsignal.internal_logger).to be_a(Appsignal::Utils::IntegrationLogger)
1228
1230
  end
1229
1231
  around { |example| recognize_as_heroku { example.run } }
1230
1232
 
@@ -1238,7 +1240,7 @@ describe Appsignal do
1238
1240
  end
1239
1241
 
1240
1242
  describe "#logger#level" do
1241
- subject { Appsignal.logger.level }
1243
+ subject { Appsignal.internal_logger.level }
1242
1244
 
1243
1245
  context "when there is no config" do
1244
1246
  before do
data/spec/spec_helper.rb CHANGED
@@ -165,7 +165,7 @@ RSpec.configure do |config|
165
165
  config.after :context do
166
166
  FileUtils.rm_f(File.join(project_fixture_path, "log/appsignal.log"))
167
167
  Appsignal.config = nil
168
- Appsignal.logger = nil
168
+ Appsignal.internal_logger = nil
169
169
  end
170
170
 
171
171
  def stop_minutely_probes
@@ -5,8 +5,12 @@ module ConfigHelpers
5
5
  )
6
6
  end
7
7
 
8
- def project_fixture_config(env = "production", initial_config = {}, logger = Appsignal.logger, # rubocop:disable Metrics/ParameterLists
9
- config_file = nil)
8
+ def project_fixture_config( # rubocop:disable Metrics/ParameterLists
9
+ env = "production",
10
+ initial_config = {},
11
+ logger = Appsignal.internal_logger,
12
+ config_file = nil
13
+ )
10
14
  Appsignal::Config.new(
11
15
  project_fixture_path,
12
16
  env,
@@ -1,4 +1,4 @@
1
- module DependencyHelper
1
+ module DependencyHelper # rubocop:disable Metrics/ModuleLength
2
2
  module_function
3
3
 
4
4
  def ruby_version
@@ -53,6 +53,14 @@ module DependencyHelper
53
53
  dependency_present? "resque"
54
54
  end
55
55
 
56
+ def redis_client_present?
57
+ dependency_present? "redis-client"
58
+ end
59
+
60
+ def hiredis_client_present?
61
+ dependency_present? "hiredis-client"
62
+ end
63
+
56
64
  def redis_present?
57
65
  dependency_present? "redis"
58
66
  end
@@ -6,9 +6,9 @@ module LogHelpers
6
6
  end
7
7
 
8
8
  def use_logger_with(log)
9
- Appsignal.logger = test_logger(log)
9
+ Appsignal.internal_logger = test_logger(log)
10
10
  yield
11
- Appsignal.logger = nil
11
+ Appsignal.internal_logger = nil
12
12
  end
13
13
 
14
14
  def test_logger(log)
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.5.4
4
+ version: 3.5.5
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-01-15 00:00:00.000000000 Z
13
+ date: 2024-02-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -188,6 +188,8 @@ files:
188
188
  - gemfiles/rails-6.1.gemfile
189
189
  - gemfiles/rails-7.0.gemfile
190
190
  - gemfiles/rails-7.1.gemfile
191
+ - gemfiles/redis-4.gemfile
192
+ - gemfiles/redis-5.gemfile
191
193
  - gemfiles/resque-2.gemfile
192
194
  - gemfiles/sequel.gemfile
193
195
  - gemfiles/sinatra.gemfile
@@ -240,6 +242,7 @@ files:
240
242
  - lib/appsignal/hooks/que.rb
241
243
  - lib/appsignal/hooks/rake.rb
242
244
  - lib/appsignal/hooks/redis.rb
245
+ - lib/appsignal/hooks/redis_client.rb
243
246
  - lib/appsignal/hooks/resque.rb
244
247
  - lib/appsignal/hooks/sequel.rb
245
248
  - lib/appsignal/hooks/shoryuken.rb
@@ -265,6 +268,7 @@ files:
265
268
  - lib/appsignal/integrations/railtie.rb
266
269
  - lib/appsignal/integrations/rake.rb
267
270
  - lib/appsignal/integrations/redis.rb
271
+ - lib/appsignal/integrations/redis_client.rb
268
272
  - lib/appsignal/integrations/resque.rb
269
273
  - lib/appsignal/integrations/sidekiq.rb
270
274
  - lib/appsignal/integrations/sinatra.rb
@@ -349,6 +353,7 @@ files:
349
353
  - spec/lib/appsignal/hooks/puma_spec.rb
350
354
  - spec/lib/appsignal/hooks/que_spec.rb
351
355
  - spec/lib/appsignal/hooks/rake_spec.rb
356
+ - spec/lib/appsignal/hooks/redis_client_spec.rb
352
357
  - spec/lib/appsignal/hooks/redis_spec.rb
353
358
  - spec/lib/appsignal/hooks/resque_spec.rb
354
359
  - spec/lib/appsignal/hooks/sequel_spec.rb