appsignal 0.12.beta.53 → 0.12.beta.54

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
  SHA1:
3
- metadata.gz: f8dff871c0cdee9f6d75da2a42a5a25e2231c165
4
- data.tar.gz: dc9ce6bc64507c0fd32f4cf8712a3f4be998d48f
3
+ metadata.gz: c869da1b4f47565f79929f3b4fa58dcf1b16a4e7
4
+ data.tar.gz: 841f08c157e237bb3b86f2050e36ae0ffa24e9af
5
5
  SHA512:
6
- metadata.gz: ce7fe3492bf922bceeaf9be9666c403743adba1ec2930c40e1e0eb9d834da8b89853971eee8dba38fec4dc6316fb6b3c9912a1d710a57ad6d2651bfeefb3f282
7
- data.tar.gz: 1d18a1857fbb541c4fa1ccc70e18989f6341db06c93ac0b0e98d4028d826af137f6639fac31a635a2f44c90c0701e2d30ad99fb898b7a680055b38956978bd36
6
+ metadata.gz: b5fee20a893a776c958c7dd39dd66cf5126dfd401aa8beaf2d9d111c977e032d93b05fab0a2c77feaf02050c0de44e5f2ea702bb681b72e57df03cd333b317bb
7
+ data.tar.gz: c1dcf58993ba75b63f82dc86942d8e7613ae5f81a2a9f7c4f49f8d4647dbd00c195b7d337036e3f777fdd8c02b9a4af3e88e67576346ec15d15a1b88ea79d900
data/ext/agent.yml CHANGED
@@ -1,11 +1,11 @@
1
1
  ---
2
- :version: b52a8cc
2
+ :version: 235949b
3
3
  :triples:
4
4
  x86_64-linux:
5
- :checksum: 676cf1186fbf79c43289e4ebe162c46820abcefc323e1a06955b96d44afca4e4
6
- :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/b52a8cc/appsignal-agent-x86_64-linux-static.tar.gz
5
+ :checksum: 75f5e16f5f21bf2ea52c8d37a4b6aee54e3ebfdee25c84a6580327f575d167a2
6
+ :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/235949b/appsignal-agent-x86_64-linux-static.tar.gz
7
7
  :lib_filename: libappsignal.a
8
8
  x86_64-darwin:
9
- :checksum: e4266a77c81b0a4c4a8e09eb4ac3dccc5278579510a5a22ed767de0dc7178f01
10
- :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/b52a8cc/appsignal-agent-x86_64-darwin-static.tar.gz
9
+ :checksum: 4ffe599644f3ca56613a94a5656838f3ead6ae7751369aa0d0abf37dd518a367
10
+ :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/235949b/appsignal-agent-x86_64-darwin-static.tar.gz
11
11
  :lib_filename: libappsignal.a
data/lib/appsignal.rb CHANGED
@@ -206,11 +206,12 @@ module Appsignal
206
206
  end
207
207
  end
208
208
 
209
- def start_logger(path)
209
+ def start_logger(path_arg=nil)
210
+ path = Appsignal.config ? Appsignal.config[:log_file_path] : nil
210
211
  if path && File.writable?(path) &&
211
212
  !ENV['DYNO'] &&
212
213
  !ENV['SHELLYCLOUD_DEPLOYMENT']
213
- @logger = Logger.new(File.join(path, 'appsignal.log'))
214
+ @logger = Logger.new(path)
214
215
  @logger.formatter = log_formatter
215
216
  else
216
217
  @logger = Logger.new($stdout)
@@ -220,6 +221,10 @@ module Appsignal
220
221
  end
221
222
  @logger.level = Logger::INFO
222
223
  @logger << @in_memory_log.string if @in_memory_log
224
+
225
+ if path_arg
226
+ @logger.info('Setting the path in start_logger has no effect anymore, set it in the config instead')
227
+ end
223
228
  end
224
229
 
225
230
  def extension_loaded?
@@ -28,6 +28,7 @@ module Appsignal
28
28
  'APPSIGNAL_PUSH_API_ENDPOINT' => :endpoint,
29
29
  'APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH' => :frontend_error_catching_path,
30
30
  'APPSIGNAL_DEBUG' => :debug,
31
+ 'APPSIGNAL_LOG_FILE_PATH' => :log_file_path,
31
32
  'APPSIGNAL_INSTRUMENT_NET_HTTP' => :instrument_net_http,
32
33
  'APPSIGNAL_SKIP_SESSION_DATA' => :skip_session_data,
33
34
  'APPSIGNAL_ENABLE_FRONTEND_ERROR_CATCHING' => :enable_frontend_error_catching,
@@ -81,6 +82,7 @@ module Appsignal
81
82
  ENV['APPSIGNAL_ENVIRONMENT'] = env
82
83
  ENV['APPSIGNAL_AGENT_VERSION'] = Appsignal::Extension.agent_version
83
84
  ENV['APPSIGNAL_DEBUG_LOGGING'] = config_hash[:debug].to_s
85
+ ENV['APPSIGNAL_LOG_FILE_PATH'] = config_hash[:log_file_path].to_s if config_hash[:log_file_path]
84
86
  ENV['APPSIGNAL_PUSH_API_ENDPOINT'] = config_hash[:endpoint]
85
87
  ENV['APPSIGNAL_PUSH_API_KEY'] = config_hash[:push_api_key]
86
88
  ENV['APPSIGNAL_APP_NAME'] = config_hash[:name]
@@ -127,7 +129,7 @@ module Appsignal
127
129
 
128
130
  # Configuration with string type
129
131
  %w(APPSIGNAL_PUSH_API_KEY APPSIGNAL_APP_NAME APPSIGNAL_PUSH_API_ENDPOINT
130
- APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH APPSIGNAL_HTTP_PROXY).each do |var|
132
+ APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH APPSIGNAL_HTTP_PROXY APPSIGNAL_LOG_FILE_PATH).each do |var|
131
133
  if env_var = ENV[var]
132
134
  config[ENV_TO_KEY_MAPPING[var]] = env_var
133
135
  end
@@ -6,9 +6,13 @@ module Appsignal::Integrations
6
6
  Appsignal.logger.info("Loading Padrino (#{Padrino::VERSION}) integration")
7
7
 
8
8
  root = Padrino.mounted_root
9
- Appsignal.config = Appsignal::Config.new(root, Padrino.env)
9
+ Appsignal.config = Appsignal::Config.new(
10
+ root,
11
+ Padrino.env,
12
+ :log_file_path => File.join(root, 'log/appsignal.log')
13
+ )
10
14
 
11
- Appsignal.start_logger(File.join(root, 'log'))
15
+ Appsignal.start_logger
12
16
  Appsignal.start
13
17
  end
14
18
  end
@@ -11,16 +11,17 @@ if defined?(::Rails)
11
11
  end
12
12
 
13
13
  def self.initialize_appsignal(app)
14
- # Start logger
15
- Appsignal.start_logger(Rails.root.join('log'))
16
-
17
14
  # Load config
18
15
  Appsignal.config = Appsignal::Config.new(
19
16
  Rails.root,
20
17
  ENV.fetch('APPSIGNAL_APP_ENV', Rails.env),
21
- :name => Rails.application.class.parent_name
18
+ :name => Rails.application.class.parent_name,
19
+ :log_file_path => Rails.root.join('log/appsignal.log')
22
20
  )
23
21
 
22
+ # Start logger
23
+ Appsignal.start_logger
24
+
24
25
  app.middleware.insert_before(
25
26
  ActionDispatch::RemoteIp,
26
27
  Appsignal::Rack::RailsInstrumentation
@@ -6,11 +6,11 @@ Appsignal.logger.info("Loading Sinatra (#{Sinatra::VERSION}) integration")
6
6
  app_settings = ::Sinatra::Application.settings
7
7
  Appsignal.config = Appsignal::Config.new(
8
8
  app_settings.root,
9
- app_settings.environment
9
+ app_settings.environment,
10
+ :log_file_path => File.join(app_settings.root, 'appsignal.log')
10
11
  )
11
12
 
12
- Appsignal.start_logger(app_settings.root)
13
-
13
+ Appsignal.start_logger
14
14
  Appsignal.start
15
15
 
16
16
  if Appsignal.active?
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '0.12.beta.53'
4
+ VERSION = '0.12.beta.54'
5
5
  end
@@ -63,6 +63,7 @@ describe Appsignal::Config do
63
63
  before do
64
64
  subject.config_hash[:http_proxy] = 'http://localhost'
65
65
  subject.config_hash[:ignore_actions] = ['action1', 'action2']
66
+ subject.config_hash[:log_file_path] = '/var/log/appsignal.log'
66
67
  subject.write_to_environment
67
68
  end
68
69
 
@@ -71,6 +72,7 @@ describe Appsignal::Config do
71
72
  ENV['APPSIGNAL_APP_PATH'].should end_with('spec/support/project_fixture')
72
73
  ENV['APPSIGNAL_AGENT_PATH'].should end_with('/ext')
73
74
  ENV['APPSIGNAL_DEBUG_LOGGING'].should == 'false'
75
+ ENV['APPSIGNAL_LOG_FILE_PATH'].should == '/var/log/appsignal.log'
74
76
  ENV['APPSIGNAL_PUSH_API_ENDPOINT'].should == 'https://push.appsignal.com'
75
77
  ENV['APPSIGNAL_PUSH_API_KEY'].should == 'abc'
76
78
  ENV['APPSIGNAL_APP_NAME'].should == 'TestApp'
@@ -28,9 +28,10 @@ if rails_present?
28
28
 
29
29
  it { should be_a(Appsignal::Config) }
30
30
 
31
- its(:root_path) { should == Pathname.new(project_fixture_path) }
32
- its(:env) { should == 'test' }
33
- its([:name]) { should == 'TestApp' }
31
+ its(:root_path) { should == Pathname.new(project_fixture_path) }
32
+ its(:env) { should == 'test' }
33
+ its([:name]) { should == 'TestApp' }
34
+ its([:log_file_path]) { should == Pathname.new(File.join(project_fixture_path, 'log/appsignal.log')) }
34
35
 
35
36
  context "initial config" do
36
37
  before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
@@ -5,9 +5,7 @@ describe Appsignal do
5
5
  before do
6
6
  # Make sure we have a clean state because we want to test
7
7
  # initialization here.
8
- Appsignal.agent.shutdown if Appsignal.agent
9
8
  Appsignal.config = nil
10
- Appsignal.agent = nil
11
9
  Appsignal.extensions.clear
12
10
  end
13
11
 
@@ -453,68 +451,75 @@ describe Appsignal do
453
451
 
454
452
  describe ".start_logger" do
455
453
  let(:out_stream) { StringIO.new }
454
+ let(:path) { File.join(project_fixture_path, 'log') }
456
455
  let(:log_file) { File.join(path, 'appsignal.log') }
456
+
457
457
  before do
458
458
  @original_stdout = $stdout
459
459
  $stdout = out_stream
460
460
  Appsignal.logger.error('Log something')
461
+ Appsignal.config = project_fixture_config(
462
+ 'production',
463
+ :log_file_path => log_file
464
+ )
461
465
  end
462
466
  after do
463
467
  $stdout = @original_stdout
464
468
  end
465
469
 
466
470
  context "when the log path is writable" do
467
- let(:path) { File.join(project_fixture_path, 'log') }
468
- before { Appsignal.start_logger(path) }
469
-
470
471
  it "should log to file" do
472
+ Appsignal.start_logger
473
+ Appsignal.logger.error('Log to file')
471
474
  File.exists?(log_file).should be_true
475
+ File.open(log_file).read.should include 'Log to file'
472
476
  File.open(log_file).read.should include 'Log something'
473
477
  end
474
478
  end
475
479
 
476
480
  context "when the log path is not writable" do
477
481
  let(:path) { '/nonsense/log' }
478
- before { Appsignal.start_logger(path) }
479
482
 
480
483
  it "should log to stdout" do
484
+ Appsignal.start_logger
481
485
  Appsignal.logger.error('Log to stdout')
482
486
  out_stream.string.should include 'appsignal: Log to stdout'
487
+ out_stream.string.should include 'Log something'
483
488
  end
484
489
  end
485
490
 
486
491
  context "when we're on Heroku" do
487
- let(:path) { File.join(project_fixture_path, 'log') }
488
492
  before do
489
493
  ENV['DYNO'] = 'dyno1'
490
- Appsignal.start_logger(path)
491
494
  end
492
495
  after { ENV.delete('DYNO') }
493
496
 
494
497
  it "should log to stdout" do
498
+ Appsignal.start_logger
495
499
  Appsignal.logger.error('Log to stdout')
496
500
  out_stream.string.should include 'appsignal: Log to stdout'
501
+ out_stream.string.should include 'Log something'
497
502
  end
498
503
  end
499
504
 
500
505
  context "when we're on Shelly Cloud" do
501
- let(:path) { File.join(project_fixture_path, 'log') }
502
506
  before do
503
507
  ENV['SHELLYCLOUD_DEPLOYMENT'] = 'true'
504
- Appsignal.start_logger(path)
505
508
  end
506
509
  after { ENV.delete('SHELLYCLOUD_DEPLOYMENT') }
507
510
 
508
511
  it "should log to stdout" do
512
+ Appsignal.start_logger
509
513
  Appsignal.logger.error('Log to stdout')
510
514
  out_stream.string.should include 'appsignal: Log to stdout'
515
+ out_stream.string.should include 'Log something'
511
516
  end
512
517
  end
513
518
 
514
519
  context "when there is no in memory log" do
515
520
  it "should not crash" do
516
521
  Appsignal.in_memory_log = nil
517
- Appsignal.start_logger(nil)
522
+ Appsignal.start_logger
518
523
  end
519
524
  end
520
525
  end
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: 0.12.beta.53
4
+ version: 0.12.beta.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-21 00:00:00.000000000 Z
12
+ date: 2015-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack