appsignal 3.4.0-java → 3.4.2-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.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +63 -21
  3. data/.rubocop_todo.yml +68 -54
  4. data/.semaphore/semaphore.yml +11 -11
  5. data/CHANGELOG.md +51 -0
  6. data/Rakefile +15 -99
  7. data/appsignal.gemspec +3 -4
  8. data/bin/appsignal +4 -2
  9. data/build_matrix.yml +4 -4
  10. data/ext/._appsignal-agent +0 -0
  11. data/ext/Rakefile +22 -21
  12. data/ext/agent.rb +29 -27
  13. data/ext/base.rb +14 -17
  14. data/ext/extconf.rb +4 -1
  15. data/lib/appsignal/auth_check.rb +3 -3
  16. data/lib/appsignal/capistrano.rb +1 -1
  17. data/lib/appsignal/cli/demo.rb +5 -2
  18. data/lib/appsignal/cli/diagnose/paths.rb +4 -1
  19. data/lib/appsignal/cli/diagnose/utils.rb +7 -3
  20. data/lib/appsignal/cli/diagnose.rb +7 -5
  21. data/lib/appsignal/cli/helpers.rb +1 -4
  22. data/lib/appsignal/cli/install.rb +4 -10
  23. data/lib/appsignal/cli.rb +3 -2
  24. data/lib/appsignal/config.rb +106 -103
  25. data/lib/appsignal/demo.rb +2 -1
  26. data/lib/appsignal/environment.rb +2 -0
  27. data/lib/appsignal/event_formatter/action_view/render_formatter.rb +2 -1
  28. data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +13 -13
  29. data/lib/appsignal/event_formatter.rb +5 -4
  30. data/lib/appsignal/extension/jruby.rb +11 -9
  31. data/lib/appsignal/extension.rb +1 -1
  32. data/lib/appsignal/helpers/instrumentation.rb +50 -35
  33. data/lib/appsignal/hooks/action_cable.rb +6 -4
  34. data/lib/appsignal/hooks/action_mailer.rb +2 -0
  35. data/lib/appsignal/hooks/active_job.rb +11 -10
  36. data/lib/appsignal/hooks/active_support_notifications.rb +3 -4
  37. data/lib/appsignal/hooks/data_mapper.rb +1 -1
  38. data/lib/appsignal/hooks/gvl.rb +3 -0
  39. data/lib/appsignal/hooks/http.rb +1 -1
  40. data/lib/appsignal/hooks/mri.rb +2 -0
  41. data/lib/appsignal/hooks/net_http.rb +1 -1
  42. data/lib/appsignal/hooks/que.rb +1 -1
  43. data/lib/appsignal/hooks/rake.rb +1 -1
  44. data/lib/appsignal/hooks/redis.rb +1 -1
  45. data/lib/appsignal/hooks/resque.rb +1 -1
  46. data/lib/appsignal/hooks/shoryuken.rb +2 -4
  47. data/lib/appsignal/hooks/sidekiq.rb +1 -1
  48. data/lib/appsignal/hooks/unicorn.rb +2 -2
  49. data/lib/appsignal/hooks/webmachine.rb +1 -1
  50. data/lib/appsignal/hooks.rb +2 -2
  51. data/lib/appsignal/integrations/active_support_notifications.rb +1 -1
  52. data/lib/appsignal/integrations/capistrano/appsignal.cap +6 -3
  53. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +5 -4
  54. data/lib/appsignal/integrations/delayed_job_plugin.rb +3 -5
  55. data/lib/appsignal/integrations/grape.rb +1 -1
  56. data/lib/appsignal/integrations/hanami.rb +1 -1
  57. data/lib/appsignal/integrations/object.rb +2 -3
  58. data/lib/appsignal/integrations/padrino.rb +2 -4
  59. data/lib/appsignal/integrations/que.rb +6 -6
  60. data/lib/appsignal/integrations/railtie.rb +76 -0
  61. data/lib/appsignal/integrations/sidekiq.rb +9 -11
  62. data/lib/appsignal/integrations/sinatra.rb +1 -3
  63. data/lib/appsignal/integrations/webmachine.rb +4 -6
  64. data/lib/appsignal/logger.rb +31 -6
  65. data/lib/appsignal/marker.rb +4 -5
  66. data/lib/appsignal/minutely.rb +7 -7
  67. data/lib/appsignal/probes/gvl.rb +9 -4
  68. data/lib/appsignal/probes/helpers.rb +4 -6
  69. data/lib/appsignal/probes/mri.rb +7 -5
  70. data/lib/appsignal/probes/sidekiq.rb +3 -0
  71. data/lib/appsignal/probes.rb +2 -0
  72. data/lib/appsignal/rack/generic_instrumentation.rb +1 -5
  73. data/lib/appsignal/rack/sinatra_instrumentation.rb +3 -5
  74. data/lib/appsignal/rack/streaming_listener.rb +11 -13
  75. data/lib/appsignal/span.rb +5 -5
  76. data/lib/appsignal/system.rb +10 -11
  77. data/lib/appsignal/transaction.rb +49 -25
  78. data/lib/appsignal/transmitter.rb +4 -2
  79. data/lib/appsignal/utils/deprecation_message.rb +2 -0
  80. data/lib/appsignal/utils/hash_sanitizer.rb +1 -1
  81. data/lib/appsignal/utils/integration_logger.rb +5 -3
  82. data/lib/appsignal/utils/json.rb +1 -1
  83. data/lib/appsignal/utils/query_params_sanitizer.rb +1 -1
  84. data/lib/appsignal/version.rb +1 -1
  85. data/lib/appsignal.rb +5 -4
  86. data/lib/puma/plugin/appsignal.rb +16 -18
  87. data/script/lint_git +1 -1
  88. data/spec/lib/appsignal/capistrano2_spec.rb +6 -3
  89. data/spec/lib/appsignal/capistrano3_spec.rb +6 -3
  90. data/spec/lib/appsignal/cli/diagnose/utils_spec.rb +1 -3
  91. data/spec/lib/appsignal/cli/diagnose_spec.rb +33 -30
  92. data/spec/lib/appsignal/cli/install_spec.rb +5 -6
  93. data/spec/lib/appsignal/cli_spec.rb +1 -1
  94. data/spec/lib/appsignal/config_spec.rb +43 -37
  95. data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +11 -5
  96. data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +4 -4
  97. data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +1 -4
  98. data/spec/lib/appsignal/event_formatter_spec.rb +11 -9
  99. data/spec/lib/appsignal/hooks/action_cable_spec.rb +5 -2
  100. data/spec/lib/appsignal/hooks/action_mailer_spec.rb +2 -1
  101. data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +1 -1
  102. data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +1 -1
  103. data/spec/lib/appsignal/hooks/activejob_spec.rb +21 -12
  104. data/spec/lib/appsignal/hooks/data_mapper_spec.rb +1 -0
  105. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +12 -12
  106. data/spec/lib/appsignal/hooks/excon_spec.rb +2 -2
  107. data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +3 -1
  108. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +4 -2
  109. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +2 -1
  110. data/spec/lib/appsignal/hooks_spec.rb +5 -4
  111. data/spec/lib/appsignal/integrations/grape_spec.rb +8 -4
  112. data/spec/lib/appsignal/integrations/hanami_spec.rb +16 -8
  113. data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +2 -4
  114. data/spec/lib/appsignal/integrations/object_spec.rb +6 -1
  115. data/spec/lib/appsignal/integrations/padrino_spec.rb +4 -2
  116. data/spec/lib/appsignal/integrations/railtie_spec.rb +213 -6
  117. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +54 -41
  118. data/spec/lib/appsignal/logger_spec.rb +20 -4
  119. data/spec/lib/appsignal/marker_spec.rb +2 -2
  120. data/spec/lib/appsignal/minutely_spec.rb +3 -3
  121. data/spec/lib/appsignal/probes/gvl_spec.rb +60 -12
  122. data/spec/lib/appsignal/probes/mri_spec.rb +7 -4
  123. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +2 -1
  124. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +2 -1
  125. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +10 -5
  126. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +7 -5
  127. data/spec/lib/appsignal/transaction_spec.rb +20 -13
  128. data/spec/lib/appsignal/utils/data_spec.rb +10 -1
  129. data/spec/lib/appsignal/utils/hash_sanitizer_spec.rb +11 -11
  130. data/spec/lib/appsignal/utils/json_spec.rb +4 -2
  131. data/spec/lib/appsignal_spec.rb +49 -35
  132. data/spec/lib/puma/appsignal_spec.rb +9 -11
  133. data/spec/spec_helper.rb +14 -2
  134. data/spec/support/fixtures/projects/valid/config/appsignal.yml +1 -1
  135. data/spec/support/helpers/config_helpers.rb +2 -1
  136. data/spec/support/helpers/dependency_helper.rb +1 -9
  137. data/spec/support/helpers/std_streams_helper.rb +1 -3
  138. data/spec/support/helpers/wait_for_helper.rb +2 -3
  139. data/spec/support/mocks/appsignal_mock.rb +1 -1
  140. data/spec/support/mocks/fake_gvl_tools.rb +2 -10
  141. data/spec/support/testing.rb +4 -3
  142. metadata +9 -135
data/build_matrix.yml CHANGED
@@ -175,7 +175,7 @@ matrix:
175
175
  - ruby: "3.0.5"
176
176
  - ruby: "3.1.3"
177
177
  - ruby: "3.2.1"
178
- - ruby: "jruby-9.4.0.0"
178
+ - ruby: "jruby-9.4.1.0"
179
179
  gems: "minimal"
180
180
  gems:
181
181
  - gem: "no_dependencies"
@@ -208,21 +208,21 @@ matrix:
208
208
  only:
209
209
  ruby:
210
210
  - "3.0.5"
211
- - "jruby-9.4.0.0"
211
+ - "jruby-9.4.1.0"
212
212
  - gem: "rails-6.1"
213
213
  only:
214
214
  ruby:
215
215
  - "3.0.5"
216
216
  - "3.1.3"
217
217
  - "3.2.1"
218
- - "jruby-9.4.0.0"
218
+ - "jruby-9.4.1.0"
219
219
  - gem: "rails-7.0"
220
220
  only:
221
221
  ruby:
222
222
  - "3.0.5"
223
223
  - "3.1.3"
224
224
  - "3.2.1"
225
- - "jruby-9.4.0.0"
225
+ - "jruby-9.4.1.0"
226
226
  - gem: "sequel"
227
227
  - gem: "sinatra"
228
228
  - gem: "webmachine1"
Binary file
data/ext/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
- require File.expand_path("../base.rb", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("base.rb", __dir__)
2
4
 
3
5
  def local_build?
4
6
  File.exist?(ext_path("appsignal-agent")) &&
@@ -10,27 +12,26 @@ def local_build?
10
12
  end
11
13
 
12
14
  task :default do
13
- begin
14
- fail_install_on_purpose_in_test!
15
+ fail_install_on_purpose_in_test!
16
+
17
+ library_type = "dynamic"
18
+ report["language"]["implementation"] = "jruby"
19
+ report["build"]["library_type"] = library_type
20
+ next unless check_architecture
15
21
 
16
- library_type = "dynamic"
17
- report["language"]["implementation"] = "jruby"
18
- report["build"]["library_type"] = library_type
19
- next unless check_architecture
22
+ if local_build?
23
+ report["build"]["source"] = "local"
24
+ else
25
+ archive = download_archive(library_type)
26
+ next unless archive
27
+ next unless verify_archive(archive, library_type)
20
28
 
21
- if local_build?
22
- report["build"]["source"] = "local"
23
- else
24
- archive = download_archive(library_type)
25
- next unless archive
26
- next unless verify_archive(archive, library_type)
27
- unarchive(archive)
28
- end
29
- successful_installation
30
- rescue => error
31
- fail_installation_with_error(error)
32
- ensure
33
- create_dummy_makefile unless installation_succeeded?
34
- write_report
29
+ unarchive(archive)
35
30
  end
31
+ successful_installation
32
+ rescue => e
33
+ fail_installation_with_error(e)
34
+ ensure
35
+ create_dummy_makefile unless installation_succeeded?
36
+ write_report
36
37
  end
data/ext/agent.rb CHANGED
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # DO NOT EDIT
2
4
  # This is a generated file by the `rake ship` family of tasks in the
3
5
  # appsignal-agent repository.
4
6
  # Modifications to this file will be overwritten with the next agent release.
5
7
 
6
8
  APPSIGNAL_AGENT_CONFIG = {
7
- "version" => "dee4fcb",
9
+ "version" => "6f29190",
8
10
  "mirrors" => [
9
11
  "https://appsignal-agent-releases.global.ssl.fastly.net",
10
12
  "https://d135dj0rjqvssy.cloudfront.net"
@@ -12,131 +14,131 @@ APPSIGNAL_AGENT_CONFIG = {
12
14
  "triples" => {
13
15
  "x86_64-darwin" => {
14
16
  "static" => {
15
- "checksum" => "d45bfc2eb38138c317b501c3156459b8dbbb15a59910f1e2ec3d2d02e461a147",
17
+ "checksum" => "022896c1f1e86376dab439b80c5c29075b8ee57e13bb53254b1d2724567e434d",
16
18
  "filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
17
19
  },
18
20
  "dynamic" => {
19
- "checksum" => "a126901650046ae1c40affd386ab5dfcda5cb89f9bd05cf0a3087faff1d2d77d",
21
+ "checksum" => "2dd81e0481da2aa7e160b071c0961607b8ec1ad609f79b835c2a9a5bb8e914ad",
20
22
  "filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
21
23
  }
22
24
  },
23
25
  "universal-darwin" => {
24
26
  "static" => {
25
- "checksum" => "d45bfc2eb38138c317b501c3156459b8dbbb15a59910f1e2ec3d2d02e461a147",
27
+ "checksum" => "022896c1f1e86376dab439b80c5c29075b8ee57e13bb53254b1d2724567e434d",
26
28
  "filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
27
29
  },
28
30
  "dynamic" => {
29
- "checksum" => "a126901650046ae1c40affd386ab5dfcda5cb89f9bd05cf0a3087faff1d2d77d",
31
+ "checksum" => "2dd81e0481da2aa7e160b071c0961607b8ec1ad609f79b835c2a9a5bb8e914ad",
30
32
  "filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
31
33
  }
32
34
  },
33
35
  "aarch64-darwin" => {
34
36
  "static" => {
35
- "checksum" => "1cd875e74ba18c2bc81533437a9eebdf08f624e0201427c13326c2be00f22907",
37
+ "checksum" => "551dfefd447ceb0bda5ea1d94cc2809296a5ae41789e96330fe9b88c4afe29f1",
36
38
  "filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
37
39
  },
38
40
  "dynamic" => {
39
- "checksum" => "d2243146bf4e5839a4cf4430870b7b87d6553e1da4dc631c9fb396bba094cea4",
41
+ "checksum" => "ae3b1c1aae93a28843cddcd10fdc9e253f035be8decbde30ca0a74a5771139c1",
40
42
  "filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
41
43
  }
42
44
  },
43
45
  "arm64-darwin" => {
44
46
  "static" => {
45
- "checksum" => "1cd875e74ba18c2bc81533437a9eebdf08f624e0201427c13326c2be00f22907",
47
+ "checksum" => "551dfefd447ceb0bda5ea1d94cc2809296a5ae41789e96330fe9b88c4afe29f1",
46
48
  "filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
47
49
  },
48
50
  "dynamic" => {
49
- "checksum" => "d2243146bf4e5839a4cf4430870b7b87d6553e1da4dc631c9fb396bba094cea4",
51
+ "checksum" => "ae3b1c1aae93a28843cddcd10fdc9e253f035be8decbde30ca0a74a5771139c1",
50
52
  "filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
51
53
  }
52
54
  },
53
55
  "arm-darwin" => {
54
56
  "static" => {
55
- "checksum" => "1cd875e74ba18c2bc81533437a9eebdf08f624e0201427c13326c2be00f22907",
57
+ "checksum" => "551dfefd447ceb0bda5ea1d94cc2809296a5ae41789e96330fe9b88c4afe29f1",
56
58
  "filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
57
59
  },
58
60
  "dynamic" => {
59
- "checksum" => "d2243146bf4e5839a4cf4430870b7b87d6553e1da4dc631c9fb396bba094cea4",
61
+ "checksum" => "ae3b1c1aae93a28843cddcd10fdc9e253f035be8decbde30ca0a74a5771139c1",
60
62
  "filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
61
63
  }
62
64
  },
63
65
  "aarch64-linux" => {
64
66
  "static" => {
65
- "checksum" => "72fbfaa1c6ed72defea9eca59679372f53ddeab845a9b2f75d9d165e4983d69e",
67
+ "checksum" => "860dc4079f1bf2a9608523bef8d0cb8b6fadff7e83332fc09658eeb5d32eb3bc",
66
68
  "filename" => "appsignal-aarch64-linux-all-static.tar.gz"
67
69
  },
68
70
  "dynamic" => {
69
- "checksum" => "bf31b4836c84ceaa87a52aa85f296d40e32cfd784a8aa5b19ec5ca3a4aa5c8eb",
71
+ "checksum" => "dc28aa9accf67043c49e2233ad1e7e03ec89a7f2eff9e2621a3dd11f8d03c5d0",
70
72
  "filename" => "appsignal-aarch64-linux-all-dynamic.tar.gz"
71
73
  }
72
74
  },
73
75
  "i686-linux" => {
74
76
  "static" => {
75
- "checksum" => "c504a7233512c9285274a7ba0142ab91cf4637c6f5f57c58c6890137ba0f82de",
77
+ "checksum" => "fbf5d2869c9cce9ac35cffee6b139bd8d9b01018a7173417febff7c77599a7b2",
76
78
  "filename" => "appsignal-i686-linux-all-static.tar.gz"
77
79
  },
78
80
  "dynamic" => {
79
- "checksum" => "19091f50e98afed547b73bc220770bdafce737e152ab9345dabe03e284219cc1",
81
+ "checksum" => "ffb3d663d56fe6813d1431f3c0e849534a9d03c24b1b660ac3680ea53dc49b7c",
80
82
  "filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
81
83
  }
82
84
  },
83
85
  "x86-linux" => {
84
86
  "static" => {
85
- "checksum" => "c504a7233512c9285274a7ba0142ab91cf4637c6f5f57c58c6890137ba0f82de",
87
+ "checksum" => "fbf5d2869c9cce9ac35cffee6b139bd8d9b01018a7173417febff7c77599a7b2",
86
88
  "filename" => "appsignal-i686-linux-all-static.tar.gz"
87
89
  },
88
90
  "dynamic" => {
89
- "checksum" => "19091f50e98afed547b73bc220770bdafce737e152ab9345dabe03e284219cc1",
91
+ "checksum" => "ffb3d663d56fe6813d1431f3c0e849534a9d03c24b1b660ac3680ea53dc49b7c",
90
92
  "filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
91
93
  }
92
94
  },
93
95
  "x86_64-linux" => {
94
96
  "static" => {
95
- "checksum" => "f9e68dbbee7d38b255c5b9bc0cb75226764f79cd51421e4e00a9e7454b0c6ccb",
97
+ "checksum" => "8c4f2b96e2dd5c158bf46f46608901b9163998b6377a1795318ea9f366337eb1",
96
98
  "filename" => "appsignal-x86_64-linux-all-static.tar.gz"
97
99
  },
98
100
  "dynamic" => {
99
- "checksum" => "58e3192c87903a2abce6540b893c9d25a69f43e37fd2367df45c2c22c26068ba",
101
+ "checksum" => "990f476e4fd7700e8582f4cace229e33b0d8365033762a4a48a6a7cee76eba42",
100
102
  "filename" => "appsignal-x86_64-linux-all-dynamic.tar.gz"
101
103
  }
102
104
  },
103
105
  "x86_64-linux-musl" => {
104
106
  "static" => {
105
- "checksum" => "8fa1d110d2544502509cc66ba8ec6685010d8c6d8373f4f14ebe721d4be157e0",
107
+ "checksum" => "2f3c5dfa997d9399032039e03ed8bd627892fecd3331367a3b83dc29d0c28497",
106
108
  "filename" => "appsignal-x86_64-linux-musl-all-static.tar.gz"
107
109
  },
108
110
  "dynamic" => {
109
- "checksum" => "fc46dd29864165968d96bb78fde1c8970903488d80d97056e630636c736cf86f",
111
+ "checksum" => "f2468258a714ec86b6b5e653b33267185c27df6d8798d379f1536a4bb9b54059",
110
112
  "filename" => "appsignal-x86_64-linux-musl-all-dynamic.tar.gz"
111
113
  }
112
114
  },
113
115
  "aarch64-linux-musl" => {
114
116
  "static" => {
115
- "checksum" => "a43895183baf017879332885a904208773befc14b9bd628efae6d1513052b782",
117
+ "checksum" => "abbc61bfe1009de9a7e11534647c7b60b38c2b35357e77356d7dfb1067acb4d0",
116
118
  "filename" => "appsignal-aarch64-linux-musl-all-static.tar.gz"
117
119
  },
118
120
  "dynamic" => {
119
- "checksum" => "7e96b29348be655066cf162ae5c15248bba7d7177663e35e60a6c5ad243937d0",
121
+ "checksum" => "f061aee38dec433561de16d3ca9565d54b592457cda899807ce4264549745247",
120
122
  "filename" => "appsignal-aarch64-linux-musl-all-dynamic.tar.gz"
121
123
  }
122
124
  },
123
125
  "x86_64-freebsd" => {
124
126
  "static" => {
125
- "checksum" => "1b992f770bdbced09f7b5f18d7aa721710218d4a76a131adc7affe44d68684f0",
127
+ "checksum" => "d286e1338c80ec5e6f0104e53f27dfe420b3994eb7bb16ac4b32c06ec1405f33",
126
128
  "filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
127
129
  },
128
130
  "dynamic" => {
129
- "checksum" => "300b718986c10ff65f237e1d74086e9cc0f7079d7b531e3b6f9a64752f1aa6ee",
131
+ "checksum" => "c68d8ae09378736f0d55ac60344446da7e6ed1485c9aaf070eeaccc505af1599",
130
132
  "filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
131
133
  }
132
134
  },
133
135
  "amd64-freebsd" => {
134
136
  "static" => {
135
- "checksum" => "1b992f770bdbced09f7b5f18d7aa721710218d4a76a131adc7affe44d68684f0",
137
+ "checksum" => "d286e1338c80ec5e6f0104e53f27dfe420b3994eb7bb16ac4b32c06ec1405f33",
136
138
  "filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
137
139
  },
138
140
  "dynamic" => {
139
- "checksum" => "300b718986c10ff65f237e1d74086e9cc0f7079d7b531e3b6f9a64752f1aa6ee",
141
+ "checksum" => "c68d8ae09378736f0d55ac60344446da7e6ed1485c9aaf070eeaccc505af1599",
140
142
  "filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
141
143
  }
142
144
  }
data/ext/base.rb CHANGED
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "digest"
2
4
  require "fileutils"
3
5
  require "open-uri"
4
6
  require "zlib"
5
7
  require "json"
6
8
  require "rubygems/package"
7
- require File.expand_path("../../lib/appsignal/version.rb", __FILE__)
8
- require File.expand_path("../../lib/appsignal/system.rb", __FILE__)
9
+ require File.expand_path("../lib/appsignal/version.rb", __dir__)
10
+ require File.expand_path("../lib/appsignal/system.rb", __dir__)
9
11
  require_relative "./agent"
10
12
 
11
- EXT_PATH = File.expand_path("..", __FILE__).freeze
13
+ EXT_PATH = File.expand_path(__dir__).freeze
12
14
 
13
15
  AGENT_PLATFORM = Appsignal::System.agent_platform
14
16
  AGENT_ARCHITECTURE = Appsignal::System.agent_architecture
@@ -62,15 +64,11 @@ def report
62
64
  end
63
65
 
64
66
  def write_report
65
- File.open(File.join(EXT_PATH, "install.report"), "w") do |file|
66
- file.write JSON.generate(report)
67
- end
67
+ File.write(File.join(EXT_PATH, "install.report"), JSON.generate(report))
68
68
  end
69
69
 
70
70
  def create_dummy_makefile
71
- File.open(File.join(EXT_PATH, "Makefile"), "w") do |file|
72
- file.write "default:\nclean:\ninstall:"
73
- end
71
+ File.write(File.join(EXT_PATH, "Makefile"), "default:\nclean:\ninstall:")
74
72
  end
75
73
 
76
74
  def successful_installation
@@ -104,7 +102,8 @@ def check_architecture
104
102
  else
105
103
  abort_installation(
106
104
  "AppSignal currently does not support your system architecture (#{TARGET_TRIPLE})." \
107
- "Please let us know at support@appsignal.com, we aim to support everything our customers run."
105
+ "Please let us know at support@appsignal.com, we aim to support everything " \
106
+ "our customers run."
108
107
  )
109
108
  end
110
109
  end
@@ -134,8 +133,8 @@ def download_archive(type)
134
133
  proxy, _error = http_proxy
135
134
  args = [
136
135
  download_url,
137
- :ssl_ca_cert => CA_CERT_PATH,
138
- :proxy => proxy
136
+ { :ssl_ca_cert => CA_CERT_PATH,
137
+ :proxy => proxy }
139
138
  ]
140
139
  if URI.respond_to?(:open) # rubocop:disable Style/GuardClause
141
140
  return URI.open(*args)
@@ -175,9 +174,7 @@ def unarchive(archive)
175
174
  tar.each do |entry|
176
175
  next unless entry.file?
177
176
 
178
- File.open(ext_path(entry.full_name), "wb") do |f|
179
- f.write(entry.read)
180
- end
177
+ File.binwrite(ext_path(entry.full_name), entry.read)
181
178
  end
182
179
  end
183
180
  store_download_version_on_report
@@ -202,10 +199,10 @@ def http_proxy
202
199
  end
203
200
  return [proxy, error] if proxy
204
201
 
205
- proxy = try_http_proxy_value(ENV["http_proxy"])
202
+ proxy = try_http_proxy_value(ENV.fetch("http_proxy", nil))
206
203
  return [proxy, error] if proxy
207
204
 
208
- proxy = try_http_proxy_value(ENV["HTTP_PROXY"])
205
+ proxy = try_http_proxy_value(ENV.fetch("HTTP_PROXY", nil))
209
206
  return [proxy, error] if proxy
210
207
 
211
208
  [nil, error]
data/ext/extconf.rb CHANGED
@@ -1,4 +1,6 @@
1
- require File.expand_path("../base.rb", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("base.rb", __dir__)
2
4
 
3
5
  def local_build?
4
6
  File.exist?(ext_path("appsignal-agent")) &&
@@ -20,6 +22,7 @@ def install
20
22
  archive = download_archive(library_type)
21
23
  return unless archive
22
24
  return unless verify_archive(archive, library_type)
25
+
23
26
  unarchive(archive)
24
27
  end
25
28
 
@@ -18,7 +18,7 @@ module Appsignal
18
18
  class AuthCheck
19
19
  # Path used on the AppSignal Push API
20
20
  # https://push.appsignal.com/1/auth
21
- ACTION = "auth".freeze
21
+ ACTION = "auth"
22
22
 
23
23
  attr_reader :config
24
24
 
@@ -55,8 +55,8 @@ module Appsignal
55
55
  end
56
56
  [status, result]
57
57
  rescue => e
58
- result = "Something went wrong while trying to "\
59
- "authenticate with AppSignal: #{e}"
58
+ result = "Something went wrong while trying to " \
59
+ "authenticate with AppSignal: #{e}"
60
60
  [nil, result]
61
61
  end
62
62
  end
@@ -7,7 +7,7 @@ Appsignal::Environment.report_enabled("capistrano")
7
7
 
8
8
  if defined?(Capistrano::VERSION) && Gem::Version.new(Capistrano::VERSION) >= Gem::Version.new(3)
9
9
  # Capistrano 3+
10
- load File.expand_path("../integrations/capistrano/appsignal.cap", __FILE__)
10
+ load File.expand_path("integrations/capistrano/appsignal.cap", __dir__)
11
11
  else
12
12
  # Capistrano 2
13
13
  require "appsignal/integrations/capistrano/capistrano_2_tasks"
@@ -52,10 +52,13 @@ module Appsignal
52
52
  puts "Sending demonstration sample data..."
53
53
  if Appsignal::Demo.transmit
54
54
  puts "Demonstration sample data sent!"
55
- puts "It may take about a minute for the data to appear on https://appsignal.com/accounts"
55
+ puts "It may take about a minute for the data to appear on " \
56
+ "https://appsignal.com/accounts"
56
57
  else
57
58
  puts "\nError: Unable to start the AppSignal agent and send data to AppSignal.com."
58
- puts "Please use the diagnose command (https://docs.appsignal.com/ruby/command-line/diagnose.html) to debug your configuration:"
59
+ puts "Please use the diagnose command " \
60
+ "(https://docs.appsignal.com/ruby/command-line/diagnose.html) " \
61
+ "to debug your configuration:"
59
62
  puts
60
63
  puts " bundle exec appsignal diagnose --environment=production"
61
64
  puts
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Appsignal
2
4
  class CLI
3
5
  class Diagnose
@@ -55,6 +57,7 @@ module Appsignal
55
57
  :exists => File.exist?(path)
56
58
  }.tap do |info|
57
59
  next unless info[:exists]
60
+
58
61
  stat = File.stat(path)
59
62
  info[:type] = stat.directory? ? "directory" : "file"
60
63
  info[:mode] = format("%o", stat.mode)
@@ -79,7 +82,7 @@ module Appsignal
79
82
  # Returns the AppSignal gem installation path. The root directory of
80
83
  # this gem.
81
84
  def gem_path
82
- File.expand_path("../../../../../", __FILE__)
85
+ File.expand_path("../../../..", __dir__)
83
86
  end
84
87
  end
85
88
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Appsignal
2
4
  class CLI
3
5
  class Diagnose
@@ -5,15 +7,17 @@ module Appsignal
5
7
  def self.username_for_uid(uid)
6
8
  passwd_struct = Etc.getpwuid(uid)
7
9
  return unless passwd_struct
10
+
8
11
  passwd_struct.name
9
- rescue ArgumentError # rubocop:disable Lint/HandleExceptions
12
+ rescue ArgumentError # rubocop:disable Lint/SuppressedException
10
13
  end
11
14
 
12
15
  def self.group_for_gid(gid)
13
16
  passwd_struct = Etc.getgrgid(gid)
14
17
  return unless passwd_struct
18
+
15
19
  passwd_struct.name
16
- rescue ArgumentError # rubocop:disable Lint/HandleExceptions
20
+ rescue ArgumentError # rubocop:disable Lint/SuppressedException
17
21
  end
18
22
 
19
23
  def self.read_file_content(path, bytes_to_read)
@@ -30,7 +34,7 @@ module Appsignal
30
34
  offset = file_size - bytes_to_read
31
35
  end
32
36
 
33
- IO.binread(path, length, offset)
37
+ File.binread(path, length, offset)
34
38
  end
35
39
  end
36
40
  end
@@ -47,7 +47,7 @@ module Appsignal
47
47
  class Diagnose
48
48
  extend CLI::Helpers
49
49
 
50
- DIAGNOSE_ENDPOINT = "https://appsignal.com/diag".freeze
50
+ DIAGNOSE_ENDPOINT = "https://appsignal.com/diag"
51
51
 
52
52
  module Data
53
53
  def data
@@ -149,7 +149,7 @@ module Appsignal
149
149
  response = transmitter.transmit(:diagnose => data)
150
150
 
151
151
  unless response.code == "200"
152
- puts " Error: Something went wrong while submitting the report "\
152
+ puts " Error: Something went wrong while submitting the report " \
153
153
  "to AppSignal."
154
154
  puts " Response code: #{response.code}"
155
155
  puts " Response body:\n#{response.body}"
@@ -350,7 +350,7 @@ module Appsignal
350
350
  end
351
351
 
352
352
  def fetch_installation_report
353
- path = File.expand_path("../../../../ext/install.report", __FILE__)
353
+ path = File.expand_path("../../../ext/install.report", __dir__)
354
354
  raw_report = File.read(path)
355
355
  JSON.parse(raw_report)
356
356
  rescue StandardError, JSON::ParserError => e # rubocop:disable Lint/ShadowedException
@@ -444,7 +444,8 @@ module Appsignal
444
444
  puts_value "Operating System", os_label
445
445
 
446
446
  distribution_file = "/etc/os-release"
447
- save :os_distribution, File.exist?(distribution_file) ? File.read(distribution_file) : ""
447
+ save :os_distribution,
448
+ File.exist?(distribution_file) ? File.read(distribution_file) : ""
448
449
 
449
450
  language_version = "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"
450
451
  save :language_version, language_version
@@ -518,7 +519,7 @@ module Appsignal
518
519
  end
519
520
  end
520
521
 
521
- puts "\nRead more about how the diagnose config output is rendered\n"\
522
+ puts "\nRead more about how the diagnose config output is rendered\n" \
522
523
  "https://docs.appsignal.com/ruby/command-line/diagnose.html"
523
524
  end
524
525
 
@@ -533,6 +534,7 @@ module Appsignal
533
534
 
534
535
  def config_sources_label(option, sources)
535
536
  return if sources == [:default]
537
+
536
538
  if sources.length == 1
537
539
  " (Loaded from: #{sources.join(", ")})"
538
540
  elsif sources.any?
@@ -16,16 +16,13 @@ module Appsignal
16
16
  :default => 0
17
17
  }.freeze
18
18
 
19
- def ruby_2_6_or_up?
20
- Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
21
- end
22
-
23
19
  def coloring=(value)
24
20
  @coloring = value
25
21
  end
26
22
 
27
23
  def coloring?
28
24
  return true unless defined?(@coloring)
25
+
29
26
  @coloring
30
27
  end
31
28
 
@@ -67,8 +67,8 @@ module Appsignal
67
67
  install_for_sinatra(config)
68
68
  else
69
69
  print colorize "Warning:", :red
70
- puts " We could not detect which framework you are using. "\
71
- "We'd be very grateful if you email us on support@appsignal.com "\
70
+ puts " We could not detect which framework you are using. " \
71
+ "We'd be very grateful if you email us on support@appsignal.com " \
72
72
  "with information about your setup."
73
73
  puts
74
74
  done_notice
@@ -229,9 +229,7 @@ module Appsignal
229
229
  puts
230
230
  puts "Add the following environment variables to configure AppSignal:"
231
231
  puts " export APPSIGNAL_PUSH_API_KEY=#{config[:push_api_key]}"
232
- if name_overwritten
233
- puts " export APPSIGNAL_APP_NAME=#{config[:name]}"
234
- end
232
+ puts " export APPSIGNAL_APP_NAME=#{config[:name]}" if name_overwritten
235
233
  puts
236
234
  puts " See the documentation for more configuration options:"
237
235
  puts " https://docs.appsignal.com/gem-settings/configuration.html"
@@ -299,11 +297,7 @@ module Appsignal
299
297
  "../../../resources/appsignal.yml.erb"
300
298
  )
301
299
  file_contents = File.read(filename)
302
- template = if ruby_2_6_or_up?
303
- ERB.new(file_contents, :trim_mode => "-")
304
- else
305
- ERB.new(file_contents, nil, "-")
306
- end
300
+ template = ERB.new(file_contents, :trim_mode => "-")
307
301
  config = template.result(OpenStruct.new(data).instance_eval { binding })
308
302
 
309
303
  FileUtils.mkdir_p(File.join(Dir.pwd, "config"))
data/lib/appsignal/cli.rb CHANGED
@@ -34,7 +34,7 @@ module Appsignal
34
34
  Appsignal::CLI::Install.run(argv.shift, options)
35
35
  end
36
36
  else
37
- puts "Command '#{command}' does not exist, run appsignal -h to "\
37
+ puts "Command '#{command}' does not exist, run appsignal -h to " \
38
38
  "see the help"
39
39
  exit(1)
40
40
  end
@@ -79,7 +79,8 @@ module Appsignal
79
79
  o.on "--environment=<app_env>", "The environment to diagnose" do |arg|
80
80
  options[:environment] = arg
81
81
  end
82
- o.on "--[no-]send-report", "Confirm sending the report to AppSignal automatically" do |arg|
82
+ o.on "--[no-]send-report",
83
+ "Confirm sending the report to AppSignal automatically" do |arg|
83
84
  options[:send_report] = arg
84
85
  end
85
86
  o.on "--[no-]color", "Colorize the output of the diagnose command" do |arg|