appsignal 2.9.2.alpha.1 → 2.9.18.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
  3. data/.github/ISSUE_TEMPLATE/chore.md +14 -0
  4. data/.gitignore +1 -2
  5. data/.rubocop.yml +3 -0
  6. data/.travis.yml +25 -27
  7. data/CHANGELOG.md +632 -535
  8. data/README.md +8 -3
  9. data/Rakefile +118 -122
  10. data/SUPPORT.md +16 -0
  11. data/appsignal.gemspec +14 -4
  12. data/build_matrix.yml +16 -8
  13. data/ext/Rakefile +2 -3
  14. data/ext/agent.yml +40 -37
  15. data/ext/base.rb +37 -14
  16. data/ext/extconf.rb +3 -4
  17. data/gemfiles/capistrano2.gemfile +5 -0
  18. data/gemfiles/capistrano3.gemfile +5 -0
  19. data/gemfiles/grape.gemfile +5 -0
  20. data/gemfiles/no_dependencies.gemfile +5 -0
  21. data/gemfiles/padrino.gemfile +5 -0
  22. data/gemfiles/que.gemfile +5 -0
  23. data/gemfiles/que_beta.gemfile +10 -0
  24. data/gemfiles/rails-3.2.gemfile +5 -0
  25. data/gemfiles/rails-4.0.gemfile +5 -0
  26. data/gemfiles/rails-4.1.gemfile +5 -0
  27. data/gemfiles/rails-4.2.gemfile +5 -0
  28. data/gemfiles/rails-6.0.gemfile +1 -1
  29. data/gemfiles/resque.gemfile +5 -0
  30. data/lib/appsignal.rb +1 -4
  31. data/lib/appsignal/cli/demo.rb +5 -2
  32. data/lib/appsignal/cli/diagnose/utils.rb +2 -0
  33. data/lib/appsignal/cli/install.rb +34 -10
  34. data/lib/appsignal/cli/notify_of_deploy.rb +10 -0
  35. data/lib/appsignal/event_formatter/action_view/render_formatter.rb +10 -8
  36. data/lib/appsignal/helpers/instrumentation.rb +18 -9
  37. data/lib/appsignal/helpers/metrics.rb +0 -1
  38. data/lib/appsignal/hooks.rb +3 -1
  39. data/lib/appsignal/hooks/active_support_notifications.rb +2 -5
  40. data/lib/appsignal/hooks/puma.rb +15 -13
  41. data/lib/appsignal/hooks/sequel.rb +1 -1
  42. data/lib/appsignal/hooks/sidekiq.rb +33 -8
  43. data/lib/appsignal/integrations/que.rb +9 -8
  44. data/lib/appsignal/minutely.rb +38 -19
  45. data/lib/appsignal/transaction.rb +5 -0
  46. data/lib/appsignal/utils/rails_helper.rb +4 -0
  47. data/lib/appsignal/version.rb +1 -1
  48. data/lib/puma/plugin/appsignal.rb +26 -0
  49. data/spec/lib/appsignal/cli/diagnose/utils_spec.rb +40 -0
  50. data/spec/lib/appsignal/cli/install_spec.rb +51 -7
  51. data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +10 -0
  52. data/spec/lib/appsignal/config_spec.rb +10 -8
  53. data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +38 -28
  54. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +104 -25
  55. data/spec/lib/appsignal/hooks/puma_spec.rb +69 -39
  56. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +65 -3
  57. data/spec/lib/appsignal/hooks_spec.rb +4 -0
  58. data/spec/lib/appsignal/minutely_spec.rb +150 -88
  59. data/spec/lib/appsignal/transaction_spec.rb +27 -4
  60. data/spec/lib/appsignal_spec.rb +62 -11
  61. data/spec/lib/puma/appsignal_spec.rb +91 -0
  62. data/spec/support/{project_fixture → fixtures/projects/valid}/config/application.rb +0 -0
  63. data/spec/support/{project_fixture → fixtures/projects/valid}/config/appsignal.yml +0 -0
  64. data/spec/support/{project_fixture → fixtures/projects/valid}/config/environments/development.rb +0 -0
  65. data/spec/support/{project_fixture → fixtures/projects/valid}/config/environments/production.rb +0 -0
  66. data/spec/support/{project_fixture → fixtures/projects/valid}/config/environments/test.rb +0 -0
  67. data/spec/support/{project_fixture → fixtures/projects/valid}/log/.gitkeep +0 -0
  68. data/spec/support/helpers/config_helpers.rb +1 -1
  69. data/spec/support/helpers/wait_for_helper.rb +28 -0
  70. data/spec/support/mocks/mock_probe.rb +11 -0
  71. metadata +37 -30
  72. data/spec/support/fixtures/containers/cgroups/docker +0 -14
  73. data/spec/support/fixtures/containers/cgroups/docker_systemd +0 -8
  74. data/spec/support/fixtures/containers/cgroups/lxc +0 -10
  75. data/spec/support/fixtures/containers/cgroups/no_permission +0 -0
  76. data/spec/support/fixtures/containers/cgroups/none +0 -1
@@ -15,14 +15,13 @@ task :default do
15
15
  report["language"]["implementation"] = "jruby"
16
16
  report["build"]["library_type"] = library_type
17
17
  next unless check_architecture
18
- arch_config = AGENT_CONFIG["triples"][ARCH]
19
18
 
20
19
  if local_build?
21
20
  report["build"]["source"] = "local"
22
21
  else
23
- archive = download_archive(arch_config, library_type)
22
+ archive = download_archive(library_type)
24
23
  next unless archive
25
- next unless verify_archive(archive, arch_config, library_type)
24
+ next unless verify_archive(archive, library_type)
26
25
  unarchive(archive)
27
26
  end
28
27
  successful_installation
@@ -1,67 +1,70 @@
1
1
  ---
2
- version: 4019bf9
2
+ version: c348132
3
+ mirrors:
4
+ - https://appsignal-agent-releases.global.ssl.fastly.net
5
+ - https://d135dj0rjqvssy.cloudfront.net
3
6
  triples:
4
7
  x86_64-darwin:
5
8
  static:
6
- checksum: ab5d75d7d1554b53d83b9181fc1b3d05220d5bd86cd6d5a0b91ef4a262e1c571
7
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-darwin-all-static.tar.gz
9
+ checksum: cb287c8e2072fe5b8cf14449bd6892989c392d0c651ce339895ae0302cb69785
10
+ filename: appsignal-x86_64-darwin-all-static.tar.gz
8
11
  dynamic:
9
- checksum: 19fb47d063aa02f665868220568095996c6616b61d58f9a86980a7ace60ed7f9
10
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-darwin-all-dynamic.tar.gz
12
+ checksum: af1ed2e9d29859ffbfc8e6903e4c51764dee94d7b4877ca8d30270b6f133a10f
13
+ filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
11
14
  universal-darwin:
12
15
  static:
13
- checksum: ab5d75d7d1554b53d83b9181fc1b3d05220d5bd86cd6d5a0b91ef4a262e1c571
14
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-darwin-all-static.tar.gz
16
+ checksum: cb287c8e2072fe5b8cf14449bd6892989c392d0c651ce339895ae0302cb69785
17
+ filename: appsignal-x86_64-darwin-all-static.tar.gz
15
18
  dynamic:
16
- checksum: 19fb47d063aa02f665868220568095996c6616b61d58f9a86980a7ace60ed7f9
17
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-darwin-all-dynamic.tar.gz
19
+ checksum: af1ed2e9d29859ffbfc8e6903e4c51764dee94d7b4877ca8d30270b6f133a10f
20
+ filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
18
21
  i686-linux:
19
22
  static:
20
- checksum: 6ab48834486b380edf22aa85ea858763046e98952ff3afcad8cb61589be802ff
21
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-all-static.tar.gz
23
+ checksum: 2c3bcd102592bf38fbdb27e7c70502dccbe54a0dc2739a9d54aaa694fcfb41fb
24
+ filename: appsignal-i686-linux-all-static.tar.gz
22
25
  dynamic:
23
- checksum: 6e4c3b0f62ee688938ad35842452ff9ac54f35da07959d90f6aa43269effdbe9
24
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-all-dynamic.tar.gz
26
+ checksum: 1c037b8370b755d706340e25d3e4b2f4acb279dd03873cc53bcf0a6ec0832653
27
+ filename: appsignal-i686-linux-all-dynamic.tar.gz
25
28
  x86-linux:
26
29
  static:
27
- checksum: 6ab48834486b380edf22aa85ea858763046e98952ff3afcad8cb61589be802ff
28
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-all-static.tar.gz
30
+ checksum: 2c3bcd102592bf38fbdb27e7c70502dccbe54a0dc2739a9d54aaa694fcfb41fb
31
+ filename: appsignal-i686-linux-all-static.tar.gz
29
32
  dynamic:
30
- checksum: 6e4c3b0f62ee688938ad35842452ff9ac54f35da07959d90f6aa43269effdbe9
31
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-all-dynamic.tar.gz
33
+ checksum: 1c037b8370b755d706340e25d3e4b2f4acb279dd03873cc53bcf0a6ec0832653
34
+ filename: appsignal-i686-linux-all-dynamic.tar.gz
32
35
  i686-linux-musl:
33
36
  static:
34
- checksum: cf6e2d45978d32ad0330bdad035f536df931a9e5e647cc4eadfb5982dfb76818
35
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-musl-all-static.tar.gz
37
+ checksum: 0add9eed4452feda7fc5e1bbd0acdff32c353e4ea0b5d527959df57deb1bdcb2
38
+ filename: appsignal-i686-linux-musl-all-static.tar.gz
36
39
  x86-linux-musl:
37
40
  static:
38
- checksum: cf6e2d45978d32ad0330bdad035f536df931a9e5e647cc4eadfb5982dfb76818
39
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-i686-linux-musl-all-static.tar.gz
41
+ checksum: 0add9eed4452feda7fc5e1bbd0acdff32c353e4ea0b5d527959df57deb1bdcb2
42
+ filename: appsignal-i686-linux-musl-all-static.tar.gz
40
43
  x86_64-linux:
41
44
  static:
42
- checksum: c7f4383ec3a896fe8652d28a96f272763e9a7c81372520bf082eabd0ed34bdbd
43
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-linux-all-static.tar.gz
45
+ checksum: d11221c127c00128da16b419c503281407e429c0ea6f5bfe1691640b8e995e4e
46
+ filename: appsignal-x86_64-linux-all-static.tar.gz
44
47
  dynamic:
45
- checksum: fe0f3a0fcfe48aa29a88fa8fe97c9c3f16210e53ea1fc741845bf2addab5fce5
46
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-linux-all-dynamic.tar.gz
48
+ checksum: 6869ab461fde55487d55805c396d55f36cb881998556f44236035b949939b0af
49
+ filename: appsignal-x86_64-linux-all-dynamic.tar.gz
47
50
  x86_64-linux-musl:
48
51
  static:
49
- checksum: d110e32589041d03f2787982591557aa934172392a4ff9d63b5823fc624232c7
50
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-linux-musl-all-static.tar.gz
52
+ checksum: 7ce44dc23c578933ca37a79d244bc367fdc2438408c2a61558adb92bcfebb1fa
53
+ filename: appsignal-x86_64-linux-musl-all-static.tar.gz
51
54
  dynamic:
52
- checksum: 7230a12b448cdec33a72ad4abfb405ade8a02e0c47a7302a40267b87039533d2
53
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-linux-musl-all-dynamic.tar.gz
55
+ checksum: 78d98f468e3a12cc09baff9e68bc4d9cd3b79f4a3bbe744036bff685415546a4
56
+ filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
54
57
  x86_64-freebsd:
55
58
  static:
56
- checksum: 203c49fabed6a375d691e8d62c2b3f0e82bef806765fa1cd718bd5c04658c629
57
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-freebsd-all-static.tar.gz
59
+ checksum: df5f8b61e6ecca40f349cf5c83d5f37f031850d367793dee90dc56f13974431d
60
+ filename: appsignal-x86_64-freebsd-all-static.tar.gz
58
61
  dynamic:
59
- checksum: 4d5df3da68e7961f5b6a779f63db5d8a458472700ae8cc729932c606dea84b71
60
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-freebsd-all-dynamic.tar.gz
62
+ checksum: 30d0303e97386014640c5b8194b777a5741e08ab5497ba58a7d8229bd4890fc5
63
+ filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
61
64
  amd64-freebsd:
62
65
  static:
63
- checksum: 203c49fabed6a375d691e8d62c2b3f0e82bef806765fa1cd718bd5c04658c629
64
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-freebsd-all-static.tar.gz
66
+ checksum: df5f8b61e6ecca40f349cf5c83d5f37f031850d367793dee90dc56f13974431d
67
+ filename: appsignal-x86_64-freebsd-all-static.tar.gz
65
68
  dynamic:
66
- checksum: 4d5df3da68e7961f5b6a779f63db5d8a458472700ae8cc729932c606dea84b71
67
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4019bf9/appsignal-x86_64-freebsd-all-dynamic.tar.gz
69
+ checksum: 30d0303e97386014640c5b8194b777a5741e08ab5497ba58a7d8229bd4890fc5
70
+ filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
@@ -10,8 +10,9 @@ require File.expand_path("../../lib/appsignal/system.rb", __FILE__)
10
10
  EXT_PATH = File.expand_path("..", __FILE__).freeze
11
11
  AGENT_CONFIG = YAML.load(File.read(File.join(EXT_PATH, "agent.yml"))).freeze
12
12
 
13
- PLATFORM = Appsignal::System.agent_platform
14
- ARCH = "#{RbConfig::CONFIG["host_cpu"]}-#{PLATFORM}".freeze
13
+ AGENT_PLATFORM = Appsignal::System.agent_platform
14
+ ARCH = "#{RbConfig::CONFIG["host_cpu"]}-#{AGENT_PLATFORM}".freeze
15
+ ARCH_CONFIG = AGENT_CONFIG["triples"][ARCH].freeze
15
16
  CA_CERT_PATH = File.join(EXT_PATH, "../resources/cacert.pem").freeze
16
17
 
17
18
  def ext_path(path)
@@ -35,9 +36,9 @@ def report
35
36
  },
36
37
  "build" => {
37
38
  "time" => Time.now.utc,
38
- "package_path" => File.dirname(__dir__),
39
+ "package_path" => File.dirname(EXT_PATH),
39
40
  "architecture" => rbconfig["host_cpu"],
40
- "target" => PLATFORM,
41
+ "target" => AGENT_PLATFORM,
41
42
  "musl_override" => Appsignal::System.force_musl_build?,
42
43
  "dependencies" => {},
43
44
  "flags" => {}
@@ -102,31 +103,53 @@ def check_architecture
102
103
  end
103
104
  end
104
105
 
105
- def download_archive(arch_config, type)
106
+ def download_archive(type)
106
107
  report["build"]["source"] = "remote"
107
- if arch_config.key?(type)
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)
111
- else
108
+
109
+ unless ARCH_CONFIG.key?(type)
112
110
  abort_installation(
113
111
  "AppSignal currently does not support your system. " \
114
- "Expected config for architecture '#{ARCH}' and package type '#{type}', but none found. " \
112
+ "Expected config for architecture '#{arch}' and package type '#{type}', but none found. " \
115
113
  "For a full list of supported systems visit: " \
116
114
  "https://docs.appsignal.com/support/operating-systems.html"
117
115
  )
116
+ return
118
117
  end
118
+
119
+ version = AGENT_CONFIG["version"]
120
+ filename = ARCH_CONFIG[type]["filename"]
121
+ attempted_mirror_urls = []
122
+
123
+ AGENT_CONFIG["mirrors"].each do |mirror|
124
+ download_url = [mirror, version, filename].join("/")
125
+ attempted_mirror_urls << download_url
126
+ report["download"]["download_url"] = download_url
127
+
128
+ begin
129
+ return open(download_url, :ssl_ca_cert => CA_CERT_PATH)
130
+ rescue
131
+ next
132
+ end
133
+ end
134
+
135
+ attempted_mirror_urls_mapped = attempted_mirror_urls.map { |mirror| "- #{mirror}" }
136
+ abort_installation(
137
+ "Could not download archive from any of our mirrors. " \
138
+ "Attempted to download the archive from the following urls:\n" \
139
+ "#{attempted_mirror_urls_mapped.join("\n")}\n" \
140
+ "Please make sure your network allows access to any of these mirrors."
141
+ )
119
142
  end
120
143
 
121
- def verify_archive(archive, arch_config, type)
122
- if Digest::SHA256.hexdigest(archive.read) == arch_config[type]["checksum"]
144
+ def verify_archive(archive, type)
145
+ if Digest::SHA256.hexdigest(archive.read) == ARCH_CONFIG[type]["checksum"]
123
146
  report["download"]["checksum"] = "verified"
124
147
  true
125
148
  else
126
149
  report["download"]["checksum"] = "invalid"
127
150
  abort_installation(
128
151
  "Checksum of downloaded archive could not be verified: " \
129
- "Expected '#{arch_config[type]["checksum"]}', got '#{checksum}'."
152
+ "Expected '#{ARCH_CONFIG[type]["checksum"]}', got '#{checksum}'."
130
153
  )
131
154
  end
132
155
  end
@@ -11,21 +11,20 @@ def install
11
11
  report["language"]["implementation"] = "ruby"
12
12
  report["build"]["library_type"] = library_type
13
13
  return unless check_architecture
14
- arch_config = AGENT_CONFIG["triples"][ARCH]
15
14
 
16
15
  if local_build?
17
16
  report["build"]["source"] = "local"
18
17
  else
19
- archive = download_archive(arch_config, library_type)
18
+ archive = download_archive(library_type)
20
19
  return unless archive
21
- return unless verify_archive(archive, arch_config, library_type)
20
+ return unless verify_archive(archive, library_type)
22
21
  unarchive(archive)
23
22
  end
24
23
 
25
24
  is_linux_system = [
26
25
  Appsignal::System::LINUX_TARGET,
27
26
  Appsignal::System::MUSL_TARGET
28
- ].include?(PLATFORM)
27
+ ].include?(AGENT_PLATFORM)
29
28
 
30
29
  require "mkmf"
31
30
  link_libraries if is_linux_system
@@ -3,5 +3,10 @@ source 'https://rubygems.org'
3
3
  gem 'capistrano', '< 3.0'
4
4
  gem 'net-ssh', '2.9.2'
5
5
  gem 'rack', '~> 1.6'
6
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
7
+ gem 'public_suffix', "~> 2.0.0"
8
+ else
9
+ gem 'public_suffix'
10
+ end
6
11
 
7
12
  gemspec :path => '../'
@@ -4,5 +4,10 @@ gem 'capistrano', '~> 3.0'
4
4
  gem 'i18n', '~> 1.2.0'
5
5
  gem 'net-ssh', '2.9.2'
6
6
  gem 'rack', '~> 1.6'
7
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
8
+ gem 'public_suffix', "~> 2.0.0"
9
+ else
10
+ gem 'public_suffix'
11
+ end
7
12
 
8
13
  gemspec :path => '../'
@@ -3,5 +3,10 @@ source 'https://rubygems.org'
3
3
  gem 'grape', '0.14.0'
4
4
  gem 'rack', '~> 1.6'
5
5
  gem 'activesupport', '~> 4.2'
6
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
7
+ gem 'public_suffix', "~> 2.0.0"
8
+ else
9
+ gem 'public_suffix'
10
+ end
6
11
 
7
12
  gemspec :path => '../'
@@ -1,5 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rack', '~> 1.6'
4
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
5
+ gem 'public_suffix', "~> 2.0.0"
6
+ else
7
+ gem 'public_suffix'
8
+ end
4
9
 
5
10
  gemspec :path => '../'
@@ -3,5 +3,10 @@ source 'https://rubygems.org'
3
3
  gem 'padrino', '~> 0.13.0'
4
4
  gem 'rack', '~> 1.6'
5
5
  gem 'activesupport', '~> 4.2'
6
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
7
+ gem 'public_suffix', "~> 2.0.0"
8
+ else
9
+ gem 'public_suffix'
10
+ end
6
11
 
7
12
  gemspec :path => '../'
@@ -1,5 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'que'
4
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
5
+ gem 'public_suffix', "~> 2.0.0"
6
+ else
7
+ gem 'public_suffix'
8
+ end
4
9
 
5
10
  gemspec :path => '../'
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'que', '1.0.0.beta3'
4
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
5
+ gem 'public_suffix', "~> 2.0.0"
6
+ else
7
+ gem 'public_suffix'
8
+ end
9
+
10
+ gemspec :path => '../'
@@ -2,5 +2,10 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 3.2.14'
4
4
  gem 'test-unit'
5
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
6
+ gem 'public_suffix', "~> 2.0.0"
7
+ else
8
+ gem 'public_suffix'
9
+ end
5
10
 
6
11
  gemspec :path => '../'
@@ -2,5 +2,10 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 4.0.0'
4
4
  gem 'mime-types', '~> 2.6'
5
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
6
+ gem 'public_suffix', "~> 2.0.0"
7
+ else
8
+ gem 'public_suffix'
9
+ end
5
10
 
6
11
  gemspec :path => '../'
@@ -2,5 +2,10 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 4.1.0'
4
4
  gem 'mime-types', '~> 2.6'
5
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
6
+ gem 'public_suffix', "~> 2.0.0"
7
+ else
8
+ gem 'public_suffix'
9
+ end
5
10
 
6
11
  gemspec :path => '../'
@@ -8,3 +8,8 @@ gemspec :path => '../'
8
8
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.1.0")
9
9
  gem 'nokogiri', '~> 1.6.0'
10
10
  end
11
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
12
+ gem 'public_suffix', "~> 2.0.0"
13
+ else
14
+ gem 'public_suffix'
15
+ end
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '~> 6.0.0.beta.1'
3
+ gem 'rails', '~> 6.0.0'
4
4
 
5
5
  gemspec :path => '../'
@@ -10,3 +10,8 @@ gemspec :path => '../'
10
10
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.1.0")
11
11
  gem 'nokogiri', '~> 1.6.0'
12
12
  end
13
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new("2.1.0")
14
+ gem 'public_suffix', "~> 2.0.0"
15
+ else
16
+ gem 'public_suffix'
17
+ end
@@ -135,10 +135,7 @@ module Appsignal
135
135
  Appsignal::Extension.install_allocation_event_hook
136
136
  end
137
137
 
138
- if config[:enable_gc_instrumentation]
139
- GC::Profiler.enable
140
- Appsignal::Minutely.register_garbage_collection_probe
141
- end
138
+ GC::Profiler.enable if config[:enable_gc_instrumentation]
142
139
 
143
140
  Appsignal::Minutely.start if config[:enable_minutely_probes]
144
141
  else
@@ -54,8 +54,11 @@ module Appsignal
54
54
  puts "Demonstration sample data sent!"
55
55
  puts "It may take about a minute for the data to appear on https://appsignal.com/accounts"
56
56
  else
57
- puts "Error: Unable to start the AppSignal agent and send data to AppSignal.com"
58
- puts "Please use `appsignal diagnose` to debug your configuration."
57
+ 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
60
+ puts " bundle exec appsignal diagnose --environment=production"
61
+ puts
59
62
  exit 1
60
63
  end
61
64
  end
@@ -6,12 +6,14 @@ module Appsignal
6
6
  passwd_struct = Etc.getpwuid(uid)
7
7
  return unless passwd_struct
8
8
  passwd_struct.name
9
+ rescue ArgumentError # rubocop:disable Lint/HandleExceptions
9
10
  end
10
11
 
11
12
  def self.group_for_gid(gid)
12
13
  passwd_struct = Etc.getgrgid(gid)
13
14
  return unless passwd_struct
14
15
  passwd_struct.name
16
+ rescue ArgumentError # rubocop:disable Lint/HandleExceptions
15
17
  end
16
18
 
17
19
  def self.read_file_content(path, bytes_to_read)
@@ -75,18 +75,39 @@ module Appsignal
75
75
  def install_for_rails(config)
76
76
  puts "Installing for Ruby on Rails"
77
77
 
78
- require File.expand_path(File.join(Dir.pwd, "config/application.rb"))
78
+ name_overwritten = configure_rails_app_name(config)
79
+ configure(config, rails_environments, name_overwritten)
80
+ done_notice
81
+ end
79
82
 
80
- config[:name] = Appsignal::Utils::RailsHelper.detected_rails_app_name
81
- name_overwritten = yes_or_no(" Your app's name is: '#{config[:name]}' \n Do you want to change how this is displayed in AppSignal? (y/n): ")
82
- puts
83
- if name_overwritten
84
- config[:name] = required_input(" Choose app's display name: ")
83
+ def configure_rails_app_name(config)
84
+ loaded =
85
+ begin
86
+ load Appsignal::Utils::RailsHelper.application_config_path
87
+ true
88
+ rescue LoadError, StandardError
89
+ false
90
+ end
91
+
92
+ name_overwritten = false
93
+ if loaded
94
+ config[:name] = Appsignal::Utils::RailsHelper.detected_rails_app_name
95
+ puts
96
+ name_overwritten = yes_or_no(
97
+ " Your app's name is: '#{config[:name]}' \n " \
98
+ "Do you want to change how this is displayed in AppSignal? " \
99
+ "(y/n): "
100
+ )
101
+ if name_overwritten
102
+ config[:name] = required_input(" Choose app's display name: ")
103
+ puts
104
+ end
105
+ else
106
+ puts " Unable to automatically detect your Rails app's name."
107
+ config[:name] = required_input(" Choose your app's display name for AppSignal.com: ")
85
108
  puts
86
109
  end
87
-
88
- configure(config, rails_environments, name_overwritten)
89
- done_notice
110
+ name_overwritten
90
111
  end
91
112
 
92
113
  def install_for_sinatra(config)
@@ -227,7 +248,10 @@ module Appsignal
227
248
 
228
249
  def installed_frameworks
229
250
  [].tap do |out|
230
- out << :rails if framework_available? "rails"
251
+ if framework_available?("rails") &&
252
+ File.exist?(Appsignal::Utils::RailsHelper.application_config_path)
253
+ out << :rails
254
+ end
231
255
  out << :sinatra if framework_available? "sinatra"
232
256
  out << :padrino if framework_available? "padrino"
233
257
  out << :grape if framework_available? "grape"