appsignal 0.11.4.beta.0 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4c8ab8dd23da24db4847a9f58aa98010d54a15ea
4
+ data.tar.gz: 043115dbfa42457092430ea5aa7f4378f39f81ea
5
+ SHA512:
6
+ metadata.gz: c5f91a18470ba264264e86a1f9bdffd2bb555e654d2228fc24413876e7bfb0c17f00a52d1ee9056dfa875184159a49c4438bf2740fe0c3d93041cde07df3a6a8
7
+ data.tar.gz: dc58b2e4361a927b3e274968746f9d155e1c0e33ebe4e5fc2d5fe173bd7bac5e1155458183a8eec0feec3b4b80d2bca9e3de17f378ada9f5a9580032497456f7
@@ -1,5 +1,5 @@
1
1
  # 0.11.4
2
- * Set SSL version to TLSv1 explicitely
2
+ * Make `without_instrumentation` thread safe
3
3
 
4
4
  # 0.11.3
5
5
  * Support Ruby 1.9 and up instead of 1.9.3 and up
@@ -175,10 +175,10 @@ module Appsignal
175
175
  #
176
176
  # @since 0.8.7
177
177
  def without_instrumentation
178
- agent.paused = true if agent
178
+ Appsignal::Transaction.current.pause! if Appsignal::Transaction.current
179
179
  yield
180
180
  ensure
181
- agent.paused = false if agent
181
+ Appsignal::Transaction.current.resume! if Appsignal::Transaction.current
182
182
  end
183
183
  end
184
184
  end
@@ -73,7 +73,7 @@ module Appsignal
73
73
  elsif event.name.start_with?('perform_job')
74
74
  Appsignal::Transaction.current.set_perform_job_event(event)
75
75
  end
76
- Appsignal::Transaction.current.add_event(event) unless paused
76
+ Appsignal::Transaction.current.add_event(event)
77
77
  end
78
78
  end
79
79
  end
@@ -31,7 +31,7 @@ module Appsignal
31
31
  end
32
32
 
33
33
  attr_reader :request_id, :events, :process_action_event, :action, :exception,
34
- :env, :fullpath, :time, :tags, :kind, :queue_start
34
+ :env, :fullpath, :time, :tags, :kind, :queue_start, :paused
35
35
 
36
36
  def initialize(request_id, env)
37
37
  Appsignal.transactions[request_id] = self
@@ -41,6 +41,7 @@ module Appsignal
41
41
  @exception = nil
42
42
  @env = env
43
43
  @tags = {}
44
+ @paused = false
44
45
  end
45
46
 
46
47
  def sanitized_environment
@@ -59,6 +60,14 @@ module Appsignal
59
60
  @tags.merge!(given_tags)
60
61
  end
61
62
 
63
+ def pause!
64
+ @paused = true
65
+ end
66
+
67
+ def resume!
68
+ @paused = false
69
+ end
70
+
62
71
  def set_process_action_event(event)
63
72
  return unless event && event.payload
64
73
  @process_action_event = event.dup
@@ -76,7 +85,7 @@ module Appsignal
76
85
  end
77
86
 
78
87
  def add_event(event)
79
- @events << event
88
+ @events << event unless @paused == true
80
89
  end
81
90
 
82
91
  def add_exception(ex)
@@ -62,10 +62,9 @@ module Appsignal
62
62
  def http_client
63
63
  Net::HTTP.new(uri.host, uri.port).tap do |http|
64
64
  if uri.scheme == 'https'
65
- http.use_ssl = true
65
+ http.use_ssl = true
66
66
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
67
- http.ssl_version = :TLSv1
68
- http.ca_file = CA_FILE_PATH
67
+ http.ca_file = CA_FILE_PATH
69
68
  end
70
69
  end
71
70
  end
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.11.4.beta.0'
2
+ VERSION = '0.11.4'
3
3
  end
@@ -189,16 +189,6 @@ describe Appsignal::Agent do
189
189
  ActiveSupport::Notifications.instrument 'render_template'
190
190
  end
191
191
 
192
- context "when paused" do
193
- it "should add a normal event" do
194
- Appsignal::Transaction.current.should_not_receive(:add_event)
195
-
196
- Appsignal.without_instrumentation do
197
- ActiveSupport::Notifications.instrument 'moo'
198
- end
199
- end
200
- end
201
-
202
192
  it "should add and set a process action event" do
203
193
  Appsignal::Transaction.current.should_receive(:set_process_action_event).with(
204
194
  kind_of(ActiveSupport::Notifications::Event)
@@ -147,6 +147,34 @@ describe Appsignal::Transaction do
147
147
  transaction.add_event(event)
148
148
  }.to change(transaction, :events).to([event])
149
149
  end
150
+
151
+ context "when paused" do
152
+ before { transaction.pause! }
153
+
154
+ it 'should add an event' do
155
+ expect {
156
+ transaction.add_event(event)
157
+ }.to_not change(transaction, :events)
158
+ end
159
+ end
160
+ end
161
+
162
+ describe "#pause!" do
163
+ it "should change the pause flag to true" do
164
+ expect{
165
+ transaction.pause!
166
+ }.to change(transaction, :paused).from(false).to(true)
167
+ end
168
+ end
169
+
170
+ describe "#resume!" do
171
+ before { transaction.pause! }
172
+
173
+ it "should change the pause flag to false" do
174
+ expect{
175
+ transaction.resume!
176
+ }.to change(transaction, :paused).from(true).to(false)
177
+ end
150
178
  end
151
179
 
152
180
  context "using exceptions" do
@@ -484,18 +484,16 @@ describe Appsignal do
484
484
  end
485
485
 
486
486
  describe ".without_instrumentation" do
487
- let(:agent) { double }
488
- before do
489
- Appsignal.stub(:agent => agent)
490
- end
487
+ let(:transaction) { double }
488
+ before { Appsignal::Transaction.stub(:current => transaction) }
491
489
 
492
- it "should pause and unpause the agent around the block" do
493
- agent.should_receive(:paused=).with(true)
494
- agent.should_receive(:paused=).with(false)
490
+ it "should pause and unpause the transaction around the block" do
491
+ transaction.should_receive(:pause!)
492
+ transaction.should_receive(:resume!)
495
493
  end
496
494
 
497
- context "without agent" do
498
- let(:agent) { nil }
495
+ context "without transaction" do
496
+ let(:transaction) { nil }
499
497
 
500
498
  it "should not crash" do
501
499
  # just execute the after block
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4.beta.0
5
- prerelease: 7
4
+ version: 0.11.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Robert Beekman
@@ -13,118 +12,104 @@ authors:
13
12
  autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
- date: 2015-02-03 00:00:00.000000000 Z
15
+ date: 2015-02-05 00:00:00.000000000 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: rack
20
19
  requirement: !ruby/object:Gem::Requirement
21
- none: false
22
20
  requirements:
23
- - - ! '>='
21
+ - - ">="
24
22
  - !ruby/object:Gem::Version
25
23
  version: '0'
26
24
  type: :runtime
27
25
  prerelease: false
28
26
  version_requirements: !ruby/object:Gem::Requirement
29
- none: false
30
27
  requirements:
31
- - - ! '>='
28
+ - - ">="
32
29
  - !ruby/object:Gem::Version
33
30
  version: '0'
34
31
  - !ruby/object:Gem::Dependency
35
32
  name: thread_safe
36
33
  requirement: !ruby/object:Gem::Requirement
37
- none: false
38
34
  requirements:
39
- - - ! '>='
35
+ - - ">="
40
36
  - !ruby/object:Gem::Version
41
37
  version: '0'
42
38
  type: :runtime
43
39
  prerelease: false
44
40
  version_requirements: !ruby/object:Gem::Requirement
45
- none: false
46
41
  requirements:
47
- - - ! '>='
42
+ - - ">="
48
43
  - !ruby/object:Gem::Version
49
44
  version: '0'
50
45
  - !ruby/object:Gem::Dependency
51
46
  name: rake
52
47
  requirement: !ruby/object:Gem::Requirement
53
- none: false
54
48
  requirements:
55
- - - ! '>='
49
+ - - ">="
56
50
  - !ruby/object:Gem::Version
57
51
  version: '0'
58
52
  type: :development
59
53
  prerelease: false
60
54
  version_requirements: !ruby/object:Gem::Requirement
61
- none: false
62
55
  requirements:
63
- - - ! '>='
56
+ - - ">="
64
57
  - !ruby/object:Gem::Version
65
58
  version: '0'
66
59
  - !ruby/object:Gem::Dependency
67
60
  name: rspec
68
61
  requirement: !ruby/object:Gem::Requirement
69
- none: false
70
62
  requirements:
71
- - - ~>
63
+ - - "~>"
72
64
  - !ruby/object:Gem::Version
73
65
  version: 2.14.1
74
66
  type: :development
75
67
  prerelease: false
76
68
  version_requirements: !ruby/object:Gem::Requirement
77
- none: false
78
69
  requirements:
79
- - - ~>
70
+ - - "~>"
80
71
  - !ruby/object:Gem::Version
81
72
  version: 2.14.1
82
73
  - !ruby/object:Gem::Dependency
83
74
  name: pry
84
75
  requirement: !ruby/object:Gem::Requirement
85
- none: false
86
76
  requirements:
87
- - - ! '>='
77
+ - - ">="
88
78
  - !ruby/object:Gem::Version
89
79
  version: '0'
90
80
  type: :development
91
81
  prerelease: false
92
82
  version_requirements: !ruby/object:Gem::Requirement
93
- none: false
94
83
  requirements:
95
- - - ! '>='
84
+ - - ">="
96
85
  - !ruby/object:Gem::Version
97
86
  version: '0'
98
87
  - !ruby/object:Gem::Dependency
99
88
  name: timecop
100
89
  requirement: !ruby/object:Gem::Requirement
101
- none: false
102
90
  requirements:
103
- - - ! '>='
91
+ - - ">="
104
92
  - !ruby/object:Gem::Version
105
93
  version: '0'
106
94
  type: :development
107
95
  prerelease: false
108
96
  version_requirements: !ruby/object:Gem::Requirement
109
- none: false
110
97
  requirements:
111
- - - ! '>='
98
+ - - ">="
112
99
  - !ruby/object:Gem::Version
113
100
  version: '0'
114
101
  - !ruby/object:Gem::Dependency
115
102
  name: webmock
116
103
  requirement: !ruby/object:Gem::Requirement
117
- none: false
118
104
  requirements:
119
- - - ! '>='
105
+ - - ">="
120
106
  - !ruby/object:Gem::Version
121
107
  version: '0'
122
108
  type: :development
123
109
  prerelease: false
124
110
  version_requirements: !ruby/object:Gem::Requirement
125
- none: false
126
111
  requirements:
127
- - - ! '>='
112
+ - - ">="
128
113
  - !ruby/object:Gem::Version
129
114
  version: '0'
130
115
  description: The official appsignal.com gem
@@ -135,9 +120,9 @@ executables:
135
120
  extensions: []
136
121
  extra_rdoc_files: []
137
122
  files:
138
- - .gitignore
139
- - .rspec
140
- - .travis.yml
123
+ - ".gitignore"
124
+ - ".rspec"
125
+ - ".travis.yml"
141
126
  - CHANGELOG.md
142
127
  - Gemfile
143
128
  - LICENSE
@@ -247,27 +232,26 @@ files:
247
232
  homepage: https://github.com/appsignal/appsignal
248
233
  licenses:
249
234
  - MIT
235
+ metadata: {}
250
236
  post_install_message:
251
237
  rdoc_options: []
252
238
  require_paths:
253
239
  - lib
254
240
  required_ruby_version: !ruby/object:Gem::Requirement
255
- none: false
256
241
  requirements:
257
- - - ! '>='
242
+ - - ">="
258
243
  - !ruby/object:Gem::Version
259
244
  version: '1.9'
260
245
  required_rubygems_version: !ruby/object:Gem::Requirement
261
- none: false
262
246
  requirements:
263
- - - ! '>'
247
+ - - ">="
264
248
  - !ruby/object:Gem::Version
265
- version: 1.3.1
249
+ version: '0'
266
250
  requirements: []
267
251
  rubyforge_project:
268
- rubygems_version: 1.8.23
252
+ rubygems_version: 2.2.2
269
253
  signing_key:
270
- specification_version: 3
254
+ specification_version: 4
271
255
  summary: Logs performance and exception data from your app to appsignal.com
272
256
  test_files:
273
257
  - spec/lib/appsignal/agent_spec.rb