appsignal 0.12.rc.8 → 0.12.rc.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 638229bbdb0e216279fb2f10390b72bf7f030f8b
4
- data.tar.gz: 59785b7e222a6eefb6173c113d3b3bf03b74a3f7
3
+ metadata.gz: 17f4e46dd0c600079ccdb20831f64e73451749b4
4
+ data.tar.gz: 723ed8e27a02f660f8dc5135c8d4982a909c2bf6
5
5
  SHA512:
6
- metadata.gz: 70b9b08911109dba74572017b040cfcacb7f8ea0b42f73304a24bba61a5a49a8c48f9065b839cf4d40e02cdb6fa513c220bce54c2b461b8fc49f30076ee13ee2
7
- data.tar.gz: 09d494df6ba6f0abd07e2a00ac7f52c56e740e64fe682550d7cd6df45c05736fe99b8f1c70ac66809c54aefa74d5e4fa2ce4f52781b5001edba39d38428b5b6a
6
+ metadata.gz: 33d094d086f748d6932e93960bb1ebfd3cf1dcc3a77be03c68a3f32fca800caf35bb73551141c084702e6ecac3352cdad2f5d271dc083a74c9b3c8aca3fd16c7
7
+ data.tar.gz: ee504d004f15bab3e1786ef0b5241e8efa661d67883266559f81fc658b2e488c6d2904a53de91a01f54e0f72b0880577532002115d56411ca3b8c7b301e94daf
data/Rakefile CHANGED
@@ -3,8 +3,6 @@ GEMFILES = %w(
3
3
  capistrano3
4
4
  no_dependencies
5
5
  padrino
6
- rails-3.0
7
- rails-3.1
8
6
  rails-3.2
9
7
  rails-4.0
10
8
  rails-4.1
@@ -1,15 +1,15 @@
1
1
  ---
2
- :version: 4bf99f0
2
+ :version: 526bdf1
3
3
  :triples:
4
4
  x86_64-linux:
5
- :checksum: 7f02d2f36ff715254d9ec7b99c243ad3a2849ed05c79d0e7e11e4c7140aae576
6
- :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4bf99f0/appsignal-agent-x86_64-linux-static.tar.gz
5
+ :checksum: d5d83c289af971b40f23dc41a41567e0d41e98d2754eeed4427b7b2473881818
6
+ :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/526bdf1/appsignal-agent-x86_64-linux-static.tar.gz
7
7
  :lib_filename: libappsignal.a
8
8
  i686-linux:
9
- :checksum: 8103f83f4cf7d9bf22ebafb40216aede836d9d368cdf0f15d0d9644f3d9b4cf7
10
- :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4bf99f0/appsignal-agent-i686-linux-static.tar.gz
9
+ :checksum: b8b3bf1a5ae67e97ff623e1252c6f0299306951033e4fb93478aa76dc95218f1
10
+ :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/526bdf1/appsignal-agent-i686-linux-static.tar.gz
11
11
  :lib_filename: libappsignal.a
12
12
  x86_64-darwin:
13
- :checksum: 22937f34d26ea1dce722b102946a2f3daf3c30755d9f451c6440f580e3dc3eeb
14
- :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/4bf99f0/appsignal-agent-x86_64-darwin-static.tar.gz
13
+ :checksum: 4eab82317a874d4d3b7fc666ce562fa7e5f346cda22707d556a236894269a838
14
+ :download_url: https://appsignal-agent-releases.global.ssl.fastly.net/526bdf1/appsignal-agent-x86_64-darwin-static.tar.gz
15
15
  :lib_filename: libappsignal.a
@@ -2,6 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 3.2.14'
4
4
 
5
+ gem 'test-unit'
6
+
5
7
  gem 'generator_spec'
6
8
 
7
9
  gemspec :path => '../'
@@ -41,7 +41,7 @@ module Appsignal
41
41
  logger.level = Logger::INFO
42
42
  end
43
43
  if config.active?
44
- logger.info("Starting AppSignal #{Appsignal::VERSION} on #{RUBY_VERSION}/#{RUBY_PLATFORM}")
44
+ logger.info("Starting AppSignal #{Appsignal::VERSION} (#{$0}, Ruby #{RUBY_VERSION}, #{RUBY_PLATFORM})")
45
45
  config.write_to_environment
46
46
  Appsignal::Extension.start
47
47
  Appsignal::Hooks.load_hooks
@@ -192,8 +192,8 @@ module Appsignal
192
192
  end
193
193
 
194
194
  def start_logger(path_arg=nil)
195
- path = Appsignal.config ? Appsignal.config[:log_file_path] : nil
196
- if path && File.writable?(path) &&
195
+ path = Appsignal.config ? Appsignal.config.log_file_path : nil
196
+ if path && File.writable?(File.dirname(path)) &&
197
197
  !ENV['DYNO'] &&
198
198
  !ENV['SHELLYCLOUD_DEPLOYMENT']
199
199
  @logger = Logger.new(path)
@@ -30,7 +30,7 @@ module Appsignal
30
30
  'APPSIGNAL_PUSH_API_ENDPOINT' => :endpoint,
31
31
  'APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH' => :frontend_error_catching_path,
32
32
  'APPSIGNAL_DEBUG' => :debug,
33
- 'APPSIGNAL_LOG_FILE_PATH' => :log_file_path,
33
+ 'APPSIGNAL_LOG_PATH' => :log_path,
34
34
  'APPSIGNAL_INSTRUMENT_NET_HTTP' => :instrument_net_http,
35
35
  'APPSIGNAL_INSTRUMENT_REDIS' => :instrument_redis,
36
36
  'APPSIGNAL_INSTRUMENT_SEQUEL' => :instrument_sequel,
@@ -71,6 +71,14 @@ module Appsignal
71
71
  config_hash[key]
72
72
  end
73
73
 
74
+ def log_file_path
75
+ path = config_hash[:log_path] || root_path
76
+ File.join(File.realpath(path), 'appsignal.log')
77
+ rescue Errno::ENOENT
78
+ puts "appsignal: WARNING: log file path '#{path}' does not exist or is not writable"
79
+ nil
80
+ end
81
+
74
82
  def valid?
75
83
  @valid
76
84
  end
@@ -87,7 +95,7 @@ module Appsignal
87
95
  ENV['APPSIGNAL_AGENT_VERSION'] = Appsignal::Extension.agent_version
88
96
  ENV['APPSIGNAL_LANGUAGE_INTEGRATION_VERSION'] = Appsignal::VERSION
89
97
  ENV['APPSIGNAL_DEBUG_LOGGING'] = config_hash[:debug].to_s
90
- ENV['APPSIGNAL_LOG_FILE_PATH'] = config_hash[:log_file_path].to_s if config_hash[:log_file_path]
98
+ ENV['APPSIGNAL_LOG_FILE_PATH'] = log_file_path.to_s if log_file_path
91
99
  ENV['APPSIGNAL_PUSH_API_ENDPOINT'] = config_hash[:endpoint]
92
100
  ENV['APPSIGNAL_PUSH_API_KEY'] = config_hash[:push_api_key]
93
101
  ENV['APPSIGNAL_APP_NAME'] = config_hash[:name]
@@ -134,7 +142,7 @@ module Appsignal
134
142
 
135
143
  # Configuration with string type
136
144
  %w(APPSIGNAL_PUSH_API_KEY APPSIGNAL_APP_NAME APPSIGNAL_PUSH_API_ENDPOINT
137
- APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH APPSIGNAL_HTTP_PROXY APPSIGNAL_LOG_FILE_PATH).each do |var|
145
+ APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH APPSIGNAL_HTTP_PROXY APPSIGNAL_LOG_PATH).each do |var|
138
146
  if env_var = ENV[var]
139
147
  config[ENV_TO_KEY_MAPPING[var]] = env_var
140
148
  end
@@ -5,6 +5,7 @@ module Appsignal
5
5
 
6
6
  def dependencies_present?
7
7
  defined?(::Redis) &&
8
+ Appsignal.config &&
8
9
  Appsignal.config[:instrument_redis]
9
10
  end
10
11
 
@@ -20,6 +20,7 @@ module Appsignal
20
20
 
21
21
  def dependencies_present?
22
22
  defined?(::Sequel::Database) &&
23
+ Appsignal.config &&
23
24
  Appsignal.config[:instrument_sequel]
24
25
  end
25
26
 
@@ -9,7 +9,7 @@ module Appsignal::Integrations
9
9
  Appsignal.config = Appsignal::Config.new(
10
10
  root,
11
11
  Padrino.env,
12
- :log_file_path => File.join(root, 'log/appsignal.log')
12
+ :log_path => File.join(root, 'log')
13
13
  )
14
14
 
15
15
  Appsignal.start_logger
@@ -15,7 +15,7 @@ module Appsignal
15
15
  Rails.root,
16
16
  ENV.fetch('APPSIGNAL_APP_ENV', Rails.env),
17
17
  :name => Rails.application.class.parent_name,
18
- :log_file_path => Rails.root.join('log/appsignal.log')
18
+ :log_path => Rails.root.join('log')
19
19
  )
20
20
 
21
21
  # Start logger
@@ -6,8 +6,7 @@ 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,
10
- :log_file_path => File.join(app_settings.root, 'appsignal.log')
9
+ app_settings.environment
11
10
  )
12
11
 
13
12
  Appsignal.start_logger
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '0.12.rc.8'
4
+ VERSION = '0.12.rc.9'
5
5
  end
@@ -11,8 +11,9 @@ describe Appsignal::Config do
11
11
  subject
12
12
  end
13
13
 
14
- its(:valid?) { should be_true }
15
- its(:active?) { should be_true }
14
+ its(:valid?) { should be_true }
15
+ its(:active?) { should be_true }
16
+ its(:log_file_path) { should end_with('spec/support/project_fixture/appsignal.log') }
16
17
 
17
18
  it "should merge with the default config and fill the config hash" do
18
19
  subject.config_hash.should == {
@@ -35,6 +36,12 @@ describe Appsignal::Config do
35
36
  }
36
37
  end
37
38
 
39
+ context "if a log file path is set" do
40
+ let(:config) { project_fixture_config('production', :log_path => '/tmp') }
41
+
42
+ its(:log_file_path) { should end_with('/tmp/appsignal.log') }
43
+ end
44
+
38
45
  context "when there is a pre 0.12 style endpoint" do
39
46
  let(:config) { project_fixture_config('production', :endpoint => 'https://push.appsignal.com/1') }
40
47
 
@@ -65,7 +72,7 @@ describe Appsignal::Config do
65
72
  before do
66
73
  subject.config_hash[:http_proxy] = 'http://localhost'
67
74
  subject.config_hash[:ignore_actions] = ['action1', 'action2']
68
- subject.config_hash[:log_file_path] = '/var/log/appsignal.log'
75
+ subject.config_hash[:log_path] = '/tmp'
69
76
  subject.write_to_environment
70
77
  end
71
78
 
@@ -74,7 +81,7 @@ describe Appsignal::Config do
74
81
  ENV['APPSIGNAL_APP_PATH'].should end_with('spec/support/project_fixture')
75
82
  ENV['APPSIGNAL_AGENT_PATH'].should end_with('/ext')
76
83
  ENV['APPSIGNAL_DEBUG_LOGGING'].should == 'false'
77
- ENV['APPSIGNAL_LOG_FILE_PATH'].should == '/var/log/appsignal.log'
84
+ ENV['APPSIGNAL_LOG_FILE_PATH'].should end_with('/tmp/appsignal.log')
78
85
  ENV['APPSIGNAL_PUSH_API_ENDPOINT'].should == 'https://push.appsignal.com'
79
86
  ENV['APPSIGNAL_PUSH_API_KEY'].should == 'abc'
80
87
  ENV['APPSIGNAL_APP_NAME'].should == 'TestApp'
@@ -148,10 +155,11 @@ describe Appsignal::Config do
148
155
 
149
156
  context "when there is no config file" do
150
157
  let(:initial_config) { {} }
151
- let(:config) { Appsignal::Config.new('/nothing', 'production', initial_config) }
158
+ let(:config) { Appsignal::Config.new('/tmp', 'production', initial_config) }
152
159
 
153
- its(:valid?) { should be_false }
154
- its(:active?) { should be_false }
160
+ its(:valid?) { should be_false }
161
+ its(:active?) { should be_false }
162
+ its(:log_file_path) { should end_with('/tmp/appsignal.log') }
155
163
 
156
164
  context "with valid config in the environment" do
157
165
  before do
@@ -23,15 +23,17 @@ if rails_present?
23
23
  end
24
24
 
25
25
  context "config" do
26
- before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
27
26
  subject { Appsignal.config }
27
+ context "basics" do
28
+ before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
28
29
 
29
- it { should be_a(Appsignal::Config) }
30
+ it { should be_a(Appsignal::Config) }
30
31
 
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')) }
32
+ its(:root_path) { should == Pathname.new(project_fixture_path) }
33
+ its(:env) { should == 'test' }
34
+ its([:name]) { should == 'TestApp' }
35
+ its([:log_path]) { should == Pathname.new(File.join(project_fixture_path, 'log')) }
36
+ end
35
37
 
36
38
  context "initial config" do
37
39
  before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
@@ -41,10 +43,9 @@ if rails_present?
41
43
  end
42
44
 
43
45
  context "with APPSIGNAL_APP_ENV ENV var set" do
44
- around do |sample|
45
- ENV['APPSIGNAL_APP_ENV'] = 'env_test'
46
- sample.run
47
- ENV.delete('APPSIGNAL_APP_ENV')
46
+ before do
47
+ ENV.should_receive(:fetch).with('APPSIGNAL_APP_ENV', 'test').and_return('env_test')
48
+ Appsignal::Integrations::Railtie.initialize_appsignal(app)
48
49
  end
49
50
 
50
51
  its(:env) { should == 'env_test' }
@@ -426,16 +426,17 @@ describe Appsignal do
426
426
 
427
427
  describe ".start_logger" do
428
428
  let(:out_stream) { StringIO.new }
429
- let(:path) { File.join(project_fixture_path, 'log') }
430
- let(:log_file) { File.join(path, 'appsignal.log') }
429
+ let(:log_path) { File.join(project_fixture_path, 'log') }
430
+ let(:log_file) { File.join(log_path, 'appsignal.log') }
431
431
 
432
432
  before do
433
+ FileUtils.rm_f(log_file)
433
434
  @original_stdout = $stdout
434
435
  $stdout = out_stream
435
436
  Appsignal.logger.error('Log something')
436
437
  Appsignal.config = project_fixture_config(
437
438
  'production',
438
- :log_file_path => log_file
439
+ :log_path => log_path
439
440
  )
440
441
  end
441
442
  after do
@@ -453,7 +454,7 @@ describe Appsignal do
453
454
  end
454
455
 
455
456
  context "when the log path is not writable" do
456
- let(:path) { '/nonsense/log' }
457
+ let(:log_path) { '/nonsense/log' }
457
458
 
458
459
  it "should log to stdout" do
459
460
  Appsignal.start_logger
@@ -5,16 +5,11 @@ module ConfigHelpers
5
5
  )
6
6
  end
7
7
 
8
- def project_fixture_log_file
9
- File.join(project_fixture_path, 'log/appsignal.log')
10
- end
11
-
12
- def project_fixture_config(env='production', initial_config={}, logger=Logger.new(project_fixture_log_file))
8
+ def project_fixture_config(env='production', initial_config={})
13
9
  Appsignal::Config.new(
14
10
  project_fixture_path,
15
11
  env,
16
- initial_config,
17
- logger
12
+ initial_config
18
13
  )
19
14
  end
20
15
 
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.rc.8
4
+ version: 0.12.rc.9
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-11-24 00:00:00.000000000 Z
12
+ date: 2015-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -136,8 +136,6 @@ files:
136
136
  - gemfiles/capistrano3.gemfile
137
137
  - gemfiles/no_dependencies.gemfile
138
138
  - gemfiles/padrino.gemfile
139
- - gemfiles/rails-3.0.gemfile
140
- - gemfiles/rails-3.1.gemfile
141
139
  - gemfiles/rails-3.2.gemfile
142
140
  - gemfiles/rails-4.0.gemfile
143
141
  - gemfiles/rails-4.1.gemfile
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 3.0.20'
4
-
5
- gem 'generator_spec'
6
-
7
- gemspec :path => '../'
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 3.1.12'
4
-
5
- gem 'generator_spec'
6
-
7
- gemspec :path => '../'