appsignal 3.12.4 → 3.12.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55c5f8214152a089df3ea8e904bbaa3c16a96da32b8951afdedeb89483315879
4
- data.tar.gz: eca58188431742cd4d2b3e188c8fc4250cd794608d2b672f4f8d632d7643c4b1
3
+ metadata.gz: d54d86a604df3df8944cf99dcd63dfe9b337c829543f5d80ce5f6d507ff80dd9
4
+ data.tar.gz: 39137b4064d8cd060ef32ce59ca7fe1e66066179673d44ef099af149908feb66
5
5
  SHA512:
6
- metadata.gz: e1d0e1b466c4718de341408f199a8946c232e7a954df2e88dea822b287e0c39585f6c33f596b7c038256f41537b41e0d6990d8f5b7de0c80245de7acf1d9aed0
7
- data.tar.gz: 24a5d159c09b937c227e23dbc5f2d1cdda6c3e1d3161d8bc5ccf36522eb78d43c999ab95def794dea3f7ea3183654dc770842b04d6b0de37153b5902f2c33454
6
+ metadata.gz: e4073b5455f88773ea180fecd94bf79878d845241d2b614a5c3cf7d3485d9ea300962c838721f44b5ebeeb2cb8ebe9593056d74d0072f22a515ed8b075022740
7
+ data.tar.gz: 666e8ff6f6ceb7526c40be3b6cd6b8082209181644fe2538ca3a587b2299a71330210dfaea59656075707a112addbf8f5e96cce224f24db7afb5bf10048812db
data/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.12.6
4
+
5
+ _Published on 2024-08-05._
6
+
7
+ ### Changed
8
+
9
+ - Configure AppSignal with the install CLI when no known frameworks is found. Automate the configure step so that this doesn't have to be done manually along with the manual setup for the app. (patch [a9c546fa](https://github.com/appsignal/appsignal-ruby/commit/a9c546fa86afbec290cd8439a559bf60cad21fc8))
10
+
11
+ ### Deprecated
12
+
13
+ - Deprecate the `Appsignal.listen_for_error` helper. Use a manual error rescue with `Appsignal.report_error`. This method allows for more customization of the reported error.
14
+
15
+ ```ruby
16
+ # Before
17
+ Appsignal.listen_for_error do
18
+ raise "some error"
19
+ end
20
+
21
+ begin
22
+ raise "some error"
23
+ rescue => error
24
+ Appsignal.report_error(error)
25
+ end
26
+ ```
27
+
28
+ Read our [Exception handling guide](https://docs.appsignal.com/ruby/instrumentation/exception-handling.html) for more information.
29
+
30
+ (patch [14bd8882](https://github.com/appsignal/appsignal-ruby/commit/14bd88824dea2993cb0165bbbed0def29d69f72a))
31
+ - Deprecate the `Appsignal.configure`'s `app_path` writer. Use the `Appsignal.configure`'s `root_path` keyword argument to configure the path. (patch [c79f46c3](https://github.com/appsignal/appsignal-ruby/commit/c79f46c3cd96ac51726a963f38999bfb3c246d52))
32
+
33
+ ### Fixed
34
+
35
+ - Fix an error on the Padrino require in the installer CLI. The latest Padrino version will crash the installer on load. Ignore the error when it fails to load. (patch [dfe23707](https://github.com/appsignal/appsignal-ruby/commit/dfe23707f769ff818714ee7cf14340f9472ce2e4))
36
+ - Fix the `Appsignal.configure` path config not being customizable. It's now possible to pass a `root_path` keyword argument to `Appsignal.configure` to customize the path from which AppSignal reads the config file, `config/appsignal.yml`. (patch [c79f46c3](https://github.com/appsignal/appsignal-ruby/commit/c79f46c3cd96ac51726a963f38999bfb3c246d52))
37
+
38
+ ## 3.12.5
39
+
40
+ _Published on 2024-08-01._
41
+
42
+ ### Changed
43
+
44
+ - Improve sanitization of INSERT INTO ... VALUES with multiple groups by removing additional repeated groups.
45
+
46
+ This makes the query easier to read, and mitigates an issue where processing many events with slightly distinct queries would cause some event details to de discarded.
47
+
48
+ (patch [45a20433](https://github.com/appsignal/appsignal-ruby/commit/45a20433fc7ead962d998f4218d0904cfb501a7c))
49
+
50
+ ### Fixed
51
+
52
+ - Fix issue sanitizing SQL queries containing TRUE and FALSE values in an INSERT INTO ... VALUES clause. (patch [45a20433](https://github.com/appsignal/appsignal-ruby/commit/45a20433fc7ead962d998f4218d0904cfb501a7c))
53
+
3
54
  ## 3.12.4
4
55
 
5
56
  _Published on 2024-08-01._
data/ext/agent.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # Modifications to this file will be overwritten with the next agent release.
7
7
 
8
8
  APPSIGNAL_AGENT_CONFIG = {
9
- "version" => "0.35.12",
9
+ "version" => "0.35.19",
10
10
  "mirrors" => [
11
11
  "https://appsignal-agent-releases.global.ssl.fastly.net",
12
12
  "https://d135dj0rjqvssy.cloudfront.net"
@@ -14,131 +14,131 @@ APPSIGNAL_AGENT_CONFIG = {
14
14
  "triples" => {
15
15
  "x86_64-darwin" => {
16
16
  "static" => {
17
- "checksum" => "61210c40be70e0616a356d06040961b096e2d47332021a52f3779912a9fe0e4c",
17
+ "checksum" => "0d465ca77500f7e9675d262a5ccd277fc3428821ac96f973b9941ad49a300ea9",
18
18
  "filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
19
19
  },
20
20
  "dynamic" => {
21
- "checksum" => "dd165289445c80e4dcc148ea09c613b23b001c90ad885aef1de08db65ab5bf1c",
21
+ "checksum" => "ff1b90c3c52e5b765dc8c43b2c0fe376a06101134ec5879d581642ed6837603e",
22
22
  "filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
23
23
  }
24
24
  },
25
25
  "universal-darwin" => {
26
26
  "static" => {
27
- "checksum" => "61210c40be70e0616a356d06040961b096e2d47332021a52f3779912a9fe0e4c",
27
+ "checksum" => "0d465ca77500f7e9675d262a5ccd277fc3428821ac96f973b9941ad49a300ea9",
28
28
  "filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
29
29
  },
30
30
  "dynamic" => {
31
- "checksum" => "dd165289445c80e4dcc148ea09c613b23b001c90ad885aef1de08db65ab5bf1c",
31
+ "checksum" => "ff1b90c3c52e5b765dc8c43b2c0fe376a06101134ec5879d581642ed6837603e",
32
32
  "filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
33
33
  }
34
34
  },
35
35
  "aarch64-darwin" => {
36
36
  "static" => {
37
- "checksum" => "9b97c42561450f9af9ae63816d32b8db69be6f2745226f63d6eada4369c68a20",
37
+ "checksum" => "7c735e7490d9d5313e76a0e0508f85983c98caceb0507afa3d8d34bb3b740627",
38
38
  "filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
39
39
  },
40
40
  "dynamic" => {
41
- "checksum" => "0c81959ab5de3c98c70b7e308826d7deee8e208ee47b7637d505b0a1d70af8c4",
41
+ "checksum" => "c29689978f56904771c6caa151a35d8bea3ba4002b6e767ddc102f82d9909fa2",
42
42
  "filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
43
43
  }
44
44
  },
45
45
  "arm64-darwin" => {
46
46
  "static" => {
47
- "checksum" => "9b97c42561450f9af9ae63816d32b8db69be6f2745226f63d6eada4369c68a20",
47
+ "checksum" => "7c735e7490d9d5313e76a0e0508f85983c98caceb0507afa3d8d34bb3b740627",
48
48
  "filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
49
49
  },
50
50
  "dynamic" => {
51
- "checksum" => "0c81959ab5de3c98c70b7e308826d7deee8e208ee47b7637d505b0a1d70af8c4",
51
+ "checksum" => "c29689978f56904771c6caa151a35d8bea3ba4002b6e767ddc102f82d9909fa2",
52
52
  "filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
53
53
  }
54
54
  },
55
55
  "arm-darwin" => {
56
56
  "static" => {
57
- "checksum" => "9b97c42561450f9af9ae63816d32b8db69be6f2745226f63d6eada4369c68a20",
57
+ "checksum" => "7c735e7490d9d5313e76a0e0508f85983c98caceb0507afa3d8d34bb3b740627",
58
58
  "filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
59
59
  },
60
60
  "dynamic" => {
61
- "checksum" => "0c81959ab5de3c98c70b7e308826d7deee8e208ee47b7637d505b0a1d70af8c4",
61
+ "checksum" => "c29689978f56904771c6caa151a35d8bea3ba4002b6e767ddc102f82d9909fa2",
62
62
  "filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
63
63
  }
64
64
  },
65
65
  "aarch64-linux" => {
66
66
  "static" => {
67
- "checksum" => "358db07cfa85d6bd048bd2bb05fc9607d4fe0d4396fd023d658e945e4a675fba",
67
+ "checksum" => "6ed44186487547614b1a2d4f1c2fea4676f2b5829c8949ad86ca61a66db716e7",
68
68
  "filename" => "appsignal-aarch64-linux-all-static.tar.gz"
69
69
  },
70
70
  "dynamic" => {
71
- "checksum" => "9e76651d52f78882ab126d94a8af61794d1ce0cdffa6dd01a3e032599a1b2796",
71
+ "checksum" => "775399b3b559f1c8bd931fb835a88dee012fb62d580584b8e6f4d40ea24f6a0a",
72
72
  "filename" => "appsignal-aarch64-linux-all-dynamic.tar.gz"
73
73
  }
74
74
  },
75
75
  "i686-linux" => {
76
76
  "static" => {
77
- "checksum" => "315bf1fc5d9c97b6f26e61f5e39919e0ba425b1d96ea6243cdb2f650487c407e",
77
+ "checksum" => "608b8de770ddc9cbc9cae16f793c630079d640b3b77f3af2f854de474e8ef5de",
78
78
  "filename" => "appsignal-i686-linux-all-static.tar.gz"
79
79
  },
80
80
  "dynamic" => {
81
- "checksum" => "8cf0b5e6ef70a7758b98457012bfebb7964acb2d47648f3817c9f32a70bc0ab1",
81
+ "checksum" => "87e893f27ec2128d953c65c46dd0136a0dfab50eab18ec2a3a47cfff8068ca89",
82
82
  "filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
83
83
  }
84
84
  },
85
85
  "x86-linux" => {
86
86
  "static" => {
87
- "checksum" => "315bf1fc5d9c97b6f26e61f5e39919e0ba425b1d96ea6243cdb2f650487c407e",
87
+ "checksum" => "608b8de770ddc9cbc9cae16f793c630079d640b3b77f3af2f854de474e8ef5de",
88
88
  "filename" => "appsignal-i686-linux-all-static.tar.gz"
89
89
  },
90
90
  "dynamic" => {
91
- "checksum" => "8cf0b5e6ef70a7758b98457012bfebb7964acb2d47648f3817c9f32a70bc0ab1",
91
+ "checksum" => "87e893f27ec2128d953c65c46dd0136a0dfab50eab18ec2a3a47cfff8068ca89",
92
92
  "filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
93
93
  }
94
94
  },
95
95
  "x86_64-linux" => {
96
96
  "static" => {
97
- "checksum" => "3fe42df2a52706c23f967b8421ac816fa37a38998bd24b1d6aafd59a324b23ff",
97
+ "checksum" => "4499818ce89075c7754e26c8915b452352a155619f2ce648232fad6480638f34",
98
98
  "filename" => "appsignal-x86_64-linux-all-static.tar.gz"
99
99
  },
100
100
  "dynamic" => {
101
- "checksum" => "8781f0a4c4810229f19000ebb882b7d8e5e0440ffcf8e5ffea7d68d082be8e69",
101
+ "checksum" => "70b60e4af4c17c569869293680f5d71ea3c3ab2be8a64dfa02421b431f6a5b7b",
102
102
  "filename" => "appsignal-x86_64-linux-all-dynamic.tar.gz"
103
103
  }
104
104
  },
105
105
  "x86_64-linux-musl" => {
106
106
  "static" => {
107
- "checksum" => "1fe0ed0c0ca51eccd4c2ec3bb94bb1834bae19bc2c185b67c3f940f704abe9fc",
107
+ "checksum" => "ed3a557d8ae6aeb15597ff40dce3739c350053a24d163ddc362af20e7e9d4e1c",
108
108
  "filename" => "appsignal-x86_64-linux-musl-all-static.tar.gz"
109
109
  },
110
110
  "dynamic" => {
111
- "checksum" => "f241f905555e17178a72b217dc373ead33daa97757e100b895f2d1318e4dce0d",
111
+ "checksum" => "594cb5216a260f315481e1c6d56af978716f2736653374c3ea52270a355e673d",
112
112
  "filename" => "appsignal-x86_64-linux-musl-all-dynamic.tar.gz"
113
113
  }
114
114
  },
115
115
  "aarch64-linux-musl" => {
116
116
  "static" => {
117
- "checksum" => "5027782008872f8091608cc5531a6dd90f0652e9ebb0404f7e86eb73f0807ba0",
117
+ "checksum" => "f18731c7c549cf635ec8b040c3dbd3cdc3285f0e240c2790a8c8003e0ff7cbee",
118
118
  "filename" => "appsignal-aarch64-linux-musl-all-static.tar.gz"
119
119
  },
120
120
  "dynamic" => {
121
- "checksum" => "ae3147790f25cef200142f61eb6ce1f8b3ac5fa2647ad7a4234f1bbb976bde98",
121
+ "checksum" => "e7bb93dba7975920539e7d270752c690de9e1e292da5f9b2c0e66863b0c8caf7",
122
122
  "filename" => "appsignal-aarch64-linux-musl-all-dynamic.tar.gz"
123
123
  }
124
124
  },
125
125
  "x86_64-freebsd" => {
126
126
  "static" => {
127
- "checksum" => "1337268caaddd66bb170298968d50d76cc66f17e808c46a677ba00d1b78eb317",
127
+ "checksum" => "fa2c007ca5cb40ac75b7c147d18460edcb0d948648286debc03d4f5afda469f1",
128
128
  "filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
129
129
  },
130
130
  "dynamic" => {
131
- "checksum" => "2b93af244d1d214b59c2657677bf96445f67cade2fa1bfd6cda78c8bec75cbca",
131
+ "checksum" => "e0e3b59374e7b32eefcc7877a81d0d4d3bcf0d756d7e8cbff3a44444506fa00c",
132
132
  "filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
133
133
  }
134
134
  },
135
135
  "amd64-freebsd" => {
136
136
  "static" => {
137
- "checksum" => "1337268caaddd66bb170298968d50d76cc66f17e808c46a677ba00d1b78eb317",
137
+ "checksum" => "fa2c007ca5cb40ac75b7c147d18460edcb0d948648286debc03d4f5afda469f1",
138
138
  "filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
139
139
  },
140
140
  "dynamic" => {
141
- "checksum" => "2b93af244d1d214b59c2657677bf96445f67cade2fa1bfd6cda78c8bec75cbca",
141
+ "checksum" => "e0e3b59374e7b32eefcc7877a81d0d4d3bcf0d756d7e8cbff3a44444506fa00c",
142
142
  "filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
143
143
  }
144
144
  }
@@ -18,16 +18,16 @@ module Appsignal
18
18
  $stdout.sync = true
19
19
 
20
20
  puts
21
- puts colorize "#######################################", :green
22
- puts colorize "## Starting AppSignal Installer ##", :green
23
- puts colorize "## --------------------------------- ##", :green
24
- puts colorize "## Need help? support@appsignal.com ##", :green
25
- puts colorize "## Docs? docs.appsignal.com ##", :green
26
- puts colorize "#######################################", :green
21
+ puts colorize "############################################", :green
22
+ puts colorize "## Starting AppSignal Installer ##", :green
23
+ puts colorize "## -------------------------------------- ##", :green
24
+ puts colorize "## Need help? support@appsignal.com ##", :green
25
+ puts colorize "## Docs: https://docs.appsignal.com ##", :green
26
+ puts colorize "############################################", :green
27
27
  puts
28
28
  unless push_api_key
29
29
  puts colorize "Problem encountered:", :red
30
- puts " No push API key entered."
30
+ puts " No Push API key entered."
31
31
  puts " - Sign up for AppSignal and follow the instructions"
32
32
  puts " - Already signed up? Click 'Add app' on the account overview page"
33
33
  puts
@@ -37,22 +37,25 @@ module Appsignal
37
37
  config = new_config
38
38
  config[:push_api_key] = push_api_key
39
39
 
40
- print "Validating API key"
40
+ print "Validating Push API key"
41
41
  periods
42
42
  puts
43
43
  begin
44
44
  auth_check = Appsignal::AuthCheck.new(config)
45
45
  unless auth_check.perform == "200"
46
- puts "\n API key '#{config[:push_api_key]}' is not valid, please get a new one on https://appsignal.com"
46
+ print colorize(" Error:", :red)
47
+ puts " Push API key '#{config[:push_api_key]}' is not valid. " \
48
+ "Please get a new one at https://appsignal.com/accounts"
47
49
  return
48
50
  end
49
51
  rescue => e
50
- puts " There was an error validating your API key:"
52
+ print colorize(" Error:", :red)
53
+ puts "There was an error validating your Push API key:"
51
54
  puts colorize "'#{e}'", :red
52
- puts " Please try again"
55
+ puts " Please check the Push API key and try again"
53
56
  return
54
57
  end
55
- puts colorize " API key valid!", :green
58
+ puts colorize " Push API key valid!", :green
56
59
  puts
57
60
 
58
61
  if installed_frameworks.include?(:rails)
@@ -66,12 +69,7 @@ module Appsignal
66
69
  elsif installed_frameworks.include?(:sinatra)
67
70
  install_for_sinatra(config)
68
71
  else
69
- print colorize "Warning:", :red
70
- puts " We could not detect which framework you are using. " \
71
- "We'd be very grateful if you email us on support@appsignal.com " \
72
- "with information about your setup."
73
- puts
74
- done_notice
72
+ install_for_unknown_framework(config)
75
73
  end
76
74
  end
77
75
 
@@ -119,11 +117,18 @@ module Appsignal
119
117
  puts
120
118
  configure(config, %w[development production staging], true)
121
119
 
122
- puts "Finish Sinatra configuration"
123
- puts " Sinatra requires some manual configuration."
124
- puts " Add this line beneath require 'sinatra':"
120
+ puts "Sinatra installation"
121
+ puts " Sinatra apps requires some manual setup."
122
+ puts " Update the `config.ru` (or the application's main file) to " \
123
+ "look like this:"
124
+ puts
125
+ puts %(require "appsignal")
126
+ puts %(require "sinatra" # or require "sinatra/base")
125
127
  puts
126
- puts " require 'appsignal/integrations/sinatra'"
128
+ puts "Appsignal.load(:sinatra) # Load the Sinatra integration"
129
+ puts "Appsignal.start # Start AppSignal"
130
+ puts
131
+ puts "# Rest of the config.ru file"
127
132
  puts
128
133
  puts " You can find more information in the documentation:"
129
134
  puts " https://docs.appsignal.com/ruby/integrations/sinatra.html"
@@ -137,11 +142,14 @@ module Appsignal
137
142
  puts
138
143
  configure(config, %w[development production staging], true)
139
144
 
140
- puts "Finish Padrino installation"
141
- puts " Padrino requires some manual configuration."
142
- puts " After installing the gem, add the following line to /config/boot.rb:"
145
+ puts "Padrino installation"
146
+ puts " Padrino apps requires some manual setup."
147
+ puts " After installing the gem, add the following lines to `config/boot.rb`:"
148
+ puts
149
+ puts %(require "appsignal")
143
150
  puts
144
- puts " require 'appsignal/integrations/padrino"
151
+ puts "Appsignal.load(:padrino) # Load the Padrino integration"
152
+ puts "Appsignal.start # Start AppSignal"
145
153
  puts
146
154
  puts " You can find more information in the documentation:"
147
155
  puts " https://docs.appsignal.com/ruby/integrations/padrino.html"
@@ -157,7 +165,8 @@ module Appsignal
157
165
 
158
166
  configure(config, %w[development production staging], true)
159
167
 
160
- puts "Manual Grape configuration needed"
168
+ puts "Grape installation"
169
+ puts " Grape apps require some manual setup."
161
170
  puts " See the installation instructions at:"
162
171
  puts " https://docs.appsignal.com/ruby/integrations/grape.html"
163
172
  press_any_key
@@ -170,11 +179,17 @@ module Appsignal
170
179
  puts
171
180
  configure(config, %w[development production staging], true)
172
181
 
173
- puts "Finish Hanami installation"
174
- puts " Hanami requires some manual configuration."
175
- puts " After installing the gem, add the following line to config.ru:"
182
+ puts "Hanami installation"
183
+ puts " Hanami apps requires some manual setup."
184
+ puts " Update the config.ru file to include the following:"
185
+ puts
186
+ puts %( require "appsignal")
187
+ puts %( require "hanami/boot")
176
188
  puts
177
- puts " require 'appsignal/integrations/hanami'"
189
+ puts "Appsignal.load(:hanami) # Load the Hanami integration"
190
+ puts "Appsignal.start # Start AppSignal"
191
+ puts
192
+ puts "# Rest of the config.ru file"
178
193
  puts
179
194
  puts " You can find more information in the documentation:"
180
195
  puts " https://docs.appsignal.com/ruby/integrations/hanami.html"
@@ -197,6 +212,23 @@ module Appsignal
197
212
  puts
198
213
  end
199
214
 
215
+ def install_for_unknown_framework(config)
216
+ puts "Installing"
217
+ config[:name] = required_input(" Enter application name: ")
218
+ puts
219
+ configure(config, %w[development production staging], true)
220
+
221
+ puts colorize "Warning: We could not detect which framework you are using", :red
222
+ puts " Some manual installation is most likely required."
223
+ puts " Please check our documentation for supported libraries: "
224
+ puts " https://docs.appsignal.com/ruby/integrations.html"
225
+ puts
226
+ puts " We'd be very grateful if you email us on " \
227
+ "support@appsignal.com with information about your setup."
228
+ press_any_key
229
+ done_notice
230
+ end
231
+
200
232
  def configure(config, environments, name_overwritten)
201
233
  install_for_capistrano
202
234
 
@@ -240,29 +272,27 @@ module Appsignal
240
272
  end
241
273
 
242
274
  def done_notice
243
- sleep 0.3
244
- puts colorize "#####################################", :green
245
- puts colorize "## AppSignal installation complete ##", :green
246
- puts colorize "#####################################", :green
247
- sleep 0.3
248
- puts
249
275
  if Gem.win_platform?
250
- puts "The AppSignal agent currently does not work on Microsoft " \
276
+ print colorize "Warning:", :red
277
+ puts " The AppSignal agent currently does not work on Microsoft " \
251
278
  "Windows. Please push these changes to your staging/production " \
252
279
  "environment and make sure some actions are performed. " \
253
- "AppSignal should pick up your app after a few minutes."
280
+ "AppSignal will pick up your app after a few minutes."
254
281
  else
255
- puts " Sending example data to AppSignal..."
282
+ puts "Sending example data to AppSignal..."
256
283
  if Appsignal::Demo.transmit
257
284
  puts " Example data sent!"
258
285
  puts " It may take about a minute for the data to appear on https://appsignal.com/accounts"
259
- puts
260
- puts " Please return to your browser and follow the instructions."
261
286
  else
262
- puts " Couldn't start the AppSignal agent and send example data to AppSignal.com"
263
- puts " Please use `appsignal diagnose` to debug your configuration."
287
+ print colorize "Error:", :red
288
+ puts " Couldn't start the AppSignal agent and send example data to AppSignal.com"
289
+ puts " Please contact us at support@appsignal.com and " \
290
+ "send us a diagnose report using `appsignal diagnose`."
291
+ return
264
292
  end
265
293
  end
294
+ puts
295
+ puts "Please return to your browser and follow the instructions."
266
296
  end
267
297
 
268
298
  def installed_frameworks
@@ -281,7 +311,7 @@ module Appsignal
281
311
  def framework_available?(framework_file)
282
312
  require framework_file
283
313
  true
284
- rescue LoadError
314
+ rescue LoadError, NameError
285
315
  false
286
316
  end
287
317
 
@@ -212,7 +212,7 @@ module Appsignal
212
212
  # Initialize a new configuration object for AppSignal.
213
213
  #
214
214
  # @param root_path [String] Root path of the app.
215
- # @param env [String] The environment to load when AppSignal is started. It
215
+ # @param initial_env [String] The environment to load when AppSignal is started. It
216
216
  # will look for an environment with this name in the `config/appsignal.yml`
217
217
  # config file.
218
218
  # @param initial_config [Hash<String, Object>] The initial configuration to
@@ -622,8 +622,12 @@ module Appsignal
622
622
  @config.root_path
623
623
  end
624
624
 
625
- def app_path=(path)
626
- @config.root_path = path
625
+ def app_path=(_path)
626
+ Appsignal::Utils::StdoutAndLoggerMessage.warning \
627
+ "The `Appsignal.configure`'s `app_path=` writer is deprecated " \
628
+ "and can no longer be used to set the root path. " \
629
+ "Use the `Appsignal.configure`'s method `root_path` keyword argument " \
630
+ "to set the root path."
627
631
  end
628
632
 
629
633
  def env
@@ -309,6 +309,11 @@ module Appsignal
309
309
  tags = nil,
310
310
  namespace = Appsignal::Transaction::HTTP_REQUEST
311
311
  )
312
+ stdout_and_logger_warning \
313
+ "The `Appsignal.listen_for_error` helper is deprecated. " \
314
+ "Please use `rescue => error` and `Appsignal.report_error` instead. " \
315
+ "Read our exception handling documentation: " \
316
+ "https://docs.appsignal.com/ruby/instrumentation/exception-handling.html"
312
317
  yield
313
318
  rescue Exception => error # rubocop:disable Lint/RescueException
314
319
  send_error(error) do |transaction|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "3.12.4"
4
+ VERSION = "3.12.6"
5
5
  end
data/lib/appsignal.rb CHANGED
@@ -228,24 +228,28 @@ module Appsignal
228
228
  # # Or for the environment given as an argument
229
229
  # Appsignal.configure(:production)
230
230
  #
231
+ # @param env [String, Symbol] The environment to load.
232
+ # @param root_path [String] The path to look the `config/appsignal.yml` config file in.
233
+ # Defaults to the current working directory.
231
234
  # @yield [Config] Gives the {Config} instance to the block.
232
235
  # @return [void]
233
236
  # @see config
234
237
  # @see Config
235
238
  # @see https://docs.appsignal.com/ruby/configuration.html Configuration guide
236
239
  # @see https://docs.appsignal.com/ruby/configuration/options.html Configuration options
237
- def configure(env = nil)
240
+ def configure(env = nil, root_path: nil)
238
241
  if Appsignal.started?
239
242
  Appsignal.internal_logger
240
243
  .warn("AppSignal is already started. Ignoring `Appsignal.configure` call.")
241
244
  return
242
245
  end
243
246
 
244
- if config && (env.nil? || config.env == env.to_s)
247
+ if config && ((env.nil? || config.env == env.to_s) &&
248
+ (root_path.nil? || config.root_path == root_path))
245
249
  config
246
250
  else
247
251
  @config = Config.new(
248
- Config.determine_root_path,
252
+ root_path || Config.determine_root_path,
249
253
  Config.determine_env(env),
250
254
  {},
251
255
  Appsignal.internal_logger,
@@ -30,7 +30,7 @@ describe Appsignal::CLI::Install do
30
30
 
31
31
  define :include_complete_install do
32
32
  match do |actual|
33
- actual.include?("AppSignal installation complete")
33
+ actual.include?("Please return to your browser and follow the instructions.")
34
34
  end
35
35
  end
36
36
 
@@ -105,7 +105,7 @@ describe Appsignal::CLI::Install do
105
105
  run
106
106
 
107
107
  expect(output).to include "Problem encountered:",
108
- "No push API key entered"
108
+ "No Push API key entered"
109
109
  end
110
110
  end
111
111
 
@@ -120,7 +120,7 @@ describe Appsignal::CLI::Install do
120
120
  choose_environment_config
121
121
  run
122
122
 
123
- expect(output).to include("Validating API key...", "API key valid")
123
+ expect(output).to include("Validating Push API key...", "Push API key valid")
124
124
  end
125
125
  end
126
126
 
@@ -129,7 +129,7 @@ describe Appsignal::CLI::Install do
129
129
 
130
130
  it "prints an error" do
131
131
  run
132
- expect(output).to include "API key 'my_key' is not valid"
132
+ expect(output).to include "Push API key 'my_key' is not valid"
133
133
  end
134
134
  end
135
135
 
@@ -140,7 +140,7 @@ describe Appsignal::CLI::Install do
140
140
 
141
141
  it "prints an error" do
142
142
  run
143
- expect(output).to include "There was an error validating your API key"
143
+ expect(output).to include "There was an error validating your Push API key"
144
144
  end
145
145
  end
146
146
  end
@@ -419,14 +419,16 @@ describe Appsignal::CLI::Install do
419
419
  expect(File.exist?(File.join(config_dir, "application.rb"))).to eql(false)
420
420
  end
421
421
 
422
- it "fails the installation" do
422
+ it "falls back on the unknown framework installation" do
423
+ enter_app_name app_name
424
+ choose_environment_config
423
425
  run
424
426
 
425
- expect(output).to include("We could not detect which framework you are using.")
427
+ expect(output)
428
+ .to include("\e[31mWarning: We could not detect which framework you are using\e[0m")
426
429
  expect(output).to_not include("Installing for Ruby on Rails")
430
+ expect(output).to include_env_push_api_key(push_api_key)
427
431
  expect(output).to include_complete_install
428
-
429
- expect(File.exist?(config_file_path)).to be(false)
430
432
  end
431
433
  end
432
434
 
@@ -465,8 +467,10 @@ describe Appsignal::CLI::Install do
465
467
  let(:installation_instructions) do
466
468
  [
467
469
  "Installing for Sinatra",
468
- "Sinatra requires some manual configuration.",
469
- "require 'appsignal/integrations/sinatra'",
470
+ "Sinatra apps requires some manual setup.",
471
+ %(require "appsignal"),
472
+ "Appsignal.load(:sinatra)",
473
+ "Appsignal.start",
470
474
  "https://docs.appsignal.com/ruby/integrations/sinatra.html"
471
475
  ]
472
476
  end
@@ -533,7 +537,10 @@ describe Appsignal::CLI::Install do
533
537
  let(:installation_instructions) do
534
538
  [
535
539
  "Installing for Padrino",
536
- "Padrino requires some manual configuration.",
540
+ "Padrino apps requires some manual setup.",
541
+ %(require "appsignal"),
542
+ "Appsignal.load(:padrino)",
543
+ "Appsignal.start",
537
544
  "https://docs.appsignal.com/ruby/integrations/padrino.html"
538
545
  ]
539
546
  end
@@ -600,7 +607,7 @@ describe Appsignal::CLI::Install do
600
607
  let(:installation_instructions) do
601
608
  [
602
609
  "Installing for Grape",
603
- "Manual Grape configuration needed",
610
+ "Grape apps require some manual setup.",
604
611
  "https://docs.appsignal.com/ruby/integrations/grape.html"
605
612
  ]
606
613
  end
@@ -624,6 +631,7 @@ describe Appsignal::CLI::Install do
624
631
  it "completes the installation" do
625
632
  run
626
633
 
634
+ puts output
627
635
  expect(output).to include(*installation_instructions)
628
636
  expect(output).to include_complete_install
629
637
  end
@@ -667,7 +675,10 @@ describe Appsignal::CLI::Install do
667
675
  let(:installation_instructions) do
668
676
  [
669
677
  "Installing for Hanami",
670
- "Hanami requires some manual configuration.",
678
+ "Hanami apps requires some manual setup.",
679
+ %(require "appsignal"),
680
+ "Appsignal.load(:hanami)",
681
+ "Appsignal.start",
671
682
  "https://docs.appsignal.com/ruby/integrations/hanami.html"
672
683
  ]
673
684
  end
@@ -728,47 +739,109 @@ describe Appsignal::CLI::Install do
728
739
  !hanami2_present?
729
740
  context "with unknown framework" do
730
741
  let(:push_api_key) { "my_key" }
742
+ let(:app_name) { "Test app" }
731
743
 
732
- it_behaves_like "windows installation"
733
744
  it_behaves_like "push_api_key validation"
734
- it_behaves_like "demo data"
745
+ it_behaves_like "requires an application name"
746
+
747
+ describe "unknown framework specific tests" do
748
+ let(:installation_instructions) do
749
+ [
750
+ "Installing",
751
+ "\e[31mWarning: We could not detect which framework you are using\e[0m",
752
+ "Some manual installation is most likely required.",
753
+ "https://docs.appsignal.com/ruby/integrations.html"
754
+ ]
755
+ end
756
+ before { enter_app_name app_name }
735
757
 
736
- context "without color options" do
737
- let(:options) { {} }
758
+ describe "configuration with environment variables" do
759
+ before { choose_environment_config }
738
760
 
739
- it "prints the instructions in color" do
740
- run
741
- expect(output).to have_colorized_text(:green, "## Starting AppSignal Installer ##")
761
+ it_behaves_like "windows installation"
762
+ it_behaves_like "capistrano install"
763
+ it_behaves_like "demo data"
764
+
765
+ it "prints environment variables" do
766
+ run
767
+
768
+ expect(output).to include_env_push_api_key(push_api_key)
769
+ expect(output).to include_env_app_name(app_name)
770
+ end
771
+
772
+ it "completes the installation" do
773
+ run
774
+
775
+ expect(output).to include(*installation_instructions)
776
+ expect(output).to include_complete_install
777
+ end
742
778
  end
743
- end
744
779
 
745
- context "with --color option" do
746
- let(:options) { { "color" => nil } }
780
+ describe "configure with a configuration file" do
781
+ before { choose_config_file }
747
782
 
748
- it "prints the instructions in color" do
749
- run
750
- expect(output).to have_colorized_text(:green, "## Starting AppSignal Installer ##")
783
+ it_behaves_like "windows installation"
784
+ it_behaves_like "capistrano install"
785
+ it_behaves_like "demo data"
786
+
787
+ it "writes configuration to file" do
788
+ run
789
+ expect(output).to include_file_config
790
+ expect(config_file).to configure_app_name(app_name)
791
+ expect(config_file).to configure_push_api_key(push_api_key)
792
+ expect(config_file).to configure_environment("development")
793
+ expect(config_file).to configure_environment("staging")
794
+ expect(config_file).to configure_environment("production")
795
+ end
796
+
797
+ it "completes the installation" do
798
+ run
799
+
800
+ expect(output).to include(*installation_instructions)
801
+ expect(output).to include_complete_install
802
+ end
751
803
  end
752
804
  end
753
805
 
754
- context "with --no-color option" do
755
- let(:options) { { "no-color" => nil } }
806
+ describe "color flag" do
807
+ before do
808
+ enter_app_name "Test app"
809
+ choose_environment_config
810
+ end
756
811
 
757
- it "prints the instructions without special colors" do
758
- run
759
- expect(output).to include("Starting AppSignal Installer")
760
- expect(output).to_not have_color_markers
812
+ context "without color options" do
813
+ let(:options) { {} }
814
+
815
+ it "prints the instructions in color" do
816
+ run
817
+ expect(output).to have_colorized_text(
818
+ :green,
819
+ "## Starting AppSignal Installer ##"
820
+ )
821
+ end
761
822
  end
762
- end
763
823
 
764
- it "prints a message about unknown framework" do
765
- run
824
+ context "with --color option" do
825
+ let(:options) { { "color" => nil } }
766
826
 
767
- expect(output).to include \
768
- "\e[31mWarning:\e[0m We could not detect which framework you are using."
769
- expect(output).to_not include_env_push_api_key
770
- expect(output).to_not include_env_app_name
771
- expect(File.exist?(config_file_path)).to be_falsy
827
+ it "prints the instructions in color" do
828
+ run
829
+ expect(output).to have_colorized_text(
830
+ :green,
831
+ "## Starting AppSignal Installer ##"
832
+ )
833
+ end
834
+ end
835
+
836
+ context "with --no-color option" do
837
+ let(:options) { { "no-color" => nil } }
838
+
839
+ it "prints the instructions without special colors" do
840
+ run
841
+ expect(output).to include("## Starting AppSignal Installer ##")
842
+ expect(output).to_not have_color_markers
843
+ end
844
+ end
772
845
  end
773
846
  end
774
847
  end
@@ -1439,5 +1439,29 @@ describe Appsignal::Config do
1439
1439
 
1440
1440
  expect(dsl.cpu_count).to eq(1.0)
1441
1441
  end
1442
+
1443
+ describe "#app_path=" do
1444
+ it "prints a deprecation warning" do
1445
+ err_stream = std_stream
1446
+ capture_std_streams(std_stream, err_stream) do
1447
+ dsl.app_path = "foo"
1448
+ end
1449
+
1450
+ expect(err_stream.read).to include(
1451
+ "appsignal WARNING: The `Appsignal.configure`'s `app_path=` writer is deprecated"
1452
+ )
1453
+ end
1454
+
1455
+ it "logs a deprecation warning" do
1456
+ logs = capture_logs do
1457
+ silence { dsl.app_path = "foo" }
1458
+ end
1459
+
1460
+ expect(logs).to contains_log(
1461
+ :warn,
1462
+ "The `Appsignal.configure`'s `app_path=` writer is deprecated"
1463
+ )
1464
+ end
1465
+ end
1442
1466
  end
1443
1467
  end
@@ -125,6 +125,28 @@ describe Appsignal do
125
125
  expect(Appsignal.config[:push_api_key]).to eq("key")
126
126
  end
127
127
 
128
+ it "loads a new config if the path is not the same" do
129
+ Appsignal._config = Appsignal::Config.new(
130
+ "/some/path",
131
+ :my_env,
132
+ :name => "Some name",
133
+ :push_api_key => "Some key",
134
+ :ignore_actions => ["My action"]
135
+ )
136
+
137
+ Appsignal.configure(:my_env, :root_path => project_fixture_path) do |config|
138
+ expect(config.ignore_actions).to be_empty
139
+ config.active = true
140
+ config.name = "My app"
141
+ config.push_api_key = "key"
142
+ end
143
+ expect(Appsignal.config.valid?).to be(true)
144
+ expect(Appsignal.config.env).to eq("my_env")
145
+ expect(Appsignal.config[:active]).to be(true)
146
+ expect(Appsignal.config[:name]).to eq("My app")
147
+ expect(Appsignal.config[:push_api_key]).to eq("key")
148
+ end
149
+
128
150
  it "calls configure if not started yet" do
129
151
  Appsignal.configure(:my_env) do |config|
130
152
  config.active = false
@@ -165,6 +187,16 @@ describe Appsignal do
165
187
  expect(Appsignal.config.env).to eq("env_arg")
166
188
  end
167
189
 
190
+ it "uses the given root path to read the config file" do
191
+ Appsignal.configure(:test, :root_path => project_fixture_path)
192
+
193
+ Appsignal.start
194
+ expect(Appsignal.config.env).to eq("test")
195
+ expect(Appsignal.config[:push_api_key]).to eq("abc")
196
+ # Ensure it loads from the config file in the given path
197
+ expect(Appsignal.config.file_config).to_not be_empty
198
+ end
199
+
168
200
  it "loads the config without a block being given" do
169
201
  Dir.chdir project_fixture_path do
170
202
  Appsignal.configure(:test)
@@ -172,6 +204,8 @@ describe Appsignal do
172
204
 
173
205
  expect(Appsignal.config.env).to eq("test")
174
206
  expect(Appsignal.config[:push_api_key]).to eq("abc")
207
+ # Ensure it loads from the config file in the current working directory
208
+ expect(Appsignal.config.file_config).to_not be_empty
175
209
  end
176
210
 
177
211
  it "allows customization of config in the block" do
@@ -1571,6 +1605,24 @@ describe Appsignal do
1571
1605
  describe ".listen_for_error" do
1572
1606
  around { |example| keep_transactions { example.run } }
1573
1607
 
1608
+ it "prints and logs a deprecation warning" do
1609
+ err_stream = std_stream
1610
+ logs =
1611
+ capture_logs do
1612
+ capture_std_streams(std_stream, err_stream) do
1613
+ Appsignal.listen_for_error do
1614
+ # Do nothing
1615
+ end
1616
+ end
1617
+ end
1618
+ expect(err_stream.read)
1619
+ .to include("appsignal WARNING: The `Appsignal.listen_for_error` helper is deprecated.")
1620
+ expect(logs).to contains_log(
1621
+ :warn,
1622
+ "The `Appsignal.listen_for_error` helper is deprecated."
1623
+ )
1624
+ end
1625
+
1574
1626
  it "records the error and re-raise it" do
1575
1627
  expect do
1576
1628
  expect do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.4
4
+ version: 3.12.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-08-01 00:00:00.000000000 Z
13
+ date: 2024-08-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -488,7 +488,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
488
488
  - !ruby/object:Gem::Version
489
489
  version: '0'
490
490
  requirements: []
491
- rubygems_version: 3.3.7
491
+ rubygems_version: 3.5.14
492
492
  signing_key:
493
493
  specification_version: 4
494
494
  summary: Logs performance and exception data from your app to appsignal.com