appsignal 2.8.4 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rubocop_todo.yml +7 -16
- data/.travis.yml +4 -1
- data/CHANGELOG.md +16 -0
- data/README.md +23 -0
- data/Rakefile +10 -7
- data/appsignal.gemspec +3 -0
- data/build_matrix.yml +5 -1
- data/ext/Rakefile +23 -16
- data/ext/agent.yml +37 -37
- data/ext/base.rb +86 -24
- data/ext/extconf.rb +33 -26
- data/gemfiles/rails-6.0.gemfile +5 -0
- data/lib/appsignal.rb +14 -489
- data/lib/appsignal/cli/diagnose.rb +84 -4
- data/lib/appsignal/cli/diagnose/paths.rb +0 -5
- data/lib/appsignal/cli/diagnose/utils.rb +17 -0
- data/lib/appsignal/cli/helpers.rb +6 -0
- data/lib/appsignal/cli/install.rb +13 -7
- data/lib/appsignal/config.rb +1 -2
- data/lib/appsignal/event_formatter.rb +4 -5
- data/lib/appsignal/event_formatter/moped/query_formatter.rb +60 -59
- data/lib/appsignal/extension.rb +2 -2
- data/lib/appsignal/helpers/instrumentation.rb +485 -0
- data/lib/appsignal/helpers/metrics.rb +55 -0
- data/lib/appsignal/hooks.rb +9 -8
- data/lib/appsignal/hooks/puma.rb +65 -9
- data/lib/appsignal/hooks/sidekiq.rb +90 -0
- data/lib/appsignal/integrations/mongo_ruby_driver.rb +7 -0
- data/lib/appsignal/integrations/railtie.rb +2 -1
- data/lib/appsignal/marker.rb +2 -3
- data/lib/appsignal/minutely.rb +164 -14
- data/lib/appsignal/rack/sinatra_instrumentation.rb +1 -1
- data/lib/appsignal/system.rb +16 -18
- data/lib/appsignal/utils/rails_helper.rb +16 -0
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +129 -22
- data/spec/lib/appsignal/cli/install_spec.rb +6 -1
- data/spec/lib/appsignal/config_spec.rb +3 -3
- data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +6 -0
- data/spec/lib/appsignal/event_formatter_spec.rb +168 -69
- data/spec/lib/appsignal/hooks/puma_spec.rb +129 -0
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +147 -0
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +24 -1
- data/spec/lib/appsignal/minutely_spec.rb +251 -21
- data/spec/lib/appsignal/system_spec.rb +0 -35
- data/spec/lib/appsignal/utils/hash_sanitizer_spec.rb +39 -31
- data/spec/lib/appsignal/utils/json_spec.rb +7 -3
- data/spec/lib/appsignal_spec.rb +27 -2
- data/spec/spec_helper.rb +13 -0
- data/spec/support/helpers/log_helpers.rb +6 -0
- data/spec/support/project_fixture/config/appsignal.yml +1 -0
- data/spec/support/stubs/sidekiq/api.rb +4 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90a960722fe12c43e82f38a5cb6e73ab3e5e8dd9d504531060278a2565fb215c
|
4
|
+
data.tar.gz: 4e7ecc293fbf466b0b3f8fb9f9759a0c07016954ad08ff072129b90d53d640ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3e89afc04e6d0fcdc8615fc6d09296abdabc1da55f0fb4e31f661479a377fc473a2d9ab5656f655f8af96bc2afbb078b2d7d1695afa5f5fcbcfff23b453fbcd
|
7
|
+
data.tar.gz: 36b0189f2642866abbf8d96bab367d62dde538799d18602cfdd3a0a268911e08af8afd8c71401782bb9887841d2f1204c68acb6376001b0b0e8b71be6c2c7b55
|
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
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:
|
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:
|
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:
|
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:
|
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'
|
data/.travis.yml
CHANGED
@@ -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.
|
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
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
107
|
+
base_gemspec.tap do |s|
|
104
108
|
yield s
|
105
109
|
end
|
106
110
|
end
|
107
111
|
|
108
112
|
namespace :ruby do
|
109
|
-
|
110
|
-
|
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.
|
306
|
+
install.report \
|
304
307
|
libappsignal.* \
|
305
308
|
appsignal.version \
|
306
309
|
Makefile \
|
data/appsignal.gemspec
CHANGED
@@ -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
|
|
data/build_matrix.yml
CHANGED
@@ -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.
|
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"
|
data/ext/Rakefile
CHANGED
@@ -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
|
-
|
7
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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,
|
25
|
+
next unless verify_archive(archive, arch_config, library_type)
|
20
26
|
unarchive(archive)
|
21
27
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
data/ext/agent.yml
CHANGED
@@ -1,67 +1,67 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: 4a275d3
|
3
3
|
triples:
|
4
4
|
x86_64-darwin:
|
5
5
|
static:
|
6
|
-
checksum:
|
7
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
10
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
14
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
17
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
21
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
24
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
28
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
31
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
35
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
39
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
43
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
46
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
50
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
53
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
57
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
60
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
64
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
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:
|
67
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
66
|
+
checksum: 320d313309973df935d0c859b0d79f047969b3d7521e2dd37f002187386eb73a
|
67
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4a275d3/appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
data/ext/base.rb
CHANGED
@@ -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
|
22
|
-
@
|
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
|
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
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
98
|
+
abort_installation(
|
43
99
|
"AppSignal currently does not support your system architecture (#{ARCH})." \
|
44
|
-
|
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
|
-
|
53
|
-
|
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
|
-
|
112
|
+
abort_installation(
|
56
113
|
"AppSignal currently does not support your system. " \
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
-
|
123
|
+
report["download"]["checksum"] = "verified"
|
68
124
|
true
|
69
125
|
else
|
70
|
-
|
71
|
-
|
72
|
-
"
|
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
|