appsignal 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +22 -0
- data/README.md +9 -5
- data/appsignal.gemspec +1 -1
- data/ext/agent.yml +11 -11
- data/lib/appsignal.rb +8 -9
- data/lib/appsignal/cli.rb +12 -14
- data/lib/appsignal/cli/diagnose.rb +82 -31
- data/lib/appsignal/cli/helpers.rb +67 -0
- data/lib/appsignal/cli/install.rb +22 -69
- data/lib/appsignal/config.rb +3 -3
- data/lib/appsignal/integrations/padrino.rb +1 -1
- data/lib/appsignal/integrations/railtie.rb +1 -1
- data/lib/appsignal/integrations/sinatra.rb +1 -1
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/capistrano2_spec.rb +18 -19
- data/spec/lib/appsignal/capistrano3_spec.rb +16 -17
- data/spec/lib/appsignal/cli/demo_spec.rb +4 -4
- data/spec/lib/appsignal/cli/diagnose_spec.rb +237 -88
- data/spec/lib/appsignal/cli/helpers_spec.rb +99 -0
- data/spec/lib/appsignal/cli/install_spec.rb +486 -352
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +5 -6
- data/spec/lib/appsignal/cli_spec.rb +24 -44
- data/spec/lib/appsignal/config_spec.rb +39 -8
- data/spec/lib/appsignal/demo_spec.rb +13 -8
- data/spec/lib/appsignal/hooks_spec.rb +3 -0
- data/spec/lib/appsignal/integrations/object_spec.rb +35 -26
- data/spec/lib/appsignal/marker_spec.rb +10 -14
- data/spec/lib/appsignal_spec.rb +83 -60
- data/spec/spec_helper.rb +8 -7
- data/spec/support/helpers/cli_helpers.rb +9 -0
- data/spec/support/helpers/std_streams_helper.rb +44 -13
- data/spec/support/helpers/transaction_helpers.rb +2 -2
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aa4703023302308a9af7c3133cbbb347bc03eaa
|
4
|
+
data.tar.gz: 7c262a115fb2abeb53af582af27536b836e60475
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57f347f6c7d8a8fa9729fe7f20679437b737455155c45430c1d0532b1ea8b38aab5d7af35b0b02108110919606af60b33579fdf7c0ce4d3c00cae043dba3ae3c
|
7
|
+
data.tar.gz: 1b74452af063d9299bd1040e98373ddfecae5a0de90a2a365bd7ba24d95fc2f78019b1e1675ff85d3bde8ad215ba10c63bcbbdb5296f91d87ed7f74027b9daf4
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# 2.0.4
|
2
|
+
* Use consistent log format for both file and STDOUT logs. PR #203
|
3
|
+
* Fix log path in `appsignal diagnose` for Rails applications. PR #218, #222
|
4
|
+
* Change default log path to `./log` rather than project root for all non-Rails
|
5
|
+
applications. PR #222
|
6
|
+
* Load the `APPSIGNAL_APP_ENV` environment configuration option consistently
|
7
|
+
for all integrations. PR #204
|
8
|
+
* Support the `--environment` option on the `appsignal diagnose` command. PR
|
9
|
+
#214
|
10
|
+
* Use the real system `/tmp` directory, not a symlink. PR #219
|
11
|
+
* Run the AppSignal agent in diagnose mode in the `appsignal diagnose` command.
|
12
|
+
PR #221
|
13
|
+
* Test for directory and file ownership and permissions in the
|
14
|
+
`appsignal diagnose` command. PR #216
|
15
|
+
* Test if current user is `root` in the `appsignal diagnose` command. PR #215
|
16
|
+
* Output last couple of lines from `appsignal.log` on agent connection
|
17
|
+
failures.
|
18
|
+
* Agent will no longer fail to start if no writable log path is found.
|
19
|
+
Commit 8920865f6158229a46ed4bd1cc98d99a849884c0, change in agent.
|
20
|
+
* Internal refactoring of the test suite and the `appsignal install` command.
|
21
|
+
PR #200, #205
|
22
|
+
|
1
23
|
# 2.0.3
|
2
24
|
* Fix JavaScript exception catcher throwing an error on finishing a
|
3
25
|
transaction. PR #210
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ AppSignal will automatically monitor requests, report any exceptions that are
|
|
31
31
|
thrown and any performance issues that might have occurred.
|
32
32
|
|
33
33
|
You can also add extra information to requests by adding custom instrumentation
|
34
|
-
and by adding
|
34
|
+
and by adding tags.
|
35
35
|
|
36
36
|
### Track any error
|
37
37
|
|
@@ -50,16 +50,20 @@ end
|
|
50
50
|
|
51
51
|
Read more about [Exception handling][exception-handling] in our documentation.
|
52
52
|
|
53
|
-
###
|
53
|
+
### Tagging
|
54
54
|
|
55
|
-
Need more information with errors and performance issues? Add
|
55
|
+
Need more information with errors and performance issues? Add tags to your
|
56
56
|
requests to identify common factors for problems.
|
57
57
|
|
58
58
|
```ruby
|
59
|
-
Appsignal.
|
60
|
-
|
59
|
+
Appsignal.tag_request(
|
60
|
+
user: current_user.id,
|
61
|
+
locale: I18n.locale
|
62
|
+
)
|
61
63
|
```
|
62
64
|
|
65
|
+
Read more about [Tagging][tagging] in our documentation.
|
66
|
+
|
63
67
|
### Custom instrumentation
|
64
68
|
|
65
69
|
If you need more fine-grained instrumentation you can add custom
|
data/appsignal.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
|
|
26
26
|
gem.add_dependency 'rack'
|
27
27
|
gem.add_dependency 'thread_safe'
|
28
28
|
|
29
|
-
gem.add_development_dependency 'rake'
|
29
|
+
gem.add_development_dependency 'rake', '~> 11'
|
30
30
|
gem.add_development_dependency 'rspec', '~> 2.14.1'
|
31
31
|
gem.add_development_dependency 'pry'
|
32
32
|
gem.add_development_dependency 'timecop'
|
data/ext/agent.yml
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: c18d324
|
3
3
|
triples:
|
4
4
|
x86_64-linux:
|
5
|
-
checksum:
|
6
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
5
|
+
checksum: 67a21c8481684466b39a55a6b7418fa838d98e3e4570c9a082ba23e5147d5a64
|
6
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/c18d324/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: 958cc0a742bea1e411bb6dbe0f7f124fe6ec273b8ae0d9b9317f306d60ee0b5d
|
9
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/c18d324/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: 958cc0a742bea1e411bb6dbe0f7f124fe6ec273b8ae0d9b9317f306d60ee0b5d
|
12
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/c18d324/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: 89053389ddf816aaefc1580899eca8bcac9837dfdfabf6f333a853d17f2edec8
|
15
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/c18d324/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: 89053389ddf816aaefc1580899eca8bcac9837dfdfabf6f333a853d17f2edec8
|
18
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/c18d324/appsignal-x86_64-darwin-all-static.tar.gz
|
data/lib/appsignal.rb
CHANGED
@@ -226,13 +226,14 @@ module Appsignal
|
|
226
226
|
def logger
|
227
227
|
@logger ||= Logger.new(in_memory_log).tap do |l|
|
228
228
|
l.level = Logger::INFO
|
229
|
-
l.formatter = log_formatter
|
229
|
+
l.formatter = log_formatter("appsignal")
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
|
-
def log_formatter
|
233
|
+
def log_formatter(prefix = nil)
|
234
|
+
pre = "#{prefix}: " if prefix
|
234
235
|
proc do |severity, datetime, progname, msg|
|
235
|
-
"[#{datetime.strftime('%Y-%m-%dT%H:%M:%S')} (process) ##{Process.pid}][#{severity}] #{msg}\n"
|
236
|
+
"[#{datetime.strftime('%Y-%m-%dT%H:%M:%S')} (process) ##{Process.pid}][#{severity}] #{pre}#{msg}\n"
|
236
237
|
end
|
237
238
|
end
|
238
239
|
|
@@ -290,18 +291,16 @@ module Appsignal
|
|
290
291
|
|
291
292
|
def start_stdout_logger
|
292
293
|
@logger = Logger.new($stdout)
|
293
|
-
|
294
|
-
"appsignal: #{msg}\n"
|
295
|
-
end
|
294
|
+
logger.formatter = log_formatter("appsignal")
|
296
295
|
end
|
297
296
|
|
298
297
|
def start_file_logger(path)
|
299
298
|
@logger = Logger.new(path)
|
300
|
-
|
299
|
+
logger.formatter = log_formatter
|
301
300
|
rescue SystemCallError => error
|
302
301
|
start_stdout_logger
|
303
|
-
logger.warn "
|
304
|
-
logger.warn
|
302
|
+
logger.warn "Unable to start logger with log path '#{path}'."
|
303
|
+
logger.warn error
|
305
304
|
end
|
306
305
|
end
|
307
306
|
end
|
data/lib/appsignal/cli.rb
CHANGED
@@ -2,6 +2,7 @@ require 'optparse'
|
|
2
2
|
require 'logger'
|
3
3
|
require 'yaml'
|
4
4
|
require 'appsignal'
|
5
|
+
require 'appsignal/cli/helpers'
|
5
6
|
require 'appsignal/cli/demo'
|
6
7
|
require 'appsignal/cli/diagnose'
|
7
8
|
require 'appsignal/cli/install'
|
@@ -27,9 +28,9 @@ module Appsignal
|
|
27
28
|
when :demo
|
28
29
|
Appsignal::CLI::Demo.run(options)
|
29
30
|
when :diagnose
|
30
|
-
Appsignal::CLI::Diagnose.run
|
31
|
+
Appsignal::CLI::Diagnose.run(options)
|
31
32
|
when :install
|
32
|
-
Appsignal::CLI::Install.run(argv.shift
|
33
|
+
Appsignal::CLI::Install.run(argv.shift)
|
33
34
|
when :notify_of_deploy
|
34
35
|
Appsignal::CLI::NotifyOfDeploy.run(options)
|
35
36
|
end
|
@@ -45,15 +46,6 @@ module Appsignal
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
|
-
def config
|
49
|
-
Appsignal::Config.new(
|
50
|
-
Dir.pwd,
|
51
|
-
options[:environment],
|
52
|
-
{},
|
53
|
-
Logger.new(StringIO.new)
|
54
|
-
)
|
55
|
-
end
|
56
|
-
|
57
49
|
def global_option_parser
|
58
50
|
OptionParser.new do |o|
|
59
51
|
o.banner = 'Usage: appsignal <command> [options]'
|
@@ -78,11 +70,17 @@ module Appsignal
|
|
78
70
|
'demo' => OptionParser.new do |o|
|
79
71
|
o.banner = 'Usage: appsignal demo [options]'
|
80
72
|
|
81
|
-
o.on '--environment=<
|
73
|
+
o.on '--environment=<app_env>', "The environment to demo" do |arg|
|
74
|
+
options[:environment] = arg
|
75
|
+
end
|
76
|
+
end,
|
77
|
+
'diagnose' => OptionParser.new do |o|
|
78
|
+
o.banner = 'Usage: appsignal diagnose [options]'
|
79
|
+
|
80
|
+
o.on '--environment=<app_env>', "The environment to diagnose" do |arg|
|
82
81
|
options[:environment] = arg
|
83
82
|
end
|
84
83
|
end,
|
85
|
-
'diagnose' => OptionParser.new,
|
86
84
|
'install' => OptionParser.new,
|
87
85
|
'notify_of_deploy' => OptionParser.new do |o|
|
88
86
|
o.banner = 'Usage: appsignal notify_of_deploy [options]'
|
@@ -95,7 +93,7 @@ module Appsignal
|
|
95
93
|
options[:user] = arg
|
96
94
|
end
|
97
95
|
|
98
|
-
o.on '--environment=<
|
96
|
+
o.on '--environment=<app_env>', "The environment you're deploying to" do |arg|
|
99
97
|
options[:environment] = arg
|
100
98
|
end
|
101
99
|
|
@@ -1,12 +1,13 @@
|
|
1
1
|
require "rbconfig"
|
2
2
|
require "bundler/cli"
|
3
3
|
require "bundler/cli/common"
|
4
|
+
require "etc"
|
4
5
|
|
5
6
|
module Appsignal
|
6
7
|
class CLI
|
7
8
|
class Diagnose
|
8
9
|
class << self
|
9
|
-
def run
|
10
|
+
def run(options = {})
|
10
11
|
header
|
11
12
|
empty_line
|
12
13
|
|
@@ -16,7 +17,8 @@ module Appsignal
|
|
16
17
|
host_information
|
17
18
|
empty_line
|
18
19
|
|
19
|
-
start_appsignal
|
20
|
+
start_appsignal(options)
|
21
|
+
|
20
22
|
config
|
21
23
|
empty_line
|
22
24
|
|
@@ -31,16 +33,22 @@ module Appsignal
|
|
31
33
|
|
32
34
|
private
|
33
35
|
|
34
|
-
def
|
35
|
-
|
36
|
-
|
36
|
+
def start_appsignal(options)
|
37
|
+
current_path = Dir.pwd
|
38
|
+
initial_config = {}
|
39
|
+
if rails_app?
|
40
|
+
current_path = Rails.root
|
41
|
+
initial_config[:name] = Rails.application.class.parent_name
|
42
|
+
initial_config[:log_path] = Rails.root.join("log")
|
43
|
+
end
|
37
44
|
|
38
|
-
|
45
|
+
ENV['APPSIGNAL_DIAGNOSE'] = 'true'
|
46
|
+
Appsignal.config = Appsignal::Config.new(
|
47
|
+
current_path,
|
48
|
+
options[:environment],
|
49
|
+
initial_config
|
50
|
+
)
|
39
51
|
Appsignal.start
|
40
|
-
return if config?
|
41
|
-
|
42
|
-
puts "Error: No config found!"
|
43
|
-
puts "Could not start AppSignal."
|
44
52
|
end
|
45
53
|
|
46
54
|
def header
|
@@ -58,6 +66,8 @@ module Appsignal
|
|
58
66
|
puts " Gem version: #{Appsignal::VERSION}"
|
59
67
|
puts " Agent version: #{Appsignal::Extension.agent_version}"
|
60
68
|
puts " Gem install path: #{gem_path}"
|
69
|
+
print " Extension loaded: "
|
70
|
+
puts Appsignal.extension_loaded ? "yes" : "no"
|
61
71
|
end
|
62
72
|
|
63
73
|
def host_information
|
@@ -67,6 +77,8 @@ module Appsignal
|
|
67
77
|
puts " Operating System: #{rbconfig["host_os"]}"
|
68
78
|
puts " Ruby version: #{rbconfig["RUBY_VERSION_NAME"]}"
|
69
79
|
puts " Heroku: true" if Appsignal::System.heroku?
|
80
|
+
print " root user: "
|
81
|
+
puts Process.uid == 0 ? "yes (not recommended)" : "no"
|
70
82
|
if Appsignal::System.container?
|
71
83
|
puts " Container id: #{Appsignal::System::Container.id}"
|
72
84
|
end
|
@@ -74,7 +86,6 @@ module Appsignal
|
|
74
86
|
|
75
87
|
def config
|
76
88
|
puts "Configuration"
|
77
|
-
return unless config?
|
78
89
|
environment
|
79
90
|
|
80
91
|
Appsignal.config.config_hash.each do |key, value|
|
@@ -89,32 +100,64 @@ module Appsignal
|
|
89
100
|
puts " Warning: No environment set, no config loaded!"
|
90
101
|
puts " Please make sure appsignal diagnose is run within your "
|
91
102
|
puts " project directory with an environment."
|
92
|
-
puts "
|
103
|
+
puts " appsignal diagnose --environment=production"
|
93
104
|
end
|
94
105
|
end
|
95
106
|
|
96
107
|
def paths_writable
|
97
108
|
puts "Required paths"
|
98
|
-
return unless config?
|
99
109
|
|
100
|
-
|
101
|
-
:
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
result = "Does not exist"
|
110
|
-
elsif File.writable? path
|
111
|
-
result = "Writable"
|
112
|
-
end
|
110
|
+
appsignal_paths.each do |name, path|
|
111
|
+
puts " #{name}: #{path.to_s.inspect}"
|
112
|
+
unless path
|
113
|
+
puts " - Configured?: no"
|
114
|
+
next
|
115
|
+
end
|
116
|
+
unless File.exist? path
|
117
|
+
puts " - Exists?: no"
|
118
|
+
next
|
113
119
|
end
|
114
|
-
|
120
|
+
|
121
|
+
print " - Writable?: "
|
122
|
+
puts File.writable?(path) ? "yes" : "no"
|
123
|
+
|
124
|
+
ownership = path_ownership(path)
|
125
|
+
process_owner = ownership[:process]
|
126
|
+
file_owner = ownership[:file]
|
127
|
+
print " - Ownership?: "
|
128
|
+
owned = process_owner[:uid] == file_owner[:uid]
|
129
|
+
print owned ? "yes" : "no"
|
130
|
+
print " (file: #{file_owner[:name]}:#{file_owner[:uid]}, "
|
131
|
+
puts "process: #{process_owner[:name]}:#{process_owner[:uid]})"
|
115
132
|
end
|
116
133
|
end
|
117
134
|
|
135
|
+
def path_ownership(path)
|
136
|
+
process_uid = Process.uid
|
137
|
+
file_uid = File.stat(path).uid
|
138
|
+
{
|
139
|
+
:process => {
|
140
|
+
:uid => process_uid,
|
141
|
+
:name => Etc.getpwuid(process_uid).name
|
142
|
+
},
|
143
|
+
:file => {
|
144
|
+
:uid => file_uid,
|
145
|
+
:name => Etc.getpwuid(file_uid).name
|
146
|
+
}
|
147
|
+
}
|
148
|
+
end
|
149
|
+
|
150
|
+
def appsignal_paths
|
151
|
+
config = Appsignal.config
|
152
|
+
log_file_path = config.log_file_path
|
153
|
+
{
|
154
|
+
:current_path => Dir.pwd,
|
155
|
+
:root_path => config.root_path,
|
156
|
+
:log_dir_path => log_file_path ? File.dirname(log_file_path) : "",
|
157
|
+
:log_file_path => log_file_path,
|
158
|
+
}
|
159
|
+
end
|
160
|
+
|
118
161
|
def check_api_key
|
119
162
|
auth_check = ::Appsignal::AuthCheck.new(Appsignal.config, Appsignal.logger)
|
120
163
|
print "Validating API key: "
|
@@ -159,14 +202,22 @@ module Appsignal
|
|
159
202
|
end
|
160
203
|
end
|
161
204
|
|
205
|
+
def empty_line
|
206
|
+
puts "\n"
|
207
|
+
end
|
208
|
+
|
209
|
+
def rails_app?
|
210
|
+
require "rails"
|
211
|
+
require File.expand_path(File.join(Dir.pwd, "config", "application.rb"))
|
212
|
+
true
|
213
|
+
rescue LoadError
|
214
|
+
false
|
215
|
+
end
|
216
|
+
|
162
217
|
def gem_path
|
163
218
|
@gem_path ||= \
|
164
219
|
Bundler::CLI::Common.select_spec("appsignal").full_gem_path.strip
|
165
220
|
end
|
166
|
-
|
167
|
-
def config?
|
168
|
-
Appsignal.config
|
169
|
-
end
|
170
221
|
end
|
171
222
|
end
|
172
223
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Appsignal
|
2
|
+
class CLI
|
3
|
+
module Helpers
|
4
|
+
private
|
5
|
+
|
6
|
+
def colorize(text, color)
|
7
|
+
return text if Gem.win_platform?
|
8
|
+
|
9
|
+
color_code =
|
10
|
+
case color
|
11
|
+
when :red then 31
|
12
|
+
when :green then 32
|
13
|
+
when :yellow then 33
|
14
|
+
when :blue then 34
|
15
|
+
when :pink then 35
|
16
|
+
else 0
|
17
|
+
end
|
18
|
+
|
19
|
+
"\e[#{color_code}m#{text}\e[0m"
|
20
|
+
end
|
21
|
+
|
22
|
+
def periods
|
23
|
+
3.times do
|
24
|
+
print "."
|
25
|
+
sleep 0.5
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def press_any_key
|
30
|
+
puts
|
31
|
+
print " Ready? Press any key:"
|
32
|
+
stdin.getch
|
33
|
+
puts
|
34
|
+
puts
|
35
|
+
end
|
36
|
+
|
37
|
+
def ask_for_input
|
38
|
+
value = stdin.gets
|
39
|
+
value ? value.chomp : ""
|
40
|
+
end
|
41
|
+
|
42
|
+
def required_input(prompt)
|
43
|
+
loop do
|
44
|
+
print prompt
|
45
|
+
value = ask_for_input
|
46
|
+
return value if value.length > 0
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def yes_or_no(prompt)
|
51
|
+
loop do
|
52
|
+
print prompt
|
53
|
+
case ask_for_input
|
54
|
+
when "y"
|
55
|
+
return true
|
56
|
+
when "n"
|
57
|
+
return false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def stdin
|
63
|
+
$stdin
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|