appsignal 2.10.6 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.semaphore/semaphore.yml +138 -62
- data/CHANGELOG.md +56 -0
- data/README.md +4 -4
- data/Rakefile +16 -4
- data/appsignal.gemspec +1 -1
- data/build_matrix.yml +20 -9
- data/ext/Rakefile +2 -0
- data/ext/agent.yml +19 -19
- data/ext/appsignal_extension.c +10 -1
- data/ext/base.rb +22 -4
- data/ext/extconf.rb +2 -0
- data/gemfiles/padrino.gemfile +2 -2
- data/gemfiles/rails-4.2.gemfile +9 -2
- data/gemfiles/rails-5.0.gemfile +1 -0
- data/gemfiles/rails-5.1.gemfile +1 -0
- data/gemfiles/rails-5.2.gemfile +1 -0
- data/gemfiles/rails-6.0.gemfile +1 -0
- data/gemfiles/resque-1.gemfile +7 -0
- data/gemfiles/{resque.gemfile → resque-2.gemfile} +1 -1
- data/lib/appsignal.rb +22 -1
- data/lib/appsignal/auth_check.rb +4 -2
- data/lib/appsignal/capistrano.rb +2 -0
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/config.rb +85 -16
- data/lib/appsignal/environment.rb +126 -0
- data/lib/appsignal/extension.rb +6 -5
- data/lib/appsignal/extension/jruby.rb +16 -5
- data/lib/appsignal/hooks.rb +25 -0
- data/lib/appsignal/hooks/active_job.rb +137 -0
- data/lib/appsignal/hooks/net_http.rb +10 -13
- data/lib/appsignal/hooks/puma.rb +1 -58
- data/lib/appsignal/hooks/redis.rb +2 -0
- data/lib/appsignal/hooks/resque.rb +60 -0
- data/lib/appsignal/hooks/sequel.rb +2 -0
- data/lib/appsignal/hooks/sidekiq.rb +18 -192
- data/lib/appsignal/integrations/delayed_job_plugin.rb +16 -3
- data/lib/appsignal/integrations/object.rb +4 -0
- data/lib/appsignal/integrations/que.rb +1 -1
- data/lib/appsignal/integrations/resque.rb +9 -12
- data/lib/appsignal/integrations/resque_active_job.rb +9 -24
- data/lib/appsignal/probes.rb +7 -0
- data/lib/appsignal/probes/puma.rb +61 -0
- data/lib/appsignal/probes/sidekiq.rb +104 -0
- data/lib/appsignal/rack/js_exception_catcher.rb +5 -2
- data/lib/appsignal/system.rb +0 -6
- data/lib/appsignal/transaction.rb +32 -7
- data/lib/appsignal/utils/deprecation_message.rb +6 -2
- data/lib/appsignal/version.rb +1 -1
- data/lib/puma/plugin/appsignal.rb +2 -1
- data/spec/lib/appsignal/auth_check_spec.rb +23 -0
- data/spec/lib/appsignal/capistrano2_spec.rb +1 -1
- data/spec/lib/appsignal/capistrano3_spec.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +44 -1
- data/spec/lib/appsignal/config_spec.rb +44 -1
- data/spec/lib/appsignal/environment_spec.rb +167 -0
- data/spec/lib/appsignal/extension/jruby_spec.rb +31 -28
- data/spec/lib/appsignal/extension_install_failure_spec.rb +23 -0
- data/spec/lib/appsignal/hooks/activejob_spec.rb +591 -0
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +187 -166
- data/spec/lib/appsignal/hooks/puma_spec.rb +2 -181
- data/spec/lib/appsignal/hooks/resque_spec.rb +185 -0
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +297 -549
- data/spec/lib/appsignal/hooks_spec.rb +57 -0
- data/spec/lib/appsignal/integrations/padrino_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/que_spec.rb +25 -6
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +20 -137
- data/spec/lib/appsignal/integrations/resque_spec.rb +20 -85
- data/spec/lib/appsignal/marker_spec.rb +1 -1
- data/spec/lib/appsignal/probes/puma_spec.rb +180 -0
- data/spec/lib/appsignal/probes/sidekiq_spec.rb +204 -0
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +9 -4
- data/spec/lib/appsignal/system_spec.rb +0 -36
- data/spec/lib/appsignal/transaction_spec.rb +35 -20
- data/spec/lib/appsignal_spec.rb +22 -0
- data/spec/lib/puma/appsignal_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -0
- data/spec/support/helpers/action_mailer_helpers.rb +25 -0
- data/spec/support/helpers/config_helpers.rb +3 -2
- data/spec/support/helpers/dependency_helper.rb +12 -0
- data/spec/support/helpers/env_helpers.rb +1 -1
- data/spec/support/helpers/environment_metdata_helper.rb +16 -0
- data/spec/support/helpers/transaction_helpers.rb +6 -0
- data/spec/support/stubs/sidekiq/api.rb +2 -2
- data/spec/support/testing.rb +19 -19
- metadata +31 -9
- data/lib/appsignal/integrations/net_http.rb +0 -16
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,61 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# 2.11.0
|
4
|
+
- Track queue time regardless of namespace. Support custom namespaces. PR #602
|
5
|
+
- Improve deprecation message from frontend error middleware. PR #620
|
6
|
+
- Report Ruby environment metadata. PR #621, #627, #619, #618
|
7
|
+
- Refactor: Move minutely probes to their own files and modules. PR #623
|
8
|
+
- Allow custom action names in Que integration. Needed for Active Job
|
9
|
+
integration. PR #628
|
10
|
+
- Add Active Job support. Support Active Job without separate AppSignal
|
11
|
+
integration of the background job library. Add support for previously
|
12
|
+
unsupported Active Job adapters. Adapters that were previously already
|
13
|
+
supported (Sidekiq, DelayedJob and Resque) still work in this new setup.
|
14
|
+
PR #629
|
15
|
+
- Add automatic Resque integration. Remove manual Resque and Resque Active Job
|
16
|
+
integrations. PR #630
|
17
|
+
- Fix issue with unknown events from being reported as often for long running
|
18
|
+
agents. Commit ba9afb538f44c68b8035a8cf40a39d89bc77b021
|
19
|
+
- Add support for Active Job priority. PR #632
|
20
|
+
- Track Active Job job metrics for magic dashboard. PR #633
|
21
|
+
- Report Sidekiq `jid` (job id) as transaction id, reported as "request_id" on
|
22
|
+
AppSignal.com. PR #640
|
23
|
+
- Always report Active Job ID, an internal ID used by Active Job. PR #639
|
24
|
+
- Support Delayed::Job jobs without specific method name, using
|
25
|
+
`Delayed::Job.enqueue`. PR #642
|
26
|
+
- Print warnings using Kernel.warn. PR #648
|
27
|
+
- Update AuthCheck class to use DeprecationMessage helper. PR #649
|
28
|
+
- Print extension load error when AppSignal is loaded. PR #651
|
29
|
+
|
30
|
+
# 2.10.12
|
31
|
+
- Fix `working_directory_path` config option loaded from environment variables.
|
32
|
+
PR #653
|
33
|
+
|
34
|
+
# 2.10.11
|
35
|
+
- Fix extension install report status output in `appsignal diagnose`. PR #636
|
36
|
+
- Support setting a specific configuration file to load with the
|
37
|
+
`Appsignal::Config` initializer. PR #638
|
38
|
+
|
39
|
+
# 2.10.10
|
40
|
+
- Bump agent to v-4548c88. PR #634
|
41
|
+
- Fix issue with host metrics values being reported as "Infinity".
|
42
|
+
|
43
|
+
# 2.10.9
|
44
|
+
- Use http proxy if configured when downloading agent. PR #606
|
45
|
+
- Clear event details cache every 48 hours.
|
46
|
+
Commit eb5e899db69fcd7cfa221567bfd6ac04f2654c9c
|
47
|
+
- Add support for Resque ActiveJob queue time reporting. PR #616
|
48
|
+
|
49
|
+
## 2.10.8
|
50
|
+
- Fix failed checksum error log. PR #609
|
51
|
+
- Fix DelayedJob action name detection for objects that listen to the `[]`
|
52
|
+
method and return a non-String value. #611
|
53
|
+
- CI test build improvements. PR #607, #608, #614
|
54
|
+
|
55
|
+
## 2.10.7
|
56
|
+
- Revert fix for compatibility with the `http_logger` gem. PR #604.
|
57
|
+
For more information, see issue #603 about our reasoning and discussion.
|
58
|
+
|
3
59
|
## 2.10.6
|
4
60
|
- Check if queued payloads are for correct app and not expired
|
5
61
|
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ issues.
|
|
9
9
|
- [Ruby code documentation][ruby-doc]
|
10
10
|
- [Support][contact]
|
11
11
|
|
12
|
-
[![Build status](https://appsignal.semaphoreci.com/badges/appsignal-ruby/branches/
|
12
|
+
[![Build status](https://appsignal.semaphoreci.com/badges/appsignal-ruby/branches/main.svg)](https://appsignal.semaphoreci.com/projects/appsignal-ruby)
|
13
13
|
[![Gem Version](https://badge.fury.io/rb/appsignal.svg)](http://badge.fury.io/rb/appsignal)
|
14
14
|
[![Code Climate](https://codeclimate.com/github/appsignal/appsignal.png)](https://codeclimate.com/github/appsignal/appsignal)
|
15
15
|
|
@@ -183,7 +183,7 @@ installing the AppSignal C-extension.
|
|
183
183
|
# Gemfile
|
184
184
|
gem "appsignal",
|
185
185
|
:git => "https://github.com/appsignal/appsignal-ruby.git",
|
186
|
-
:branch => "
|
186
|
+
:branch => "main"
|
187
187
|
```
|
188
188
|
|
189
189
|
When you need to use a git source of the gem in your JRuby install, you'll need
|
@@ -242,12 +242,12 @@ a number of different Ruby versions.
|
|
242
242
|
|
243
243
|
This gem uses [Semantic Versioning][semver].
|
244
244
|
|
245
|
-
The `
|
245
|
+
The `main` branch corresponds to the current stable release of the gem.
|
246
246
|
|
247
247
|
The `develop` branch is used for development of features that will end up in
|
248
248
|
the next minor release.
|
249
249
|
|
250
|
-
Open a Pull Request on the `
|
250
|
+
Open a Pull Request on the `main` branch if you're fixing a bug. For new new
|
251
251
|
features, open a Pull Request on the `develop` branch.
|
252
252
|
|
253
253
|
Every stable and unstable release is tagged in git with a version tag.
|
data/Rakefile
CHANGED
@@ -70,7 +70,10 @@ namespace :build_matrix do
|
|
70
70
|
job = {
|
71
71
|
"name" => "Ruby #{ruby_version} for #{gem["gem"]}",
|
72
72
|
"env_vars" => env,
|
73
|
-
"commands" => [
|
73
|
+
"commands" => [
|
74
|
+
"./support/bundler_wrapper exec rake test",
|
75
|
+
"./support/bundler_wrapper exec rake test:failure"
|
76
|
+
]
|
74
77
|
}
|
75
78
|
if gem["gem"] == "no_dependencies"
|
76
79
|
ruby_primary_block["task"]["jobs"] << job
|
@@ -364,11 +367,20 @@ end
|
|
364
367
|
|
365
368
|
begin
|
366
369
|
require "rspec/core/rake_task"
|
370
|
+
is_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
371
|
+
unless is_jruby
|
372
|
+
jruby_opts = "--exclude-pattern=spec/lib/appsignal/extension/jruby_spec.rb"
|
373
|
+
end
|
374
|
+
|
367
375
|
desc "Run the AppSignal gem test suite."
|
368
376
|
RSpec::Core::RakeTask.new :test do |t|
|
369
|
-
|
370
|
-
|
371
|
-
|
377
|
+
t.rspec_opts = jruby_opts
|
378
|
+
end
|
379
|
+
|
380
|
+
namespace :test do
|
381
|
+
desc "Run the Appsignal gem test in an extension failure scenario"
|
382
|
+
RSpec::Core::RakeTask.new :failure do |t|
|
383
|
+
t.rspec_opts = "#{jruby_opts} --tag extension_installation_failure"
|
372
384
|
end
|
373
385
|
end
|
374
386
|
rescue LoadError # rubocop:disable Lint/HandleExceptions
|
data/appsignal.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
|
|
29
29
|
gem.metadata = {
|
30
30
|
"bug_tracker_uri" => "https://github.com/appsignal/appsignal-ruby/issues",
|
31
31
|
"changelog_uri" =>
|
32
|
-
"https://github.com/appsignal/appsignal-ruby/blob/
|
32
|
+
"https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md",
|
33
33
|
"documentation_uri" => "https://docs.appsignal.com/ruby/",
|
34
34
|
"homepage_uri" => "https://docs.appsignal.com/ruby/",
|
35
35
|
"source_code_uri" => "https://github.com/appsignal/appsignal-ruby"
|
data/build_matrix.yml
CHANGED
@@ -10,8 +10,8 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
|
|
10
10
|
# Cancel all running and queued workflows before this one
|
11
11
|
auto_cancel:
|
12
12
|
running:
|
13
|
-
# Ignore
|
14
|
-
when: "branch != '
|
13
|
+
# Ignore main AND develop branch as we want it to build all workflows
|
14
|
+
when: "branch != 'main' AND branch != 'develop'"
|
15
15
|
|
16
16
|
global_job_config:
|
17
17
|
env_vars:
|
@@ -34,15 +34,20 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
|
|
34
34
|
- checkout
|
35
35
|
- sem-version ruby $RUBY_VERSION
|
36
36
|
- ./support/check_versions
|
37
|
-
- cache restore $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE)
|
38
|
-
- cache restore $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE)
|
37
|
+
- cache restore $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE)
|
38
|
+
- cache restore $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE)
|
39
39
|
- ./support/install_deps
|
40
|
+
- bundle config set clean 'true'
|
40
41
|
- ./support/bundler_wrapper install --jobs=3 --retry=3
|
41
42
|
epilogue:
|
42
43
|
on_pass:
|
43
44
|
commands:
|
44
45
|
- cache store $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE) .bundle
|
45
46
|
- cache store $_GEMS_CACHE-gems-$RUBY_VERSION-$(checksum $BUNDLE_GEMFILE) $HOME/.gem
|
47
|
+
on_fail:
|
48
|
+
commands:
|
49
|
+
- "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report file found'"
|
50
|
+
- "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file found'"
|
46
51
|
|
47
52
|
blocks:
|
48
53
|
- name: Validation
|
@@ -110,7 +115,7 @@ matrix:
|
|
110
115
|
- ruby: "2.5.7"
|
111
116
|
gems: "minimal"
|
112
117
|
- ruby: "2.6.5"
|
113
|
-
- ruby: "2.7.
|
118
|
+
- ruby: "2.7.1"
|
114
119
|
- ruby: "jruby-9.1.17.0"
|
115
120
|
gems: "minimal"
|
116
121
|
gems:
|
@@ -119,7 +124,9 @@ matrix:
|
|
119
124
|
- gem: "capistrano3"
|
120
125
|
- gem: "grape"
|
121
126
|
- gem: "padrino"
|
122
|
-
|
127
|
+
exclude:
|
128
|
+
ruby:
|
129
|
+
- "2.0.0-p648"
|
123
130
|
- gem: "que"
|
124
131
|
- gem: "que_beta"
|
125
132
|
exclude:
|
@@ -130,13 +137,13 @@ matrix:
|
|
130
137
|
exclude:
|
131
138
|
ruby:
|
132
139
|
- "2.6.5"
|
133
|
-
- "2.7.
|
140
|
+
- "2.7.1"
|
134
141
|
- gem: "rails-4.2"
|
135
142
|
bundler: "1.17.3"
|
136
143
|
exclude:
|
137
144
|
ruby:
|
138
145
|
- "2.6.5"
|
139
|
-
- "2.7.
|
146
|
+
- "2.7.1"
|
140
147
|
- gem: "rails-5.0"
|
141
148
|
exclude:
|
142
149
|
ruby:
|
@@ -158,8 +165,12 @@ matrix:
|
|
158
165
|
- "2.3.8"
|
159
166
|
- "2.4.9"
|
160
167
|
- "jruby-9.1.17.0"
|
161
|
-
- gem: "resque"
|
168
|
+
- gem: "resque-1"
|
162
169
|
bundler: "1.17.3"
|
170
|
+
- gem: "resque-2"
|
171
|
+
exclude:
|
172
|
+
ruby:
|
173
|
+
- "2.0.0-p648"
|
163
174
|
- gem: "sequel"
|
164
175
|
- gem: "sequel-435"
|
165
176
|
- gem: "sinatra"
|
data/ext/Rakefile
CHANGED
data/ext/agent.yml
CHANGED
@@ -1,70 +1,70 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: c8f8185
|
3
3
|
mirrors:
|
4
4
|
- https://appsignal-agent-releases.global.ssl.fastly.net
|
5
5
|
- https://d135dj0rjqvssy.cloudfront.net
|
6
6
|
triples:
|
7
7
|
x86_64-darwin:
|
8
8
|
static:
|
9
|
-
checksum:
|
9
|
+
checksum: 8fad088047d8c73e5c0cf9213c20873ad591881d4f7059b178d8eeb89255f73e
|
10
10
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
11
11
|
dynamic:
|
12
|
-
checksum:
|
12
|
+
checksum: 9a26f0dc170d38b068f66aaa016772f9e32e5fea99dc57bb9dfbc5f0a41dec89
|
13
13
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
14
14
|
universal-darwin:
|
15
15
|
static:
|
16
|
-
checksum:
|
16
|
+
checksum: 8fad088047d8c73e5c0cf9213c20873ad591881d4f7059b178d8eeb89255f73e
|
17
17
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
18
18
|
dynamic:
|
19
|
-
checksum:
|
19
|
+
checksum: 9a26f0dc170d38b068f66aaa016772f9e32e5fea99dc57bb9dfbc5f0a41dec89
|
20
20
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
21
21
|
i686-linux:
|
22
22
|
static:
|
23
|
-
checksum:
|
23
|
+
checksum: 0e8c4436684824a325fa1b581f6fad88598c529307b2b5ad0cc2620d22d2782f
|
24
24
|
filename: appsignal-i686-linux-all-static.tar.gz
|
25
25
|
dynamic:
|
26
|
-
checksum:
|
26
|
+
checksum: d0fc35643b36b368a985961ea1c68c3204927f9fed412fde64d81b04081651ff
|
27
27
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
28
28
|
x86-linux:
|
29
29
|
static:
|
30
|
-
checksum:
|
30
|
+
checksum: 0e8c4436684824a325fa1b581f6fad88598c529307b2b5ad0cc2620d22d2782f
|
31
31
|
filename: appsignal-i686-linux-all-static.tar.gz
|
32
32
|
dynamic:
|
33
|
-
checksum:
|
33
|
+
checksum: d0fc35643b36b368a985961ea1c68c3204927f9fed412fde64d81b04081651ff
|
34
34
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
35
35
|
i686-linux-musl:
|
36
36
|
static:
|
37
|
-
checksum:
|
37
|
+
checksum: 28b69e895da6b2a30402eed29cf8c3bbc4f647d6ce9cc5e0b11b4a771d7a1021
|
38
38
|
filename: appsignal-i686-linux-musl-all-static.tar.gz
|
39
39
|
x86-linux-musl:
|
40
40
|
static:
|
41
|
-
checksum:
|
41
|
+
checksum: 28b69e895da6b2a30402eed29cf8c3bbc4f647d6ce9cc5e0b11b4a771d7a1021
|
42
42
|
filename: appsignal-i686-linux-musl-all-static.tar.gz
|
43
43
|
x86_64-linux:
|
44
44
|
static:
|
45
|
-
checksum:
|
45
|
+
checksum: fb457dc39e005bb8f241e1e260bb9ea0460cf922db5e30f514dda8afa0bd57bc
|
46
46
|
filename: appsignal-x86_64-linux-all-static.tar.gz
|
47
47
|
dynamic:
|
48
|
-
checksum:
|
48
|
+
checksum: 55b26406ab0309905d5ad3aa34d1910fcc473f2a475ed5b3073d160a7ea68852
|
49
49
|
filename: appsignal-x86_64-linux-all-dynamic.tar.gz
|
50
50
|
x86_64-linux-musl:
|
51
51
|
static:
|
52
|
-
checksum:
|
52
|
+
checksum: cf469d6e3ee1dc6ccb9762a996355ecc407b9a906b9c0a0b6742363347ec9494
|
53
53
|
filename: appsignal-x86_64-linux-musl-all-static.tar.gz
|
54
54
|
dynamic:
|
55
|
-
checksum:
|
55
|
+
checksum: '0938eab03f2b00583a9b730743c68d3d350090a0ff96866b960a9c78a486a992'
|
56
56
|
filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
|
57
57
|
x86_64-freebsd:
|
58
58
|
static:
|
59
|
-
checksum:
|
59
|
+
checksum: 5c50e4776dbd0defe7d99015650e85d7983222ea27bd7b586b4c92f7b8336eee
|
60
60
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
61
61
|
dynamic:
|
62
|
-
checksum:
|
62
|
+
checksum: 02cd3b26317100290a2cfac014db026a2607723127955da1e4ddd5b76591003a
|
63
63
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
64
64
|
amd64-freebsd:
|
65
65
|
static:
|
66
|
-
checksum:
|
66
|
+
checksum: 5c50e4776dbd0defe7d99015650e85d7983222ea27bd7b586b4c92f7b8336eee
|
67
67
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
68
68
|
dynamic:
|
69
|
-
checksum:
|
69
|
+
checksum: 02cd3b26317100290a2cfac014db026a2607723127955da1e4ddd5b76591003a
|
70
70
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
data/ext/appsignal_extension.c
CHANGED
@@ -639,6 +639,14 @@ static VALUE running_in_container() {
|
|
639
639
|
return appsignal_running_in_container() == 1 ? Qtrue : Qfalse;
|
640
640
|
}
|
641
641
|
|
642
|
+
static VALUE set_environment_metadata(VALUE self, VALUE key, VALUE value) {
|
643
|
+
appsignal_set_environment_metadata(
|
644
|
+
make_appsignal_string(key),
|
645
|
+
make_appsignal_string(value)
|
646
|
+
);
|
647
|
+
return Qnil;
|
648
|
+
}
|
649
|
+
|
642
650
|
void Init_appsignal_extension(void) {
|
643
651
|
Appsignal = rb_define_module("Appsignal");
|
644
652
|
Extension = rb_define_class_under(Appsignal, "Extension", rb_cObject);
|
@@ -697,9 +705,10 @@ void Init_appsignal_extension(void) {
|
|
697
705
|
// Get JSON content of a data
|
698
706
|
rb_define_method(Data, "to_s", data_to_s, 0);
|
699
707
|
|
700
|
-
//
|
708
|
+
// Other helper methods
|
701
709
|
rb_define_singleton_method(Extension, "install_allocation_event_hook", install_allocation_event_hook, 0);
|
702
710
|
rb_define_singleton_method(Extension, "running_in_container?", running_in_container, 0);
|
711
|
+
rb_define_singleton_method(Extension, "set_environment_metadata", set_environment_metadata, 2);
|
703
712
|
|
704
713
|
// Metrics
|
705
714
|
rb_define_singleton_method(Extension, "set_gauge", set_gauge, 3);
|
data/ext/base.rb
CHANGED
@@ -32,7 +32,8 @@ def report
|
|
32
32
|
"version" => "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"
|
33
33
|
},
|
34
34
|
"download" => {
|
35
|
-
"checksum" => "unverified"
|
35
|
+
"checksum" => "unverified",
|
36
|
+
"http_proxy" => http_proxy
|
36
37
|
},
|
37
38
|
"build" => {
|
38
39
|
"time" => Time.now.utc,
|
@@ -126,7 +127,11 @@ def download_archive(type)
|
|
126
127
|
report["download"]["download_url"] = download_url
|
127
128
|
|
128
129
|
begin
|
129
|
-
return open(
|
130
|
+
return open(
|
131
|
+
download_url,
|
132
|
+
:ssl_ca_cert => CA_CERT_PATH,
|
133
|
+
:proxy => http_proxy
|
134
|
+
)
|
130
135
|
rescue
|
131
136
|
next
|
132
137
|
end
|
@@ -142,14 +147,16 @@ def download_archive(type)
|
|
142
147
|
end
|
143
148
|
|
144
149
|
def verify_archive(archive, type)
|
145
|
-
|
150
|
+
expected_checksum = ARCH_CONFIG[type]["checksum"]
|
151
|
+
actual_checksum = Digest::SHA256.hexdigest(archive.read)
|
152
|
+
if actual_checksum == expected_checksum
|
146
153
|
report["download"]["checksum"] = "verified"
|
147
154
|
true
|
148
155
|
else
|
149
156
|
report["download"]["checksum"] = "invalid"
|
150
157
|
abort_installation(
|
151
158
|
"Checksum of downloaded archive could not be verified: " \
|
152
|
-
"Expected '#{
|
159
|
+
"Expected '#{expected_checksum}', got '#{actual_checksum}'."
|
153
160
|
)
|
154
161
|
end
|
155
162
|
end
|
@@ -172,3 +179,14 @@ def store_download_version_on_report
|
|
172
179
|
path = File.expand_path(File.join(File.dirname(__FILE__), "appsignal.version"))
|
173
180
|
report["build"]["agent_version"] = File.read(path).strip
|
174
181
|
end
|
182
|
+
|
183
|
+
def http_proxy
|
184
|
+
Gem.configuration[:http_proxy] || ENV["http_proxy"] || ENV["HTTP_PROXY"]
|
185
|
+
end
|
186
|
+
|
187
|
+
# Fail the installation on purpose in a specific test environment.
|
188
|
+
def fail_install_on_purpose_in_test!
|
189
|
+
return unless ENV["_TEST_APPSIGNAL_EXTENSION_FAILURE"]
|
190
|
+
|
191
|
+
raise "AppSignal internal test failure"
|
192
|
+
end
|
data/ext/extconf.rb
CHANGED
data/gemfiles/padrino.gemfile
CHANGED
data/gemfiles/rails-4.2.gemfile
CHANGED
@@ -3,8 +3,15 @@ source 'https://rubygems.org'
|
|
3
3
|
gem 'rails', '~> 4.2.0'
|
4
4
|
gem 'mime-types', '~> 2.6'
|
5
5
|
|
6
|
-
|
6
|
+
ruby_version = Gem::Version.new(RUBY_VERSION)
|
7
|
+
if ruby_version < Gem::Version.new("2.3.0")
|
8
|
+
gem "sidekiq", "~> 4.0"
|
9
|
+
else
|
10
|
+
gem "sidekiq"
|
11
|
+
end
|
7
12
|
|
8
|
-
if
|
13
|
+
if ruby_version < Gem::Version.new("2.1.0")
|
9
14
|
gem 'nokogiri', '~> 1.6.0'
|
10
15
|
end
|
16
|
+
|
17
|
+
gemspec :path => '../'
|