appsignal 1.0.2.beta.2 → 1.0.2.beta.3

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: 3f36d616a5d3b8b733ddd15d216456e50601f930
4
- data.tar.gz: 761c684ee8233971e4fccfee5c78bd1b33a2dc76
3
+ metadata.gz: 4a01467c85c347db2cbbc1eb55f4524d7b3538dd
4
+ data.tar.gz: 9f95f2f8bacb616e584576aa3040e4f2bd0965ac
5
5
  SHA512:
6
- metadata.gz: e7e49663cb6de6be789523707bef779237d26a80e0a95c55461bfc1acf633b50fbee580fa74a0d60faba384d1adda69fa2aa0d91a4d20479c0a71c7743bf38e3
7
- data.tar.gz: 44afacf18a4f27aaf381d0882f62ff0cc0cf4233e2fe3618bd48e0290cfee4d769fd5502b68468b8164a84d73dc7c82b4484fd28504e622efd4c2090ec877161
6
+ metadata.gz: ada7231ed4c993cf94202aaab459bfca8fca6e0c4e50fdfcc77ccb8e50204e1e71648d77fed727fcccfdc57c848c925b099865de1892829972e160834911aaee
7
+ data.tar.gz: 9bbbbf3c540af6645e0cca554d51e0f62e1fc2b3382f63c0a11c8fb22ff12a231b669ff25593bb601b91f03c588a3f1fb583188591be482d48913871783efbc0
@@ -2,6 +2,8 @@
2
2
  * Bug fix in format of process memory measurements
3
3
  * Event formatter for `instantiation.active_record`
4
4
  * Rake integration file for backwards compatibility
5
+ * Don't instrument mongo-ruby-driver when transaction is not present
6
+ * Accept method calls on extension if it's not loaded
5
7
 
6
8
  # 1.0.1
7
9
  * Fix for bug in gem initialization when using `safe_yaml` gem
data/README.md CHANGED
@@ -30,3 +30,10 @@ BUNDLE_GEMFILE=gemfiles/sinatra.gemfile bundle exec rspec
30
30
  Or run `rake generate_bundle_and_spec_all` to generate a script that runs specs for all
31
31
  Ruby versions and gem combinations we support.
32
32
  You need Rvm or Rbenv to do this. Travis will run specs for these combinations as well.
33
+
34
+ ## Branches and versions
35
+
36
+ The `master` branch corresponds to the current release of the gem. The
37
+ `develop` branch is used for development of features that will end up in
38
+ the next minor release. If you fix a bug open a pull request on `master`, if
39
+ it's a new feature on `develop`.
@@ -13,14 +13,20 @@ end
13
13
 
14
14
  module Appsignal
15
15
  class Extension
16
- def self.agent_config
17
- @agent_config ||= YAML.load(
18
- File.read(File.join(File.dirname(__FILE__), '../../ext/agent.yml'))
19
- )
20
- end
16
+ class << self
17
+ def agent_config
18
+ @agent_config ||= YAML.load(
19
+ File.read(File.join(File.dirname(__FILE__), '../../ext/agent.yml'))
20
+ )
21
+ end
22
+
23
+ def agent_version
24
+ agent_config['version']
25
+ end
21
26
 
22
- def self.agent_version
23
- agent_config['version']
27
+ def method_missing(m, *args, &block)
28
+ # Do nothing if the extension methods are not loaded
29
+ end
24
30
  end
25
31
  end
26
32
  end
@@ -4,7 +4,8 @@ module Appsignal
4
4
 
5
5
  # Called by Mongo::Monitor when query starts
6
6
  def started(event)
7
- return unless transaction = Appsignal::Transaction.current
7
+ transaction = Appsignal::Transaction.current
8
+ return if transaction.nil_transaction?
8
9
  return if transaction.paused?
9
10
 
10
11
  # Store the query on the transaction, we need it when the event finishes
@@ -29,7 +30,8 @@ module Appsignal
29
30
 
30
31
  # Finishes the event in the AppSignal extension
31
32
  def finish(result, event)
32
- return unless transaction = Appsignal::Transaction.current
33
+ transaction = Appsignal::Transaction.current
34
+ return if transaction.nil_transaction?
33
35
  return if transaction.paused?
34
36
 
35
37
  # Get the query from the transaction store
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '1.0.2.beta.2'
4
+ VERSION = '1.0.2.beta.3'
5
5
  end
@@ -18,7 +18,7 @@ describe "extension loading and operation" do
18
18
  context "when the extension library can be loaded" do
19
19
  subject { Appsignal::Extension }
20
20
 
21
- it "should load the extension" do
21
+ it "should indicate that the extension is loaded" do
22
22
  Appsignal.extension_loaded?.should be_true
23
23
  end
24
24
 
@@ -74,16 +74,37 @@ describe "extension loading and operation" do
74
74
  end
75
75
 
76
76
  it "should have a set_gauge method" do
77
- Appsignal.set_gauge('key', 1.0)
77
+ subject.set_gauge('key', 1.0)
78
78
  end
79
79
 
80
80
  it "should have a increment_counter method" do
81
- Appsignal.increment_counter('key', 1)
81
+ subject.increment_counter('key', 1)
82
82
  end
83
83
 
84
84
  it "should have a add_distribution_value method" do
85
- Appsignal.add_distribution_value('key', 1.0)
85
+ subject.add_distribution_value('key', 1.0)
86
86
  end
87
87
  end
88
88
  end
89
+
90
+ context "when the extension library cannot be loaded" do
91
+ subject { Appsignal::Extension }
92
+
93
+ before :all do
94
+ Appsignal.extension_loaded = false
95
+ end
96
+ after :all do
97
+ Appsignal.extension_loaded = true
98
+ end
99
+
100
+ it "should indicate that the extension is not loaded" do
101
+ Appsignal.extension_loaded?.should be_false
102
+ end
103
+
104
+ it "should not raise errors when methods are called" do
105
+ expect {
106
+ subject.something
107
+ }.not_to raise_error
108
+ end
109
+ end
89
110
  end
@@ -91,7 +91,11 @@ describe Appsignal::Hooks::MongoMonitorSubscriber do
91
91
  end
92
92
 
93
93
  context "without transaction" do
94
- before { Appsignal::Transaction.stub(:current => nil) }
94
+ before do
95
+ Appsignal::Transaction.stub(
96
+ :current => Appsignal::Transaction::NilTransaction.new
97
+ )
98
+ end
95
99
 
96
100
  it "should not attempt to start an event" do
97
101
  Appsignal::Extension.should_not receive(:start_event)
@@ -107,7 +111,7 @@ describe Appsignal::Hooks::MongoMonitorSubscriber do
107
111
  end
108
112
 
109
113
  context "when appsignal is paused" do
110
- let(:transaction) { double(:paused? => true) }
114
+ let(:transaction) { double(:paused? => true, :nil_transaction? => false) }
111
115
  before { Appsignal::Transaction.stub(:current => transaction) }
112
116
 
113
117
  it "should not attempt to start an event" do
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: 1.0.2.beta.2
4
+ version: 1.0.2.beta.3
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: 2016-01-21 00:00:00.000000000 Z
12
+ date: 2016-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack