appsignal 2.8.4 → 2.9.0

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rubocop_todo.yml +7 -16
  4. data/.travis.yml +4 -1
  5. data/CHANGELOG.md +16 -0
  6. data/README.md +23 -0
  7. data/Rakefile +10 -7
  8. data/appsignal.gemspec +3 -0
  9. data/build_matrix.yml +5 -1
  10. data/ext/Rakefile +23 -16
  11. data/ext/agent.yml +37 -37
  12. data/ext/base.rb +86 -24
  13. data/ext/extconf.rb +33 -26
  14. data/gemfiles/rails-6.0.gemfile +5 -0
  15. data/lib/appsignal.rb +14 -489
  16. data/lib/appsignal/cli/diagnose.rb +84 -4
  17. data/lib/appsignal/cli/diagnose/paths.rb +0 -5
  18. data/lib/appsignal/cli/diagnose/utils.rb +17 -0
  19. data/lib/appsignal/cli/helpers.rb +6 -0
  20. data/lib/appsignal/cli/install.rb +13 -7
  21. data/lib/appsignal/config.rb +1 -2
  22. data/lib/appsignal/event_formatter.rb +4 -5
  23. data/lib/appsignal/event_formatter/moped/query_formatter.rb +60 -59
  24. data/lib/appsignal/extension.rb +2 -2
  25. data/lib/appsignal/helpers/instrumentation.rb +485 -0
  26. data/lib/appsignal/helpers/metrics.rb +55 -0
  27. data/lib/appsignal/hooks.rb +9 -8
  28. data/lib/appsignal/hooks/puma.rb +65 -9
  29. data/lib/appsignal/hooks/sidekiq.rb +90 -0
  30. data/lib/appsignal/integrations/mongo_ruby_driver.rb +7 -0
  31. data/lib/appsignal/integrations/railtie.rb +2 -1
  32. data/lib/appsignal/marker.rb +2 -3
  33. data/lib/appsignal/minutely.rb +164 -14
  34. data/lib/appsignal/rack/sinatra_instrumentation.rb +1 -1
  35. data/lib/appsignal/system.rb +16 -18
  36. data/lib/appsignal/utils/rails_helper.rb +16 -0
  37. data/lib/appsignal/version.rb +1 -1
  38. data/spec/lib/appsignal/cli/diagnose_spec.rb +129 -22
  39. data/spec/lib/appsignal/cli/install_spec.rb +6 -1
  40. data/spec/lib/appsignal/config_spec.rb +3 -3
  41. data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +6 -0
  42. data/spec/lib/appsignal/event_formatter_spec.rb +168 -69
  43. data/spec/lib/appsignal/hooks/puma_spec.rb +129 -0
  44. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +147 -0
  45. data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +24 -1
  46. data/spec/lib/appsignal/minutely_spec.rb +251 -21
  47. data/spec/lib/appsignal/system_spec.rb +0 -35
  48. data/spec/lib/appsignal/utils/hash_sanitizer_spec.rb +39 -31
  49. data/spec/lib/appsignal/utils/json_spec.rb +7 -3
  50. data/spec/lib/appsignal_spec.rb +27 -2
  51. data/spec/spec_helper.rb +13 -0
  52. data/spec/support/helpers/log_helpers.rb +6 -0
  53. data/spec/support/project_fixture/config/appsignal.yml +1 -0
  54. data/spec/support/stubs/sidekiq/api.rb +4 -0
  55. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3fc30ece50f7e8fae3c7f6307ce2f3b4da2cc141b316cc91df6554ad9bdd3cd
4
- data.tar.gz: dd0be2f1ad3aa160925d6ab1fba7ccd90ac03a06b8907f29d4c381d368fad0b3
3
+ metadata.gz: 90a960722fe12c43e82f38a5cb6e73ab3e5e8dd9d504531060278a2565fb215c
4
+ data.tar.gz: 4e7ecc293fbf466b0b3f8fb9f9759a0c07016954ad08ff072129b90d53d640ac
5
5
  SHA512:
6
- metadata.gz: e1fb4406cbaa4c2b8337f762360ef97e76cbc89153529f81656b068d5c70b6ba99c8a835c18b546fbcbc396eba95c39eaba46f95adf544cf9b4158b9e4f79e41
7
- data.tar.gz: 4750be78260f6c04d9db137e6013acc2b8a481f3795b9471619cc9b2078dc83c840cfbd50f260d86fe9f774becefd6963399777abea5b111dfd7f3e1f4fe1b79
6
+ metadata.gz: b3e89afc04e6d0fcdc8615fc6d09296abdabc1da55f0fb4e31f661479a377fc473a2d9ab5656f655f8af96bc2afbb078b2d7d1695afa5f5fcbcfff23b453fbcd
7
+ data.tar.gz: 36b0189f2642866abbf8d96bab367d62dde538799d18602cfdd3a0a268911e08af8afd8c71401782bb9887841d2f1204c68acb6376001b0b0e8b71be6c2c7b55
data/.gitignore CHANGED
@@ -26,10 +26,10 @@ bundle_and_spec_all_rvm
26
26
  ext/libappsignal.*
27
27
  ext/appsignal-agent
28
28
  ext/appsignal.h
29
- ext/appsignal.architecture
30
29
  ext/appsignal.version
31
30
  ext/Makefile
32
31
  ext/*.bundle
33
32
  ext/*.o
34
33
  ext/*.so
34
+ ext/*.report
35
35
  pkg/
@@ -1,12 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-06-01 17:12:10 +0200 using RuboCop version 0.50.0.
3
+ # on 2019-03-12 21:08:54 +0100 using RuboCop version 0.50.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 44
9
+ # Offense count: 50
10
10
  Metrics/AbcSize:
11
11
  Max: 56
12
12
 
@@ -28,13 +28,13 @@ Metrics/ClassLength:
28
28
  Metrics/CyclomaticComplexity:
29
29
  Max: 11
30
30
 
31
- # Offense count: 523
31
+ # Offense count: 532
32
32
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
33
33
  # URISchemes: http, https
34
34
  Metrics/LineLength:
35
35
  Max: 152
36
36
 
37
- # Offense count: 94
37
+ # Offense count: 109
38
38
  # Configuration parameters: CountComments.
39
39
  Metrics/MethodLength:
40
40
  Max: 60
@@ -52,7 +52,7 @@ Metrics/PerceivedComplexity:
52
52
  # Offense count: 9
53
53
  Naming/AccessorMethodName:
54
54
  Exclude:
55
- - 'lib/appsignal.rb'
55
+ - 'lib/appsignal/helpers/instrumentation.rb'
56
56
  - 'lib/appsignal/transaction.rb'
57
57
 
58
58
  # Offense count: 4
@@ -71,6 +71,7 @@ Security/YAMLLoad:
71
71
  Style/Alias:
72
72
  Exclude:
73
73
  - 'lib/appsignal.rb'
74
+ - 'lib/appsignal/helpers/instrumentation.rb'
74
75
  - 'lib/appsignal/hooks/active_support_notifications.rb'
75
76
  - 'lib/appsignal/hooks/celluloid.rb'
76
77
  - 'lib/appsignal/hooks/net_http.rb'
@@ -88,7 +89,7 @@ Style/ClassAndModuleChildren:
88
89
  Exclude:
89
90
  - 'lib/appsignal/integrations/padrino.rb'
90
91
 
91
- # Offense count: 4
92
+ # Offense count: 6
92
93
  Style/ClassVars:
93
94
  Exclude:
94
95
  - 'lib/appsignal/event_formatter.rb'
@@ -98,13 +99,3 @@ Style/ClassVars:
98
99
  Style/DoubleNegation:
99
100
  Exclude:
100
101
  - 'lib/appsignal.rb'
101
-
102
- # Offense count: 5
103
- # Configuration parameters: MinBodyLength.
104
- Style/GuardClause:
105
- Exclude:
106
- - 'lib/appsignal.rb'
107
- - 'lib/appsignal/event_formatter.rb'
108
- - 'lib/appsignal/event_formatter/moped/query_formatter.rb'
109
- - 'lib/appsignal/hooks.rb'
110
- - 'lib/appsignal/marker.rb'
@@ -24,7 +24,7 @@ before_script:
24
24
  - "./support/bundler_wrapper exec rake extension:install"
25
25
  script: "./support/bundler_wrapper exec rake test"
26
26
  after_failure:
27
- - find ./ext -name install.log -exec cat {} \;
27
+ - find ./ext -name install.report -exec cat {} \;
28
28
  - find ./ext -name mkmf.log -exec cat {} \;
29
29
  matrix:
30
30
  fast_finish: true
@@ -122,6 +122,9 @@ matrix:
122
122
  - rvm: 2.6.0
123
123
  gemfile: gemfiles/rails-5.2.gemfile
124
124
  env: _RUBYGEMS_VERSION=latest _BUNDLER_VERSION=latest
125
+ - rvm: 2.6.0
126
+ gemfile: gemfiles/rails-6.0.gemfile
127
+ env: _RUBYGEMS_VERSION=latest _BUNDLER_VERSION=latest
125
128
  - rvm: 2.6.0
126
129
  gemfile: gemfiles/resque.gemfile
127
130
  env: _RUBYGEMS_VERSION=latest _BUNDLER_VERSION=1.17.3
@@ -1,3 +1,19 @@
1
+ # 2.9.0
2
+ - Fix installations using git source. PR #455
3
+ - Track installation results in installation report. PR #450
4
+ - Fix Rails 6 deprecation warnings. PR #460, PR #478, PR #483
5
+ - Improve error handling in minutely probes mechanism. PR #467
6
+ - Only allow one minutely probe thread to run at a time. PR #469
7
+ - Change minutely probes register method to use a key for every probe. PR #473
8
+ - Send Sidekiq metrics by default. PR #471
9
+ - Send MongoDB metrics by default. PR #472
10
+ - Fix Ruby 2.6 deprecation warnings. PR #479
11
+ - Support blocks for `Appsignal.send_error` to add more metadata to the
12
+ AppSignal transaction. PR #481
13
+ - Move instrumentation & metrics helpers to modules. PR #487
14
+ - Add Puma minutely probe. PR #488
15
+ - Log invalid EventFormatter registrations as errors. PR #491
16
+
1
17
  # 2.8.4
2
18
  - Log memory usage of agent if high.
3
19
  Commit 46cf3770e13eff9f5fccbf8a4525a8dbfd8eeaad
data/README.md CHANGED
@@ -172,6 +172,29 @@ bundle exec rake install
172
172
  bundle exec rake extension:install
173
173
  ```
174
174
 
175
+ #### Git source for Bundler
176
+
177
+ When specifying a git source for the AppSignal gem in Bundler we do not support
178
+ JRuby. This is because our gemspec defaults to the Ruby implementation for
179
+ installing the AppSignal C-extension.
180
+
181
+ ```ruby
182
+ # Gemfile
183
+ gem "appsignal",
184
+ :git => "https://github.com/appsignal/appsignal-ruby.git",
185
+ :branch => "master"
186
+ ```
187
+
188
+ When you need to use a git source of the gem in your JRuby install, you'll need
189
+ to run the following to install the C-extension on JRuby. Note that this
190
+ post-install step is not possible on platforms such as Heroku where the app is
191
+ sent through a deploy pipeline and the app is started immediately after.
192
+
193
+ ```bash
194
+ bundle install
195
+ (cd $(bundle show appsignal)/ext && rake)
196
+ ```
197
+
175
198
  ### Testing
176
199
 
177
200
  ```bash
data/Rakefile CHANGED
@@ -99,23 +99,26 @@ namespace :travis do
99
99
  end
100
100
 
101
101
  namespace :build do
102
+ def base_gemspec
103
+ eval(File.read("appsignal.gemspec")) # rubocop:disable Security/Eval
104
+ end
105
+
102
106
  def modify_base_gemspec
103
- eval(File.read("appsignal.gemspec")).tap do |s| # rubocop:disable Security/Eval
107
+ base_gemspec.tap do |s|
104
108
  yield s
105
109
  end
106
110
  end
107
111
 
108
112
  namespace :ruby do
109
- spec = modify_base_gemspec do |s|
110
- s.extensions = %w[ext/extconf.rb]
111
- end
112
-
113
- Gem::PackageTask.new(spec) { |_pkg| }
113
+ # Extension default set in `appsignal.gemspec`
114
+ Gem::PackageTask.new(base_gemspec) { |_pkg| }
114
115
  end
115
116
 
116
117
  namespace :jruby do
117
118
  spec = modify_base_gemspec do |s|
118
119
  s.platform = "java"
120
+ # Override extensions config with JRuby extension installer
121
+ # Default set in `appsignal.gemspec`
119
122
  s.extensions = %w[ext/Rakefile]
120
123
  s.add_dependency "ffi"
121
124
  end
@@ -300,7 +303,7 @@ namespace :extension do
300
303
  appsignal_extension.o \
301
304
  appsignal_extension.so \
302
305
  appsignal_extension.bundle \
303
- install.log \
306
+ install.report \
304
307
  libappsignal.* \
305
308
  appsignal.version \
306
309
  Makefile \
@@ -21,6 +21,9 @@ Gem::Specification.new do |gem|
21
21
  gem.require_paths = %w[lib ext]
22
22
  gem.version = Appsignal::VERSION
23
23
  gem.required_ruby_version = ">= 1.9"
24
+ # Default extension installer. Overridden by JRuby gemspec as defined in
25
+ # `Rakefile`.
26
+ gem.extensions = %w[ext/extconf.rb]
24
27
 
25
28
  gem.add_dependency "rack"
26
29
 
@@ -24,7 +24,7 @@ travis: # Default `.travis.yml` contents
24
24
  - "./support/bundler_wrapper exec rake extension:install"
25
25
  script: "./support/bundler_wrapper exec rake test"
26
26
  after_failure:
27
- - "find ./ext -name install.log -exec cat {} \\;"
27
+ - "find ./ext -name install.report -exec cat {} \\;"
28
28
  - "find ./ext -name mkmf.log -exec cat {} \\;"
29
29
 
30
30
  matrix:
@@ -98,6 +98,10 @@ matrix:
98
98
  exclude:
99
99
  ruby:
100
100
  - "2.0.0"
101
+ - gem: "rails-6.0"
102
+ exclude:
103
+ ruby:
104
+ - "2.0.0"
101
105
  - gem: "resque"
102
106
  bundler: "1.17.3"
103
107
  - gem: "sequel"
@@ -1,28 +1,35 @@
1
- require File.expand_path("../../lib/appsignal/version.rb", __FILE__)
2
1
  require File.expand_path("../base.rb", __FILE__)
3
2
 
3
+ def local_build?
4
+ File.exist?(ext_path("appsignal-agent")) &&
5
+ (
6
+ File.exist?(ext_path("libappsignal.dylib")) ||
7
+ File.exist?(ext_path("libappsignal.so"))
8
+ ) &&
9
+ File.exist?(ext_path("appsignal.h"))
10
+ end
11
+
4
12
  task :default do
5
13
  begin
6
- logger.info "Installing appsignal agent #{Appsignal::VERSION} for Ruby #{RUBY_VERSION} on #{RUBY_PLATFORM}"
7
- write_agent_architecture
14
+ library_type = "dynamic"
15
+ report["language"]["implementation"] = "jruby"
16
+ report["build"]["library_type"] = library_type
8
17
  next unless check_architecture
9
18
  arch_config = AGENT_CONFIG["triples"][ARCH]
10
19
 
11
- unless File.exist?(ext_path("appsignal-agent")) &&
12
- (
13
- File.exist?(ext_path("libappsignal.dylib")) ||
14
- File.exist?(ext_path("libappsignal.so"))
15
- ) &&
16
- File.exist?(ext_path("appsignal.h"))
17
- archive = download_archive(arch_config, "dynamic")
20
+ if local_build?
21
+ report["build"]["source"] = "local"
22
+ else
23
+ archive = download_archive(arch_config, library_type)
18
24
  next unless archive
19
- next unless verify_archive(archive, arch_config, "dynamic")
25
+ next unless verify_archive(archive, arch_config, library_type)
20
26
  unarchive(archive)
21
27
  end
22
- rescue => ex
23
- installation_failed "Exception while installing: #{ex}"
24
- ex.backtrace.each do |line|
25
- logger.error line
26
- end
28
+ successful_installation
29
+ rescue => error
30
+ fail_installation_with_error(error)
31
+ ensure
32
+ create_dummy_makefile unless installation_succeeded?
33
+ write_report
27
34
  end
28
35
  end
@@ -1,67 +1,67 @@
1
1
  ---
2
- version: 4c4acdf
2
+ version: 4a275d3
3
3
  triples:
4
4
  x86_64-darwin:
5
5
  static:
6
- checksum: 33117d6fc3db70a87b6c643762d13f0ed2e961003952beb97fb86a6d528a8af2
7
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-darwin-all-static.tar.gz
6
+ checksum: f8676db1685fa6df35d065fc829d5db33aea740f65b4e6e795d2a149154495c5
7
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-darwin-all-static.tar.gz
8
8
  dynamic:
9
- checksum: a9eca0b19c1863560cf402b5171eb7d8b3aee134d9a11cd52ddb5facd9192242
10
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-darwin-all-dynamic.tar.gz
9
+ checksum: ddb406306eb55a213c40802a6c1bb15327439145a85bf78ff971eda1b8feb6e2
10
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-darwin-all-dynamic.tar.gz
11
11
  universal-darwin:
12
12
  static:
13
- checksum: 33117d6fc3db70a87b6c643762d13f0ed2e961003952beb97fb86a6d528a8af2
14
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-darwin-all-static.tar.gz
13
+ checksum: f8676db1685fa6df35d065fc829d5db33aea740f65b4e6e795d2a149154495c5
14
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-darwin-all-static.tar.gz
15
15
  dynamic:
16
- checksum: a9eca0b19c1863560cf402b5171eb7d8b3aee134d9a11cd52ddb5facd9192242
17
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-darwin-all-dynamic.tar.gz
16
+ checksum: ddb406306eb55a213c40802a6c1bb15327439145a85bf78ff971eda1b8feb6e2
17
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-darwin-all-dynamic.tar.gz
18
18
  i686-linux:
19
19
  static:
20
- checksum: a75c82ead6c0e31662d58ee1e2824e09f80c96a483c8fb00c8a622013bb531db
21
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-i686-linux-all-static.tar.gz
20
+ checksum: 93bb9907d91e8ce7a5a3fcd6e81cbec7fde965b9e36192032c36d5d058bae60b
21
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-i686-linux-all-static.tar.gz
22
22
  dynamic:
23
- checksum: f18cf71eed0921ee1ae423fb2cf4f980ec16c270ffab9cd9b8201a5c222c7448
24
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-i686-linux-all-dynamic.tar.gz
23
+ checksum: 313e4ff150e1556c3cc44520af8d9f0ef8db1e2147d09ec550060fdf7c795d77
24
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-i686-linux-all-dynamic.tar.gz
25
25
  x86-linux:
26
26
  static:
27
- checksum: a75c82ead6c0e31662d58ee1e2824e09f80c96a483c8fb00c8a622013bb531db
28
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-i686-linux-all-static.tar.gz
27
+ checksum: 93bb9907d91e8ce7a5a3fcd6e81cbec7fde965b9e36192032c36d5d058bae60b
28
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-i686-linux-all-static.tar.gz
29
29
  dynamic:
30
- checksum: f18cf71eed0921ee1ae423fb2cf4f980ec16c270ffab9cd9b8201a5c222c7448
31
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-i686-linux-all-dynamic.tar.gz
30
+ checksum: 313e4ff150e1556c3cc44520af8d9f0ef8db1e2147d09ec550060fdf7c795d77
31
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-i686-linux-all-dynamic.tar.gz
32
32
  i686-linux-musl:
33
33
  static:
34
- checksum: 2776672dfc380c30cceaa8274addf880d54a39cc803e515b0ba00dbcbd36b044
35
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-i686-linux-musl-all-static.tar.gz
34
+ checksum: 04bba827f4e74bf3bd6ebe7da07ede82417dc4fdca6fd4484c0af0bbca979e7e
35
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-i686-linux-musl-all-static.tar.gz
36
36
  x86-linux-musl:
37
37
  static:
38
- checksum: 2776672dfc380c30cceaa8274addf880d54a39cc803e515b0ba00dbcbd36b044
39
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-i686-linux-musl-all-static.tar.gz
38
+ checksum: 04bba827f4e74bf3bd6ebe7da07ede82417dc4fdca6fd4484c0af0bbca979e7e
39
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-i686-linux-musl-all-static.tar.gz
40
40
  x86_64-linux:
41
41
  static:
42
- checksum: d0ced9bf5ccbfa407dbdf7d3528e7976059f08da340728dcd2b76c4ab2012ed2
43
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-linux-all-static.tar.gz
42
+ checksum: ae9714b731ecbe850959b2662b269af4c34abfa841cff6dbc8163793e408cb42
43
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-linux-all-static.tar.gz
44
44
  dynamic:
45
- checksum: 6ae9c20c3c51961a90476034ad54e26353f6f07d96ba4b3c568a5690be02cc0c
46
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-linux-all-dynamic.tar.gz
45
+ checksum: d61f9602e1eed0faa3398a885655839430790bca091dd7df6693510bbc9651dd
46
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-linux-all-dynamic.tar.gz
47
47
  x86_64-linux-musl:
48
48
  static:
49
- checksum: a8420232884339e4857fbdce76ecd7fbba2da893094b5f676e46b931f6767ec2
50
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-linux-musl-all-static.tar.gz
49
+ checksum: 3445eb0cf4cb5f69852fc9ee1d1691f9cb06ff9cbed1f41d9daa88e04cc755b9
50
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-linux-musl-all-static.tar.gz
51
51
  dynamic:
52
- checksum: d447ae2422cf405d21efc5f3ebf96050e53feb86be7509462942d8ec51734dc9
53
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-linux-musl-all-dynamic.tar.gz
52
+ checksum: f2e64f51301ff88731ad2ed38897744fc423e56d6baf4e77c0bbf306df005efa
53
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-linux-musl-all-dynamic.tar.gz
54
54
  x86_64-freebsd:
55
55
  static:
56
- checksum: 457e191e72af77f082c788c5a87eac253342f7238c54a325ea09881106fc8476
57
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-freebsd-all-static.tar.gz
56
+ checksum: 2820bd938abe4b46e444f30255a51e7580598ab67b645ec531c47a7d6f0000fc
57
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-freebsd-all-static.tar.gz
58
58
  dynamic:
59
- checksum: f789a7f7c4d3453b2ff23af734bb084dc6bc1372ab23e46453519ea436f4111b
60
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-freebsd-all-dynamic.tar.gz
59
+ checksum: 320d313309973df935d0c859b0d79f047969b3d7521e2dd37f002187386eb73a
60
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-freebsd-all-dynamic.tar.gz
61
61
  amd64-freebsd:
62
62
  static:
63
- checksum: 457e191e72af77f082c788c5a87eac253342f7238c54a325ea09881106fc8476
64
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-freebsd-all-static.tar.gz
63
+ checksum: 2820bd938abe4b46e444f30255a51e7580598ab67b645ec531c47a7d6f0000fc
64
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-freebsd-all-static.tar.gz
65
65
  dynamic:
66
- checksum: f789a7f7c4d3453b2ff23af734bb084dc6bc1372ab23e46453519ea436f4111b
67
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4c4acdf/appsignal-x86_64-freebsd-all-dynamic.tar.gz
66
+ checksum: 320d313309973df935d0c859b0d79f047969b3d7521e2dd37f002187386eb73a
67
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-freebsd-all-dynamic.tar.gz
@@ -1,10 +1,10 @@
1
1
  require "digest"
2
- require "logger"
3
2
  require "fileutils"
4
3
  require "open-uri"
5
4
  require "zlib"
6
5
  require "yaml"
7
6
  require "rubygems/package"
7
+ require File.expand_path("../../lib/appsignal/version.rb", __FILE__)
8
8
  require File.expand_path("../../lib/appsignal/system.rb", __FILE__)
9
9
 
10
10
  EXT_PATH = File.expand_path("..", __FILE__).freeze
@@ -18,60 +18,116 @@ def ext_path(path)
18
18
  File.join(EXT_PATH, path)
19
19
  end
20
20
 
21
- def logger
22
- @logger ||= Logger.new(File.join(EXT_PATH, "install.log"))
21
+ def report
22
+ @report ||=
23
+ begin
24
+ rbconfig = RbConfig::CONFIG
25
+ {
26
+ "result" => {
27
+ "status" => "incomplete"
28
+ },
29
+ "language" => {
30
+ "name" => "ruby",
31
+ "version" => "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"
32
+ },
33
+ "download" => {
34
+ "checksum" => "unverified"
35
+ },
36
+ "build" => {
37
+ "time" => Time.now.utc,
38
+ "package_path" => File.dirname(__dir__),
39
+ "architecture" => rbconfig["host_cpu"],
40
+ "target" => PLATFORM,
41
+ "musl_override" => Appsignal::System.force_musl_build?,
42
+ "dependencies" => {},
43
+ "flags" => {}
44
+ },
45
+ "host" => {
46
+ "root_user" => Process.uid.zero?,
47
+ "dependencies" => {}.tap do |d|
48
+ ldd_output = Appsignal::System.ldd_version_output
49
+ ldd_version = Appsignal::System.extract_ldd_version(ldd_output)
50
+ d["libc"] = ldd_version if ldd_version
51
+ end
52
+ }
53
+ }
54
+ end
55
+ end
56
+
57
+ def write_report
58
+ File.open(File.join(EXT_PATH, "install.report"), "w") do |file|
59
+ file.write YAML.dump(report)
60
+ end
23
61
  end
24
62
 
25
- def installation_failed(reason)
26
- logger.error "Installation failed: #{reason}"
63
+ def create_dummy_makefile
27
64
  File.open(File.join(EXT_PATH, "Makefile"), "w") do |file|
28
65
  file.write "default:\nclean:\ninstall:"
29
66
  end
30
67
  end
31
68
 
32
- def write_agent_architecture
33
- File.open(File.join(EXT_PATH, "appsignal.architecture"), "w") do |file|
34
- file.write ARCH
35
- end
69
+ def successful_installation
70
+ report["result"] = { "status" => "success" }
71
+ end
72
+
73
+ def abort_installation(reason)
74
+ report["result"] = {
75
+ "status" => "failed",
76
+ "message" => reason
77
+ }
78
+ false
79
+ end
80
+
81
+ def fail_installation_with_error(error)
82
+ report["result"] = {
83
+ "status" => "error",
84
+ "error" => "#{error.class}: #{error}",
85
+ "backtrace" => error.backtrace
86
+ }
87
+ false
88
+ end
89
+
90
+ def installation_succeeded?
91
+ report["result"]["status"] == "success"
36
92
  end
37
93
 
38
94
  def check_architecture
39
95
  if AGENT_CONFIG["triples"].key?(ARCH)
40
96
  true
41
97
  else
42
- installation_failed(
98
+ abort_installation(
43
99
  "AppSignal currently does not support your system architecture (#{ARCH})." \
44
- "Please let us know at support@appsignal.com, we aim to support everything our customers run."
100
+ "Please let us know at support@appsignal.com, we aim to support everything our customers run."
45
101
  )
46
- false
47
102
  end
48
103
  end
49
104
 
50
105
  def download_archive(arch_config, type)
106
+ report["build"]["source"] = "remote"
51
107
  if arch_config.key?(type)
52
- logger.info "Downloading agent release from #{arch_config[type]["download_url"]}"
53
- open(arch_config[type]["download_url"], :ssl_ca_cert => CA_CERT_PATH)
108
+ download_url = arch_config[type]["download_url"]
109
+ report["download"]["download_url"] = download_url
110
+ open(download_url, :ssl_ca_cert => CA_CERT_PATH)
54
111
  else
55
- installation_failed(
112
+ abort_installation(
56
113
  "AppSignal currently does not support your system. " \
57
- "Expected config for architecture '#{ARCH}' and package type '#{type}', but none found. " \
58
- "For a full list of supported systems visit: " \
59
- "https://docs.appsignal.com/support/operating-systems.html"
114
+ "Expected config for architecture '#{ARCH}' and package type '#{type}', but none found. " \
115
+ "For a full list of supported systems visit: " \
116
+ "https://docs.appsignal.com/support/operating-systems.html"
60
117
  )
61
- false
62
118
  end
63
119
  end
64
120
 
65
121
  def verify_archive(archive, arch_config, type)
66
122
  if Digest::SHA256.hexdigest(archive.read) == arch_config[type]["checksum"]
67
- logger.info "Checksum of downloaded archive verified, extracting archive"
123
+ report["download"]["checksum"] = "verified"
68
124
  true
69
125
  else
70
- installation_failed(
71
- "Aborting installation, checksum of downloaded archive could not be verified: " \
72
- "Expected '#{arch_config[type]["checksum"]}', got '#{checksum}'."
126
+ report["download"]["checksum"] = "invalid"
127
+ abort_installation(
128
+ "Checksum of downloaded archive could not be verified: " \
129
+ "Expected '#{arch_config[type]["checksum"]}', got '#{checksum}'."
73
130
  )
74
- false
75
131
  end
76
132
  end
77
133
 
@@ -85,5 +141,11 @@ def unarchive(archive)
85
141
  end
86
142
  end
87
143
  end
144
+ store_download_version_on_report
88
145
  FileUtils.chmod(0o755, ext_path("appsignal-agent"))
89
146
  end
147
+
148
+ def store_download_version_on_report
149
+ path = File.expand_path(File.join(File.dirname(__FILE__), "appsignal.version"))
150
+ report["build"]["agent_version"] = File.read(path).strip
151
+ end