appsignal 1.4.0.beta.1 → 2.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -17
- data/README.md +6 -5
- data/ext/agent.yml +11 -11
- data/lib/appsignal.rb +20 -19
- data/lib/appsignal/cli.rb +5 -7
- data/lib/appsignal/cli/diagnose.rb +133 -41
- data/lib/appsignal/cli/notify_of_deploy.rb +26 -11
- data/lib/appsignal/config.rb +9 -5
- data/lib/appsignal/integrations/grape.rb +23 -16
- data/lib/appsignal/js_exception_transaction.rb +3 -3
- data/lib/appsignal/marker.rb +4 -3
- data/lib/appsignal/rack/js_exception_catcher.rb +11 -4
- data/lib/appsignal/utils.rb +0 -12
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/capistrano2_spec.rb +7 -7
- data/spec/lib/appsignal/capistrano3_spec.rb +7 -7
- data/spec/lib/appsignal/cli/diagnose_spec.rb +329 -22
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +144 -96
- data/spec/lib/appsignal/cli_spec.rb +1 -18
- data/spec/lib/appsignal/config_spec.rb +27 -2
- data/spec/lib/appsignal/hooks/rake_spec.rb +35 -52
- data/spec/lib/appsignal/integrations/grape_spec.rb +172 -63
- data/spec/lib/appsignal/js_exception_transaction_spec.rb +76 -36
- data/spec/lib/appsignal/marker_spec.rb +5 -5
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +49 -9
- data/spec/lib/appsignal_spec.rb +18 -7
- data/spec/support/helpers/cli_helpers.rb +17 -0
- data/spec/support/helpers/env_helpers.rb +2 -1
- metadata +5 -6
- data/lib/appsignal/params_sanitizer.rb +0 -13
- data/lib/tasks/diag.rake +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bd8b67588b72996acb6016ff9a28589ab689b5a
|
4
|
+
data.tar.gz: e0ec44916657760600ecf1651c155357c1e67ecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42daf7247c1e35d895d639f3a783ffc607bd546a982e5538bbbbb19f946a01d102eee6c34e8dd409488428df3c4daf4df88f92eb2982de14c2c0a4fea1faef47
|
7
|
+
data.tar.gz: 500b07c6fb90f6d01320ee14ecad8c1d43cf9182b1bec88b92dbc7b55c1992ab503834930e52720d7665503b13025546e9b3564776e8ff7eaffff956aed2fb43
|
data/CHANGELOG.md
CHANGED
@@ -1,22 +1,45 @@
|
|
1
|
-
#
|
2
|
-
* Add Appsignal.instrument_sql convenience methods
|
3
|
-
* Use Appsignal.instrument internally instead of
|
4
|
-
|
5
|
-
*
|
6
|
-
*
|
7
|
-
|
8
|
-
*
|
9
|
-
*
|
10
|
-
|
1
|
+
# 2.0.0
|
2
|
+
* Add `Appsignal.instrument_sql` convenience methods. PR #136
|
3
|
+
* Use `Appsignal.instrument` internally instead of ActiveSupport
|
4
|
+
instrumentation. PR #142
|
5
|
+
* Override ActiveSupport instrument instead of subscribing. PR #150
|
6
|
+
* Remove required dependency on ActiveSupport. Recommended you use
|
7
|
+
`Appsignal.instrument` if you don't need `ActiveSupport`. PR #150 #142
|
8
|
+
* Use have_library to link the AppSignal extension `libappsignal`. PR #148
|
9
|
+
* Rename `appsignal_extension.h` to `appsignal.h`.
|
10
|
+
Commit 9ed7c8d83f622d5a79c5c21d352b3360fd7e8113
|
11
|
+
* Refactor rescuing of Exception. PR #173
|
12
|
+
* Use GC::Profiler to track garbage collection time. PR #134
|
13
|
+
* Detect if AppSignal is running in a container or Heroku. PR #177 #178
|
14
|
+
* Change configuration load order to load environment settings after
|
15
|
+
`appsignal.yml`. PR #178
|
16
|
+
* Speed up payload generation by letting the extension handle it. PR #175
|
17
|
+
* Improve `appsignal diagnose` formatting and output more data. PR #187
|
18
|
+
* Remove outdated `appsignal:diagnose` rake tasks. Use `appsignal diagnose`
|
19
|
+
instead. PR #193
|
20
|
+
* Fix JavaScript exception without names resulting in errors themselves. PR #188
|
21
|
+
* Support namespaces in Grape routes. PR #189
|
22
|
+
* Change STDOUT output to always mention "AppSignal", not "Appsignal". PR #192
|
23
|
+
* `appsignal notify_of_deploy` refactor. `--name` will override any
|
24
|
+
other `name` config. `--environment` is only required if it's not set in the
|
25
|
+
environment. PR #194
|
26
|
+
* Allow logging to STDOUT. Available for the Ruby gem and C extension. The
|
27
|
+
`appsignal-agent` process will continue log to file. PR #190
|
28
|
+
* Remove deprecated methods. PR #191
|
29
|
+
* Send "ruby" implementation name with version number for better identifying
|
30
|
+
different language implementations. PR #198
|
11
31
|
|
12
32
|
# 1.3.6
|
13
|
-
* Support blocks arguments on method instrumentation
|
14
|
-
* Support `APPSIGNAL_APP_ENV` for Sinatra
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
19
|
-
* Support for
|
33
|
+
* Support blocks arguments on method instrumentation. PR #163
|
34
|
+
* Support `APPSIGNAL_APP_ENV` for Sinatra. PR #164
|
35
|
+
* Remove Sinatra install step from "appsignal install". PR #165
|
36
|
+
* Install Capistrano integration in `Capfile` instead of `deploy.rb`. #166
|
37
|
+
* More robust handing of non-writable log files. PR #160 #158
|
38
|
+
* Cleaner internal exception handling. PR #169 #170 #171 #172 #173
|
39
|
+
* Support for mixed case keywords in sql lexing. appsignal/sql_lexer#8
|
40
|
+
* Support for inserting multiple rows in sql lexing. appsignal/sql_lexer#9
|
41
|
+
* Add session_overview to JS transaction data.
|
42
|
+
Commit af2d365bc124c01d7e9363e8d825404027835765
|
20
43
|
|
21
44
|
# 1.3.5
|
22
45
|
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
AppSignal agent
|
2
|
-
=================
|
1
|
+
# AppSignal agent
|
3
2
|
|
4
|
-
This gem collects error and performance data from your
|
5
|
-
applications and sends it to [AppSignal](https://appsignal.com)
|
3
|
+
This gem collects error and performance data from your Ruby
|
4
|
+
applications and sends it to [AppSignal](https://appsignal.com).
|
5
|
+
|
6
|
+
- [Documentation](http://docs.appsignal.com/)
|
6
7
|
|
7
8
|
[![Build Status](https://travis-ci.org/appsignal/appsignal-ruby.png?branch=master)](https://travis-ci.org/appsignal/appsignal-ruby)
|
8
9
|
[![Gem Version](https://badge.fury.io/rb/appsignal.svg)](http://badge.fury.io/rb/appsignal)
|
@@ -43,7 +44,7 @@ If you have either Rvm or Rbenv installed you can also use
|
|
43
44
|
`rake generate_bundle_and_spec_all` to generate a script that runs specs for
|
44
45
|
all Ruby versions and gem combinations we support.
|
45
46
|
|
46
|
-
|
47
|
+
We run the suite against all of the Gemfiles mentioned above and on
|
47
48
|
a number of different Ruby versions.
|
48
49
|
|
49
50
|
## Branches and versions
|
data/ext/agent.yml
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: f727d42
|
3
3
|
triples:
|
4
4
|
x86_64-linux:
|
5
|
-
checksum:
|
6
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
5
|
+
checksum: 9dd455ca74b1785b3e84b8c76f8e1c111a5f0c46395952521a092dee4e2990cf
|
6
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f727d42/appsignal-x86_64-linux-all-static.tar.gz
|
7
7
|
i686-linux:
|
8
|
-
checksum:
|
9
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
8
|
+
checksum: 9404f8af277271d67f82fc6b4662b8c41a06c49199673a419d4ef89e154bc3e7
|
9
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f727d42/appsignal-i686-linux-all-static.tar.gz
|
10
10
|
x86-linux:
|
11
|
-
checksum:
|
12
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
11
|
+
checksum: 9404f8af277271d67f82fc6b4662b8c41a06c49199673a419d4ef89e154bc3e7
|
12
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f727d42/appsignal-i686-linux-all-static.tar.gz
|
13
13
|
x86_64-darwin:
|
14
|
-
checksum:
|
15
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
14
|
+
checksum: feba9c23da6a7121679c992f5c542fe22e39e83985870c4f6f69e5841c0afeb8
|
15
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f727d42/appsignal-x86_64-darwin-all-static.tar.gz
|
16
16
|
universal-darwin:
|
17
|
-
checksum:
|
18
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
17
|
+
checksum: feba9c23da6a7121679c992f5c542fe22e39e83985870c4f6f69e5841c0afeb8
|
18
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/f727d42/appsignal-x86_64-darwin-all-static.tar.gz
|
data/lib/appsignal.rb
CHANGED
@@ -236,33 +236,26 @@ module Appsignal
|
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
239
|
-
def start_logger(path_arg=nil)
|
240
|
-
|
241
|
-
|
242
|
-
begin
|
243
|
-
@logger = Logger.new(path)
|
244
|
-
@logger.formatter = log_formatter
|
245
|
-
rescue SystemCallError => error
|
246
|
-
start_stdout_logger
|
247
|
-
logger.warn "appsignal: Unable to start logger with log path '#{path}'."
|
248
|
-
logger.warn "appsignal: #{error}"
|
249
|
-
end
|
239
|
+
def start_logger(path_arg = nil)
|
240
|
+
if config && config[:log] == "file" && config.log_file_path
|
241
|
+
start_file_logger(config.log_file_path)
|
250
242
|
else
|
251
243
|
start_stdout_logger
|
252
244
|
end
|
253
245
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
246
|
+
logger.level =
|
247
|
+
if config && config[:debug]
|
248
|
+
Logger::DEBUG
|
249
|
+
else
|
250
|
+
Logger::INFO
|
251
|
+
end
|
259
252
|
|
260
253
|
if in_memory_log
|
261
|
-
|
254
|
+
logger << in_memory_log.string
|
262
255
|
end
|
263
256
|
|
264
257
|
if path_arg
|
265
|
-
|
258
|
+
logger.info('Setting the path in start_logger has no effect anymore, set it in the config instead')
|
266
259
|
end
|
267
260
|
end
|
268
261
|
|
@@ -301,6 +294,15 @@ module Appsignal
|
|
301
294
|
"appsignal: #{msg}\n"
|
302
295
|
end
|
303
296
|
end
|
297
|
+
|
298
|
+
def start_file_logger(path)
|
299
|
+
@logger = Logger.new(path)
|
300
|
+
@logger.formatter = log_formatter
|
301
|
+
rescue SystemCallError => error
|
302
|
+
start_stdout_logger
|
303
|
+
logger.warn "appsignal: Unable to start logger with log path '#{path}'."
|
304
|
+
logger.warn "appsignal: #{error}"
|
305
|
+
end
|
304
306
|
end
|
305
307
|
end
|
306
308
|
|
@@ -312,7 +314,6 @@ require 'appsignal/event_formatter'
|
|
312
314
|
require 'appsignal/hooks'
|
313
315
|
require 'appsignal/marker'
|
314
316
|
require 'appsignal/minutely'
|
315
|
-
require 'appsignal/params_sanitizer'
|
316
317
|
require 'appsignal/garbage_collection_profiler'
|
317
318
|
require 'appsignal/integrations/railtie' if defined?(::Rails)
|
318
319
|
require 'appsignal/integrations/resque'
|
data/lib/appsignal/cli.rb
CHANGED
@@ -11,12 +11,10 @@ module Appsignal
|
|
11
11
|
AVAILABLE_COMMANDS = %w(diagnose install notify_of_deploy).freeze
|
12
12
|
|
13
13
|
class << self
|
14
|
-
attr_accessor :options
|
15
|
-
attr_writer :config
|
14
|
+
attr_accessor :options
|
16
15
|
|
17
16
|
def run(argv=ARGV)
|
18
17
|
@options = {}
|
19
|
-
@initial_config = {}
|
20
18
|
global = global_option_parser
|
21
19
|
commands = command_option_parser
|
22
20
|
global.order!(argv)
|
@@ -30,7 +28,7 @@ module Appsignal
|
|
30
28
|
when :install
|
31
29
|
Appsignal::CLI::Install.run(argv.shift, config)
|
32
30
|
when :notify_of_deploy
|
33
|
-
Appsignal::CLI::NotifyOfDeploy.run(options
|
31
|
+
Appsignal::CLI::NotifyOfDeploy.run(options)
|
34
32
|
end
|
35
33
|
else
|
36
34
|
puts "Command '#{command}' does not exist, run appsignal -h to "\
|
@@ -48,7 +46,7 @@ module Appsignal
|
|
48
46
|
Appsignal::Config.new(
|
49
47
|
Dir.pwd,
|
50
48
|
options[:environment],
|
51
|
-
|
49
|
+
{},
|
52
50
|
Logger.new(StringIO.new)
|
53
51
|
)
|
54
52
|
end
|
@@ -58,7 +56,7 @@ module Appsignal
|
|
58
56
|
o.banner = 'Usage: appsignal <command> [options]'
|
59
57
|
|
60
58
|
o.on '-v', '--version', "Print version and exit" do |arg|
|
61
|
-
puts "
|
59
|
+
puts "AppSignal #{Appsignal::VERSION}"
|
62
60
|
exit(0)
|
63
61
|
end
|
64
62
|
|
@@ -92,7 +90,7 @@ module Appsignal
|
|
92
90
|
end
|
93
91
|
|
94
92
|
o.on '--name=<name>', "The name of the app (optional)" do |arg|
|
95
|
-
|
93
|
+
options[:name] = arg
|
96
94
|
end
|
97
95
|
end
|
98
96
|
}
|
@@ -1,80 +1,172 @@
|
|
1
|
+
require "rbconfig"
|
2
|
+
require "bundler/cli"
|
3
|
+
require "bundler/cli/common"
|
4
|
+
|
1
5
|
module Appsignal
|
2
6
|
class CLI
|
3
7
|
class Diagnose
|
4
8
|
class << self
|
5
9
|
def run
|
6
|
-
|
10
|
+
header
|
11
|
+
empty_line
|
12
|
+
|
7
13
|
agent_version
|
14
|
+
empty_line
|
15
|
+
|
16
|
+
host_information
|
17
|
+
empty_line
|
18
|
+
|
8
19
|
start_appsignal
|
9
20
|
config
|
21
|
+
empty_line
|
22
|
+
|
10
23
|
check_api_key
|
24
|
+
empty_line
|
25
|
+
|
11
26
|
paths_writable
|
12
|
-
|
13
|
-
end
|
27
|
+
empty_line
|
14
28
|
|
15
|
-
|
16
|
-
puts "Gem version: #{Appsignal::VERSION}"
|
29
|
+
log_files
|
17
30
|
end
|
18
31
|
|
19
|
-
|
20
|
-
|
32
|
+
private
|
33
|
+
|
34
|
+
def empty_line
|
35
|
+
puts "\n"
|
21
36
|
end
|
22
37
|
|
23
38
|
def start_appsignal
|
24
39
|
Appsignal.start
|
40
|
+
return if config?
|
41
|
+
|
42
|
+
puts "Error: No config found!"
|
43
|
+
puts "Could not start AppSignal."
|
44
|
+
end
|
45
|
+
|
46
|
+
def header
|
47
|
+
puts "AppSignal diagnose"
|
48
|
+
puts "=" * 80
|
49
|
+
puts "Use this information to debug your configuration."
|
50
|
+
puts "More information is available on the documentation site."
|
51
|
+
puts "http://docs.appsignal.com/"
|
52
|
+
puts "Send this output to support@appsignal.com if you need help."
|
53
|
+
puts "=" * 80
|
54
|
+
end
|
55
|
+
|
56
|
+
def agent_version
|
57
|
+
puts "AppSignal agent"
|
58
|
+
puts " Gem version: #{Appsignal::VERSION}"
|
59
|
+
puts " Agent version: #{Appsignal::Extension.agent_version}"
|
60
|
+
puts " Gem install path: #{gem_path}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def host_information
|
64
|
+
rbconfig = RbConfig::CONFIG
|
65
|
+
puts "Host information"
|
66
|
+
puts " Architecture: #{rbconfig["host_cpu"]}"
|
67
|
+
puts " Operating System: #{rbconfig["host_os"]}"
|
68
|
+
puts " Ruby version: #{rbconfig["RUBY_VERSION_NAME"]}"
|
69
|
+
puts " Heroku: true" if Appsignal::System.heroku?
|
70
|
+
if Appsignal::System.container?
|
71
|
+
puts " Container id: #{Appsignal::System::Container.id}"
|
72
|
+
end
|
25
73
|
end
|
26
74
|
|
27
75
|
def config
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
76
|
+
puts "Configuration"
|
77
|
+
return unless config?
|
78
|
+
environment
|
79
|
+
|
80
|
+
Appsignal.config.config_hash.each do |key, value|
|
81
|
+
puts " #{key}: #{value}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def environment
|
86
|
+
env = Appsignal.config.env
|
87
|
+
puts " Environment: #{env}"
|
88
|
+
if env == ""
|
89
|
+
puts " Warning: No environment set, no config loaded!"
|
90
|
+
puts " Please make sure appsignal diagnose is run within your "
|
91
|
+
puts " project directory with an environment."
|
92
|
+
puts " APPSIGNAL_APP_ENV=production appsignal diagnose"
|
32
93
|
end
|
33
94
|
end
|
34
95
|
|
35
96
|
def paths_writable
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
97
|
+
puts "Required paths"
|
98
|
+
return unless config?
|
99
|
+
|
100
|
+
possible_paths = {
|
101
|
+
:root_path => Appsignal.config.root_path,
|
102
|
+
:log_file_path => Appsignal.config.log_file_path
|
103
|
+
}
|
104
|
+
|
105
|
+
possible_paths.each do |name, path|
|
106
|
+
result = "Not writable"
|
107
|
+
if path
|
108
|
+
if !File.exist? path
|
109
|
+
result = "Does not exist"
|
110
|
+
elsif File.writable? path
|
111
|
+
result = "Writable"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
puts " #{name}: #{path.to_s.inspect} - #{result}"
|
46
115
|
end
|
47
|
-
puts "\n"
|
48
116
|
end
|
49
117
|
|
50
118
|
def check_api_key
|
51
|
-
start_appsignal
|
52
119
|
auth_check = ::Appsignal::AuthCheck.new(Appsignal.config, Appsignal.logger)
|
53
|
-
|
54
|
-
|
55
|
-
|
120
|
+
print "Validating API key: "
|
121
|
+
status, error = auth_check.perform_with_result
|
122
|
+
case status
|
123
|
+
when "200"
|
124
|
+
print "Valid"
|
125
|
+
when "401"
|
126
|
+
print "Invalid"
|
56
127
|
else
|
57
|
-
|
128
|
+
print "Failed with status #{status}\n"
|
129
|
+
puts error if error
|
58
130
|
end
|
131
|
+
empty_line
|
59
132
|
end
|
60
133
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
134
|
+
def log_files
|
135
|
+
install_log
|
136
|
+
empty_line
|
137
|
+
mkmf_log
|
138
|
+
end
|
139
|
+
|
140
|
+
def install_log
|
141
|
+
install_log_path = File.join(gem_path, "ext", "install.log")
|
142
|
+
puts "Extension install log"
|
143
|
+
output_log_file install_log_path
|
144
|
+
end
|
145
|
+
|
146
|
+
def mkmf_log
|
147
|
+
mkmf_log_path = File.join(gem_path, "ext", "mkmf.log")
|
148
|
+
puts "Makefile install log"
|
149
|
+
output_log_file mkmf_log_path
|
150
|
+
end
|
151
|
+
|
152
|
+
def output_log_file(log_file)
|
153
|
+
puts " Path: #{log_file.to_s.inspect}"
|
154
|
+
if File.exist? log_file
|
155
|
+
puts " Contents:"
|
156
|
+
puts File.read(log_file)
|
74
157
|
else
|
75
|
-
puts "
|
158
|
+
puts " File not found."
|
76
159
|
end
|
77
160
|
end
|
161
|
+
|
162
|
+
def gem_path
|
163
|
+
@gem_path ||= \
|
164
|
+
Bundler::CLI::Common.select_spec("appsignal").full_gem_path.strip
|
165
|
+
end
|
166
|
+
|
167
|
+
def config?
|
168
|
+
Appsignal.config
|
169
|
+
end
|
78
170
|
end
|
79
171
|
end
|
80
172
|
end
|