newrelic_rpm 3.3.2.beta2 → 3.3.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of newrelic_rpm might be problematic. Click here for more details.

@@ -1272,7 +1272,7 @@ module NewRelic
1272
1272
  def save_or_transmit_data
1273
1273
  if NewRelic::DataSerialization.should_send_data?
1274
1274
  log.debug "Sending data to New Relic Service"
1275
- NewRelic::Agent.load_data
1275
+ NewRelic::Agent.load_data unless NewRelic::Control.instance.disable_serialization?
1276
1276
  harvest_and_send_errors
1277
1277
  harvest_and_send_slowest_sample
1278
1278
  harvest_and_send_slowest_sql
@@ -42,21 +42,21 @@ module NewRelic
42
42
  end
43
43
 
44
44
  def pid_too_old?
45
- create_pid_file unless File.exists?(pid_file_path)
45
+ return true unless File.exists?(pid_file_path)
46
46
  age = (Time.now.to_i - File.mtime(pid_file_path).to_i)
47
47
  NewRelic::Control.instance.log.debug("Pid was #{age} seconds old, sending data") if age > 60
48
48
  age > 60
49
49
  end
50
50
 
51
51
  def store_too_old?
52
- FileUtils.touch(file_path) unless File.exists?(file_path)
52
+ return true unless File.exists?(file_path)
53
53
  age = (Time.now.to_i - File.mtime(file_path).to_i)
54
54
  NewRelic::Control.instance.log.debug("Store was #{age} seconds old, sending data") if age > 60
55
55
  age > 50
56
56
  end
57
57
 
58
58
  def store_too_large?
59
- FileUtils.touch(file_path) unless File.exists?(file_path)
59
+ return true unless File.exists?(file_path)
60
60
  size = File.size(file_path) > max_size
61
61
  NewRelic::Control.instance.log.debug("Store was oversize, sending data") if size
62
62
  size
@@ -136,16 +136,7 @@ module NewRelic
136
136
  NewRelic::Control.instance.log.debug(e.backtrace.inspect)
137
137
  nil
138
138
  end
139
-
140
- def truncate_file
141
- FileUtils.touch(file_path)
142
- File.truncate(file_path, 0)
143
- end
144
-
145
- def create_pid_file
146
- File.open(pid_file_path, 'w') {|f| f.write $$ }
147
- end
148
-
139
+
149
140
  def file_path
150
141
  "#{NewRelic::Control.instance.log_path}/newrelic_agent_store.db"
151
142
  end
@@ -4,7 +4,7 @@ module NewRelic
4
4
  MAJOR = 3
5
5
  MINOR = 3
6
6
  TINY = 2
7
- BUILD = 'beta2' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
7
+ BUILD = nil # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
10
10
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{newrelic_rpm}
8
- s.version = "3.3.2.beta2"
8
+ s.version = "3.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bill Kayser", "Jon Guymon", "Justin George", "Darin Swanson"]
12
- s.date = %q{2012-02-10}
12
+ s.date = %q{2012-02-16}
13
13
  s.description = %q{New Relic is a performance management system, developed by New Relic,
14
14
  Inc (http://www.newrelic.com). New Relic provides you with deep
15
15
  information about the performance of your web application as it runs
@@ -16,6 +16,7 @@ module NewRelic
16
16
  end
17
17
 
18
18
  def test_save_or_transmit_data_should_transmit
19
+ NewRelic::Control.instance.stubs(:disable_serialization?).returns(false)
19
20
  NewRelic::Agent.expects(:load_data)
20
21
  @agent.expects(:harvest_and_send_timeslice_data)
21
22
  @agent.expects(:harvest_and_send_slowest_sample)
@@ -29,15 +29,6 @@ class NewRelic::DataSerializationTest < Test::Unit::TestCase
29
29
  end
30
30
  assert_equal(0, File.size(file), "Should not leave any data in the file")
31
31
  end
32
-
33
- def test_bad_paths
34
- NewRelic::Control.instance.stubs(:log_path).returns("/bad/path")
35
- assert NewRelic::DataSerialization.should_send_data?
36
- NewRelic::DataSerialization.read_and_write_to_file do
37
- 'a happy string'
38
- end
39
- assert !File.exists?(file)
40
- end
41
32
 
42
33
  def test_read_and_write_to_file_dumping_contents
43
34
  expected_contents = Marshal.dump('a happy string')
@@ -144,12 +135,20 @@ class NewRelic::DataSerializationTest < Test::Unit::TestCase
144
135
  def test_pid_age_creates_pid_file_if_none_exists
145
136
  assert(!File.exists?("#{@path}/newrelic_agent_store.pid"),
146
137
  'pid file found, should not be there')
147
- assert(!NewRelic::DataSerialization.pid_too_old?,
148
- "new pid should not be too old")
138
+ NewRelic::DataSerialization.update_last_sent!
149
139
  assert(File.exists?("#{@path}/newrelic_agent_store.pid"),
150
140
  'pid file not found, should be there')
151
141
  end
152
-
142
+
143
+ def test_should_not_create_files_if_serialization_disabled
144
+ NewRelic::Control.instance['disable_serialization'] = true
145
+ NewRelic::DataSerialization.should_send_data?
146
+ assert(!File.exists?("#{@path}/newrelic_agent_store.db"),
147
+ 'db file created when serialization disabled')
148
+ assert(!File.exists?("#{@path}/newrelic_agent_store.pid"),
149
+ 'pid file created when serialization disabled')
150
+ end
151
+
153
152
  def test_loading_does_not_seg_fault_if_gc_triggers
154
153
  return if NewRelic::LanguageSupport.using_version?('1.8.6')
155
154
  require 'timeout'
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196455
5
- prerelease: 6
4
+ hash: 15
5
+ prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
9
  - 2
10
- - beta
11
- - 2
12
- version: 3.3.2.beta2
10
+ version: 3.3.2
13
11
  platform: ruby
14
12
  authors:
15
13
  - Bill Kayser
@@ -20,7 +18,7 @@ autorequire:
20
18
  bindir: bin
21
19
  cert_chain: []
22
20
 
23
- date: 2012-02-10 00:00:00 -08:00
21
+ date: 2012-02-16 00:00:00 -08:00
24
22
  default_executable:
25
23
  dependencies:
26
24
  - !ruby/object:Gem::Dependency