appsignal 1.3.6 → 1.4.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rspec +1 -3
- data/CHANGELOG.md +2 -28
- data/Rakefile +2 -2
- data/benchmark.rake +4 -0
- data/circle.yml +12 -0
- data/ext/agent.yml +11 -11
- data/ext/appsignal_extension.c +3 -3
- data/ext/extconf.rb +4 -4
- data/lib/appsignal.rb +10 -27
- data/lib/appsignal/cli/diagnose.rb +3 -4
- data/lib/appsignal/cli/install.rb +15 -16
- data/lib/appsignal/config.rb +7 -18
- data/lib/appsignal/event_formatter.rb +1 -1
- data/lib/appsignal/integrations/capistrano/appsignal.cap +1 -1
- data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +2 -2
- data/lib/appsignal/integrations/object.rb +4 -4
- data/lib/appsignal/integrations/sinatra.rb +1 -1
- data/lib/appsignal/integrations/webmachine.rb +1 -1
- data/lib/appsignal/js_exception_transaction.rb +0 -1
- data/lib/appsignal/marker.rb +2 -3
- data/lib/appsignal/rack/sinatra_instrumentation.rb +5 -12
- data/lib/appsignal/rack/streaming_listener.rb +2 -4
- data/lib/appsignal/transaction.rb +3 -3
- data/lib/appsignal/transmitter.rb +7 -11
- data/lib/appsignal/utils.rb +0 -6
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +2 -0
- data/spec/lib/appsignal/capistrano2_spec.rb +78 -98
- data/spec/lib/appsignal/capistrano3_spec.rb +77 -56
- data/spec/lib/appsignal/cli/diagnose_spec.rb +13 -12
- data/spec/lib/appsignal/cli/install_spec.rb +15 -38
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +5 -2
- data/spec/lib/appsignal/cli_spec.rb +5 -2
- data/spec/lib/appsignal/config_spec.rb +17 -131
- data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/event_formatter_spec.rb +2 -0
- data/spec/lib/appsignal/extension_spec.rb +1 -0
- data/spec/lib/appsignal/hooks/celluloid_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/data_mapper_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/net_http_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/passenger_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/puma_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/rake_spec.rb +1 -0
- data/spec/lib/appsignal/hooks/redis_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/sequel_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/shoryuken_spec.rb +4 -1
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +3 -2
- data/spec/lib/appsignal/hooks/unicorn_spec.rb +2 -0
- data/spec/lib/appsignal/hooks/webmachine_spec.rb +8 -2
- data/spec/lib/appsignal/hooks_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/data_mapper_spec.rb +1 -0
- data/spec/lib/appsignal/integrations/grape_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +1 -0
- data/spec/lib/appsignal/integrations/object_spec.rb +1 -30
- data/spec/lib/appsignal/integrations/padrino_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/railtie_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +2 -0
- data/spec/lib/appsignal/integrations/resque_spec.rb +3 -1
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +7 -32
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +11 -4
- data/spec/lib/appsignal/js_exception_transaction_spec.rb +2 -0
- data/spec/lib/appsignal/marker_spec.rb +48 -35
- data/spec/lib/appsignal/minutely_spec.rb +2 -0
- data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +2 -0
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +2 -0
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +2 -0
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +6 -46
- data/spec/lib/appsignal/rack/streaming_listener_spec.rb +4 -3
- data/spec/lib/appsignal/subscriber_spec.rb +2 -0
- data/spec/lib/appsignal/transaction_spec.rb +3 -2
- data/spec/lib/appsignal/transmitter_spec.rb +20 -53
- data/spec/lib/appsignal/update_active_support_spec.rb +2 -0
- data/spec/lib/appsignal/utils/params_sanitizer_spec.rb +2 -0
- data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +2 -0
- data/spec/lib/appsignal/utils_spec.rb +2 -0
- data/spec/lib/appsignal_spec.rb +37 -91
- data/spec/spec_helper.rb +28 -22
- metadata +5 -14
- data/spec/lib/appsignal/utils/gzip_spec.rb +0 -10
- data/spec/support/helpers/api_request_helper.rb +0 -19
- data/spec/support/helpers/directory_helper.rb +0 -25
- data/spec/support/helpers/std_streams_helper.rb +0 -35
- data/spec/support/helpers/very_specific_error.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7e0714208d16378116ca1e5b526c1d1e86622ab
|
4
|
+
data.tar.gz: 17296a5f5358675b963682c8e683ede088fa4a13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eb6ce393a25fd6ba0cfcb1e76ff479c6422b66a247a7238e61caab9c8fee2d7a886a6797d19f5a220ceff6c5c064a2be5db240543d73b970ff7133ce8fafdb0
|
7
|
+
data.tar.gz: e0f042f305a39b7e954f6130b0a08cf540549683e277d5aab60f859e8cb6c61cfc1d7a382d04e1b39be253e2e45e1dd487b2082cbeedfdebd3f701fdee3af002
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,29 +1,5 @@
|
|
1
|
-
# 1.
|
2
|
-
* Support
|
3
|
-
* Support `APPSIGNAL_APP_ENV` for Sinatra
|
4
|
-
* Minor improvements to installer
|
5
|
-
* More robust handing of non-writable log files
|
6
|
-
* Cleaner internal exception handling
|
7
|
-
* Support for mixed case keywords in sql lexing
|
8
|
-
* Support for inserting multiple rows in sql lexing
|
9
|
-
|
10
|
-
# 1.3.5
|
11
|
-
|
12
|
-
* Fix SSL certificate config in appsignal-agent. PR #151
|
13
|
-
* Remove mounted_at Sinatra middleware option. Now detected by default. PR #146
|
14
|
-
* Sinatra applications with middleware loading before AppSignal's middleware
|
15
|
-
would crash a request. Fixed in PR #156
|
16
|
-
|
17
|
-
# 1.3.4
|
18
|
-
|
19
|
-
* Fix argument order for `record_event` in the AppSignal extension
|
20
|
-
|
21
|
-
# 1.3.3
|
22
|
-
|
23
|
-
* Output AppSignal environment on `appsignal diagnose`
|
24
|
-
* Prevent transaction crashes on Sinatra routes with optional parameters
|
25
|
-
* Listen to `stage` option to Capistrano 2 for automatic environment detection
|
26
|
-
* Add `appsignal_env` option to Capistrano 2 to set a custom environment
|
1
|
+
# 1.4.0
|
2
|
+
* Support for a wider range of Linux versions, including Alpine
|
27
3
|
|
28
4
|
# 1.3.2
|
29
5
|
* Add method to discard a transaction
|
@@ -50,8 +26,6 @@
|
|
50
26
|
* Allow overriding Padrino environment with APPSIGNAL_APP_ENV
|
51
27
|
* Add mkmf.log to diagnose command
|
52
28
|
* Allow for local install with bundler `bundle exec rake install`
|
53
|
-
* Listen to `stage` option to Capistrano 3 for automatic environment detection
|
54
|
-
* Add `appsignal_env` option to Capistrano 3 to set a custom environment
|
55
29
|
|
56
30
|
# 1.2.5
|
57
31
|
* Bugfix in CPU utilization calculation for host metrics
|
data/Rakefile
CHANGED
@@ -104,7 +104,7 @@ task :publish do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
task :install do
|
107
|
-
system 'cd ext && rm -f libappsignal.a appsignal-agent appsignal_extension.h Makefile
|
107
|
+
system 'cd ext && rm -f libappsignal.a appsignal-agent appsignal_extension.h Makefile appsignal.bundle && ruby extconf.rb && make && cd ..'
|
108
108
|
Bundler.with_clean_env do
|
109
109
|
GEMFILES.each do |gemfile|
|
110
110
|
system "bundle --gemfile gemfiles/#{gemfile}.gemfile"
|
@@ -135,7 +135,7 @@ task :generate_bundle_and_spec_all do
|
|
135
135
|
out << "#{switch_command.call(version)} || { echo 'Switching Ruby failed'; exit 1; }"
|
136
136
|
out << "ruby -v"
|
137
137
|
out << "echo 'Compiling extension'"
|
138
|
-
out << 'cd ext && rm -f appsignal-agent appsignal_extension.bundle
|
138
|
+
out << 'cd ext && rm -f appsignal-agent appsignal_extension.bundle appsignal.h libappsignal.a Makefile && ruby extconf.rb && make && cd ..'
|
139
139
|
GEMFILES.each do |gemfile|
|
140
140
|
unless EXCLUSIONS[gemfile] && EXCLUSIONS[gemfile].include?(short_version)
|
141
141
|
out << "echo 'Bundling #{gemfile} in #{short_version}'"
|
data/benchmark.rake
CHANGED
data/circle.yml
ADDED
data/ext/agent.yml
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: 9e60c7f
|
3
3
|
triples:
|
4
4
|
x86_64-linux:
|
5
|
-
checksum:
|
6
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
5
|
+
checksum: e29c92ff06c7c6aa3f18a49133d3695d64fff2b55bfdabb1721fe8348a369a9f
|
6
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/9e60c7f/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: 4157ef168a03093215b8adc7c61b52740d08ac54d031dc1579741a792250e94d
|
9
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/9e60c7f/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: 4157ef168a03093215b8adc7c61b52740d08ac54d031dc1579741a792250e94d
|
12
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/9e60c7f/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: a82a7b551037a33d7570df9559ae80d593662f6c38ed30cc73733c6c7e6f63cc
|
15
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/9e60c7f/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: a82a7b551037a33d7570df9559ae80d593662f6c38ed30cc73733c6c7e6f63cc
|
18
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/9e60c7f/appsignal-x86_64-darwin-all-static.tar.gz
|
data/ext/appsignal_extension.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#include "ruby/ruby.h"
|
2
2
|
#include "ruby/encoding.h"
|
3
|
-
#include "
|
3
|
+
#include "appsignal.h"
|
4
4
|
|
5
5
|
static inline appsignal_string_t make_appsignal_string(VALUE str) {
|
6
6
|
return (appsignal_string_t) {
|
@@ -110,8 +110,8 @@ static VALUE record_event(VALUE self, VALUE name, VALUE title, VALUE body, VALUE
|
|
110
110
|
make_appsignal_string(name),
|
111
111
|
make_appsignal_string(title),
|
112
112
|
make_appsignal_string(body),
|
113
|
-
|
114
|
-
|
113
|
+
FIX2INT(body_format),
|
114
|
+
NUM2LONG(duration)
|
115
115
|
);
|
116
116
|
return Qnil;
|
117
117
|
}
|
data/ext/extconf.rb
CHANGED
@@ -49,7 +49,7 @@ def install
|
|
49
49
|
|
50
50
|
unless File.exist?(ext_path('appsignal-agent')) &&
|
51
51
|
File.exist?(ext_path('libappsignal.a')) &&
|
52
|
-
File.exist?(ext_path('
|
52
|
+
File.exist?(ext_path('appsignal.h'))
|
53
53
|
logger.info "Downloading agent release from #{arch_config['download_url']}"
|
54
54
|
|
55
55
|
archive = open(arch_config['download_url'], :ssl_ca_cert => CA_CERT_PATH)
|
@@ -82,11 +82,11 @@ def install
|
|
82
82
|
installation_failed 'Aborting installation, libappsignal not found'
|
83
83
|
elsif !find_executable('appsignal-agent', EXT_PATH)
|
84
84
|
installation_failed 'Aborting installation, appsignal-agent not found'
|
85
|
-
elsif !find_header('
|
86
|
-
installation_failed 'Aborting installation,
|
85
|
+
elsif !find_header('appsignal.h', EXT_PATH)
|
86
|
+
installation_failed 'Aborting installation, appsignal.h not found'
|
87
87
|
else
|
88
88
|
create_makefile 'appsignal_extension'
|
89
|
-
logger.info 'Successfully
|
89
|
+
logger.info 'Successfully created Makefile for appsignal extension'
|
90
90
|
end
|
91
91
|
rescue => ex
|
92
92
|
installation_failed "Exception while installing: #{ex}"
|
data/lib/appsignal.rb
CHANGED
@@ -235,26 +235,22 @@ module Appsignal
|
|
235
235
|
end
|
236
236
|
|
237
237
|
def log_formatter
|
238
|
-
|
239
|
-
|
240
|
-
|
238
|
+
proc do |severity, datetime, progname, msg|
|
239
|
+
"[#{datetime.strftime('%Y-%m-%dT%H:%M:%S')} (process) ##{Process.pid}][#{severity}] #{msg}\n"
|
240
|
+
end
|
241
241
|
end
|
242
242
|
|
243
243
|
def start_logger(path_arg=nil)
|
244
244
|
path = Appsignal.config ? Appsignal.config.log_file_path : nil
|
245
|
-
if path && !
|
246
|
-
|
247
|
-
|
248
|
-
@logger.formatter = log_formatter
|
249
|
-
rescue SystemCallError => error
|
250
|
-
start_stdout_logger
|
251
|
-
logger.warn "appsignal: Unable to start logger with log path '#{path}'."
|
252
|
-
logger.warn "appsignal: #{error}"
|
253
|
-
end
|
245
|
+
if path && !ENV['DYNO']
|
246
|
+
@logger = Logger.new(path)
|
247
|
+
@logger.formatter = log_formatter
|
254
248
|
else
|
255
|
-
|
249
|
+
@logger = Logger.new($stdout)
|
250
|
+
@logger.formatter = lambda do |severity, datetime, progname, msg|
|
251
|
+
"appsignal: #{msg}\n"
|
252
|
+
end
|
256
253
|
end
|
257
|
-
|
258
254
|
if config && config[:debug]
|
259
255
|
@logger.level = Logger::DEBUG
|
260
256
|
else
|
@@ -296,19 +292,6 @@ module Appsignal
|
|
296
292
|
ensure
|
297
293
|
Appsignal::Transaction.current.resume! if Appsignal::Transaction.current
|
298
294
|
end
|
299
|
-
|
300
|
-
private
|
301
|
-
|
302
|
-
def start_stdout_logger
|
303
|
-
@logger = Logger.new($stdout)
|
304
|
-
@logger.formatter = lambda do |severity, datetime, progname, msg|
|
305
|
-
"appsignal: #{msg}\n"
|
306
|
-
end
|
307
|
-
end
|
308
|
-
|
309
|
-
def heroku?
|
310
|
-
ENV['DYNO']
|
311
|
-
end
|
312
295
|
end
|
313
296
|
end
|
314
297
|
|
@@ -26,7 +26,6 @@ module Appsignal
|
|
26
26
|
|
27
27
|
def config
|
28
28
|
start_appsignal
|
29
|
-
puts "Environment: #{Appsignal.config.env}"
|
30
29
|
Appsignal.config.config_hash.each do |key, val|
|
31
30
|
puts "Config #{key}: #{val}"
|
32
31
|
end
|
@@ -61,12 +60,12 @@ module Appsignal
|
|
61
60
|
def check_ext_install
|
62
61
|
require 'bundler/cli'
|
63
62
|
require "bundler/cli/common"
|
64
|
-
path
|
65
|
-
install_log_path = "#{path}/ext/install.log"
|
63
|
+
path = Bundler::CLI::Common.select_spec('appsignal').full_gem_path
|
64
|
+
install_log_path = "#{path.strip}/ext/install.log"
|
66
65
|
puts "Showing last lines of extension install log: #{install_log_path}"
|
67
66
|
puts File.read(install_log_path)
|
68
67
|
puts "\n"
|
69
|
-
mkmf_log_path = "#{path}/ext/mkmf.log"
|
68
|
+
mkmf_log_path = "#{path.strip}/ext/mkmf.log"
|
70
69
|
if File.exist?(mkmf_log_path)
|
71
70
|
puts "Showing last lines of extension compilation log: #{mkmf_log_path}"
|
72
71
|
puts File.read(mkmf_log_path)
|
@@ -93,6 +93,11 @@ module Appsignal
|
|
93
93
|
puts
|
94
94
|
puts " require 'appsignal/integrations/sinatra'"
|
95
95
|
press_any_key
|
96
|
+
puts "Configure subclass apps"
|
97
|
+
puts " If your app is a subclass of Sinatra::Base you need to use this middleware:"
|
98
|
+
puts
|
99
|
+
puts " use Appsignal::Rack::SinatraInstrumentation"
|
100
|
+
press_any_key
|
96
101
|
done_notice
|
97
102
|
end
|
98
103
|
|
@@ -131,21 +136,6 @@ module Appsignal
|
|
131
136
|
done_notice
|
132
137
|
end
|
133
138
|
|
134
|
-
def install_for_capistrano
|
135
|
-
capfile = File.join(Dir.pwd, 'Capfile')
|
136
|
-
return unless File.exist?(capfile)
|
137
|
-
return if File.read(capfile) =~ %r{require ['|"]appsignal/capistrano}
|
138
|
-
|
139
|
-
puts 'Installing for Capistrano'
|
140
|
-
print ' Adding AppSignal integration to Capfile'
|
141
|
-
File.open(capfile, 'a') do |f|
|
142
|
-
f.write "\nrequire 'appsignal/capistrano'\n"
|
143
|
-
end
|
144
|
-
periods
|
145
|
-
puts
|
146
|
-
puts
|
147
|
-
end
|
148
|
-
|
149
139
|
def colorize(text, color)
|
150
140
|
return text if Gem.win_platform?
|
151
141
|
color_code = case color
|
@@ -197,7 +187,16 @@ module Appsignal
|
|
197
187
|
end
|
198
188
|
|
199
189
|
def configure(config, environments, name_overwritten)
|
200
|
-
|
190
|
+
deploy_rb_file = File.join(Dir.pwd, 'config/deploy.rb')
|
191
|
+
if File.exist?(deploy_rb_file) && (File.read(deploy_rb_file) =~ /require (\'|\").\/appsignal\/capistrano/).nil?
|
192
|
+
print 'Adding AppSignal integration to deploy.rb'
|
193
|
+
File.open(deploy_rb_file, 'a') do |f|
|
194
|
+
f.write "\nrequire 'appsignal/capistrano'\n"
|
195
|
+
end
|
196
|
+
periods
|
197
|
+
puts
|
198
|
+
puts
|
199
|
+
end
|
201
200
|
|
202
201
|
puts "How do you want to configure AppSignal?"
|
203
202
|
puts " (1) a config file"
|
data/lib/appsignal/config.rb
CHANGED
@@ -5,7 +5,6 @@ require 'socket'
|
|
5
5
|
|
6
6
|
module Appsignal
|
7
7
|
class Config
|
8
|
-
SYSTEM_TMP_DIR = '/tmp'
|
9
8
|
DEFAULT_CONFIG = {
|
10
9
|
:debug => false,
|
11
10
|
:ignore_errors => [],
|
@@ -24,8 +23,7 @@ module Appsignal
|
|
24
23
|
:running_in_container => false,
|
25
24
|
:enable_host_metrics => true,
|
26
25
|
:enable_minutely_probes => false,
|
27
|
-
:hostname => ::Socket.gethostname
|
28
|
-
:ca_file_path => File.expand_path(File.join('../../../resources/cacert.pem'), __FILE__)
|
26
|
+
:hostname => ::Socket.gethostname
|
29
27
|
}.freeze
|
30
28
|
|
31
29
|
ENV_TO_KEY_MAPPING = {
|
@@ -52,8 +50,7 @@ module Appsignal
|
|
52
50
|
'APPSIGNAL_WORKING_DIR_PATH' => :working_dir_path,
|
53
51
|
'APPSIGNAL_ENABLE_HOST_METRICS' => :enable_host_metrics,
|
54
52
|
'APPSIGNAL_ENABLE_MINUTELY_PROBES' => :enable_minutely_probes,
|
55
|
-
'APPSIGNAL_HOSTNAME' => :hostname
|
56
|
-
'APPSIGNAL_CA_FILE_PATH' => :ca_file_path
|
53
|
+
'APPSIGNAL_HOSTNAME' => :hostname
|
57
54
|
}.freeze
|
58
55
|
|
59
56
|
attr_reader :root_path, :env, :initial_config, :config_hash
|
@@ -92,19 +89,12 @@ module Appsignal
|
|
92
89
|
def log_file_path
|
93
90
|
path = config_hash[:log_path] || root_path
|
94
91
|
if path && File.writable?(path)
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
if File.writable? SYSTEM_TMP_DIR
|
99
|
-
$stdout.puts "appsignal: Unable to log to '#{path}'. Logging to "\
|
100
|
-
"'#{SYSTEM_TMP_DIR}' instead. Please check the "\
|
101
|
-
"permissions for the application's log directory."
|
102
|
-
File.join(SYSTEM_TMP_DIR, 'appsignal.log')
|
92
|
+
File.join(File.realpath(path), 'appsignal.log')
|
103
93
|
else
|
104
|
-
|
105
|
-
"'#{SYSTEM_TMP_DIR}' fallback. Please check the permissions "\
|
106
|
-
"for the application's (log) directory."
|
94
|
+
'/tmp/appsignal.log'
|
107
95
|
end
|
96
|
+
rescue Errno::ENOENT
|
97
|
+
'/tmp/appsignal.log'
|
108
98
|
end
|
109
99
|
|
110
100
|
def valid?
|
@@ -137,7 +127,6 @@ module Appsignal
|
|
137
127
|
ENV['APPSIGNAL_ENABLE_MINUTELY_PROBES'] = config_hash[:enable_minutely_probes].to_s
|
138
128
|
ENV['APPSIGNAL_HOSTNAME'] = config_hash[:hostname].to_s
|
139
129
|
ENV['APPSIGNAL_PROCESS_NAME'] = $0
|
140
|
-
ENV['APPSIGNAL_CA_FILE_PATH'] = config_hash[:ca_file_path].to_s
|
141
130
|
end
|
142
131
|
|
143
132
|
protected
|
@@ -186,7 +175,7 @@ module Appsignal
|
|
186
175
|
# Configuration with string type
|
187
176
|
%w(APPSIGNAL_PUSH_API_KEY APPSIGNAL_APP_NAME APPSIGNAL_PUSH_API_ENDPOINT
|
188
177
|
APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH APPSIGNAL_HTTP_PROXY APPSIGNAL_LOG_PATH
|
189
|
-
APPSIGNAL_WORKING_DIR_PATH APPSIGNAL_HOSTNAME
|
178
|
+
APPSIGNAL_WORKING_DIR_PATH APPSIGNAL_HOSTNAME).each do |var|
|
190
179
|
if env_var = ENV[var]
|
191
180
|
config[ENV_TO_KEY_MAPPING[var]] = env_var
|
192
181
|
end
|
@@ -46,7 +46,7 @@ module Appsignal
|
|
46
46
|
else
|
47
47
|
raise "#{f} does not have a format(payload) method"
|
48
48
|
end
|
49
|
-
rescue => ex
|
49
|
+
rescue Exception => ex
|
50
50
|
formatter_classes.delete(name)
|
51
51
|
formatters.delete(name)
|
52
52
|
Appsignal.logger.debug("'#{ex.message}' when initializing #{name} event formatter")
|
@@ -20,7 +20,7 @@ namespace :appsignal do
|
|
20
20
|
marker = Appsignal::Marker.new(marker_data, appsignal_config)
|
21
21
|
marker.transmit
|
22
22
|
else
|
23
|
-
puts
|
23
|
+
puts 'Not notifying of deploy, config is not active'
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -7,7 +7,7 @@ module Appsignal
|
|
7
7
|
|
8
8
|
namespace :appsignal do
|
9
9
|
task :deploy do
|
10
|
-
env = fetch(:
|
10
|
+
env = fetch(:rails_env, fetch(:rack_env, 'production'))
|
11
11
|
user = ENV['USER'] || ENV['USERNAME']
|
12
12
|
revision = fetch(:appsignal_revision, fetch(:current_revision))
|
13
13
|
|
@@ -31,7 +31,7 @@ module Appsignal
|
|
31
31
|
marker.transmit
|
32
32
|
end
|
33
33
|
else
|
34
|
-
puts
|
34
|
+
puts 'Not notifying of deploy, config is not active'
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -2,24 +2,24 @@ class Object
|
|
2
2
|
def self.appsignal_instrument_class_method(method_name, options = {})
|
3
3
|
singleton_class.send \
|
4
4
|
:alias_method, "appsignal_uninstrumented_#{method_name}", method_name
|
5
|
-
singleton_class.send(:define_method, method_name) do |*args
|
5
|
+
singleton_class.send(:define_method, method_name) do |*args|
|
6
6
|
name = options.fetch(:name) do
|
7
7
|
"#{method_name}.class_method.#{appsignal_reverse_class_name}.other"
|
8
8
|
end
|
9
9
|
Appsignal.instrument name do
|
10
|
-
send "appsignal_uninstrumented_#{method_name}", *args
|
10
|
+
send "appsignal_uninstrumented_#{method_name}", *args
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.appsignal_instrument_method(method_name, options = {})
|
16
16
|
alias_method "appsignal_uninstrumented_#{method_name}", method_name
|
17
|
-
define_method method_name do |*args
|
17
|
+
define_method method_name do |*args|
|
18
18
|
name = options.fetch(:name) do
|
19
19
|
"#{method_name}.#{appsignal_reverse_class_name}.other"
|
20
20
|
end
|
21
21
|
Appsignal.instrument name do
|
22
|
-
send "appsignal_uninstrumented_#{method_name}", *args
|
22
|
+
send "appsignal_uninstrumented_#{method_name}", *args
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|