appsignal 1.1.2 → 1.1.3.beta.1

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.
@@ -1,5 +1,11 @@
1
+ # 1.1.3
2
+ * Fix for issue where Appsignal.send_exception clears the current
3
+ transaction if it is present
4
+ * Rails 3.0 compatibility fix
5
+
1
6
  # 1.1.2
2
7
  * Bug fix in notify of deploy cli
8
+ * Better support for nil, true and false in sanitization
3
9
 
4
10
  # 1.1.1
5
11
  * Collect global metrics for GC durations (in beta, disabled by default)
@@ -132,14 +132,14 @@ module Appsignal
132
132
  logger.error('Can\'t send error, given value is not an exception')
133
133
  return
134
134
  end
135
- transaction = Appsignal::Transaction.create(
135
+ transaction = Appsignal::Transaction.new(
136
136
  SecureRandom.uuid,
137
137
  namespace,
138
138
  Appsignal::Transaction::GenericRequest.new({})
139
139
  )
140
140
  transaction.set_tags(tags) if tags
141
141
  transaction.set_error(error)
142
- Appsignal::Transaction.complete_current!
142
+ transaction.complete
143
143
  end
144
144
  alias :send_exception :send_error
145
145
 
@@ -19,9 +19,9 @@ module Appsignal
19
19
  puts
20
20
  unless push_api_key
21
21
  puts colorize 'Problem encountered:', :red
22
- puts ' No push api key entered.'
22
+ puts ' No push API key entered.'
23
23
  puts ' - Sign up for AppSignal and follow the instructions'
24
- puts " - Already signed up? Click 'new app' on the account overview"
24
+ puts " - Already signed up? Click 'New app' on the account overview page"
25
25
  puts
26
26
  puts colorize 'Exiting installer...', :red
27
27
  return false
@@ -29,22 +29,22 @@ module Appsignal
29
29
 
30
30
  config[:push_api_key] = push_api_key
31
31
 
32
- print 'Validating api key'
32
+ print 'Validating API key'
33
33
  periods
34
34
  puts
35
35
  begin
36
36
  auth_check = Appsignal::AuthCheck.new(config)
37
37
  unless auth_check.perform == '200'
38
- puts "\n Api key '#{config[:push_api_key]}' is not valid, please get a new one on https://appsignal.com"
38
+ puts "\n API key '#{config[:push_api_key]}' is not valid, please get a new one on https://appsignal.com"
39
39
  return false
40
40
  end
41
41
  rescue Exception => e
42
- puts " There was an error validating your api key:"
42
+ puts " There was an error validating your API key:"
43
43
  puts colorize "'#{e}'", :red
44
44
  puts " Please try again"
45
45
  return false
46
46
  end
47
- puts colorize ' Api key valid!', :green
47
+ puts colorize ' API key valid!', :green
48
48
  puts
49
49
 
50
50
  if installed_frameworks.include?(:rails)
@@ -56,7 +56,7 @@ module Appsignal
56
56
  elsif installed_frameworks.include?(:grape)
57
57
  install_for_grape(config)
58
58
  else
59
- puts "We could not detect which framework you are using. We'll be very grateful if you e-mail ons on support@appsignal.com with information about your setup."
59
+ puts "We could not detect which framework you are using. We'd be very grateful if you email us on support@appsignal.com with information about your setup."
60
60
  return false
61
61
  end
62
62
 
@@ -189,7 +189,7 @@ module Appsignal
189
189
  def configure(config, environments, name_overwritten)
190
190
  puts "How do you want to configure AppSignal?"
191
191
  puts " (1) a config file"
192
- puts " (2) environment variables?"
192
+ puts " (2) environment variables"
193
193
  loop do
194
194
  print " Choose (1/2): "
195
195
  input = gets.chomp
@@ -230,7 +230,7 @@ module Appsignal
230
230
  puts colorize "#####################################", :green
231
231
  sleep 0.3
232
232
  puts
233
- puts ' Now you need to send us some data!'
233
+ puts ' Now you need to send us some data...'
234
234
  puts
235
235
  if Gem.win_platform?
236
236
  puts 'The AppSignal agent currently does not work on Windows, please push these changes to your test/staging/production environment'
@@ -241,9 +241,9 @@ module Appsignal
241
241
  puts
242
242
  puts " Test if AppSignal is receiving data:"
243
243
  puts " - Requests > 200ms are shown in AppSignal"
244
- puts " - Generate an error to test (add .xml to any path!)"
244
+ puts " - Generate an error to test (e.g. add .xml to a url)"
245
245
  puts
246
- puts "Return to your browser and follow the instructions!"
246
+ puts "Please return to your browser and follow the instructions."
247
247
  end
248
248
  end
249
249
 
@@ -19,7 +19,7 @@ module Appsignal
19
19
  def call_with_appsignal_monitoring(env)
20
20
  request = ActionDispatch::Request.new(env)
21
21
  transaction = Appsignal::Transaction.create(
22
- env['action_dispatch.request_id'],
22
+ request_id(env),
23
23
  Appsignal::Transaction::HTTP_REQUEST,
24
24
  request,
25
25
  :params_method => :filtered_parameters
@@ -40,6 +40,10 @@ module Appsignal
40
40
  Appsignal::Transaction.complete_current!
41
41
  end
42
42
  end
43
+
44
+ def request_id(env)
45
+ env['action_dispatch.request_id'] || SecureRandom.uuid
46
+ end
43
47
  end
44
48
  end
45
49
  end
@@ -32,7 +32,7 @@ module Appsignal
32
32
 
33
33
  attr_reader :transaction_index, :transaction_id, :namespace, :request, :paused, :tags, :options
34
34
 
35
- def initialize(transaction_id, namespace, request, options)
35
+ def initialize(transaction_id, namespace, request, options={})
36
36
  @transaction_id = transaction_id
37
37
  @namespace = namespace
38
38
  @request = request
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
2
 
3
3
  module Appsignal
4
- VERSION = '1.1.2'
4
+ VERSION = '1.1.3.beta.1'
5
5
  end
@@ -30,7 +30,7 @@ describe Appsignal::CLI::Install do
30
30
  cli.run(nil, config)
31
31
 
32
32
  out_stream.string.should include('Problem encountered:')
33
- out_stream.string.should include('No push api key entered')
33
+ out_stream.string.should include('No push API key entered')
34
34
  end
35
35
 
36
36
  context "auth check" do
@@ -39,7 +39,7 @@ describe Appsignal::CLI::Install do
39
39
 
40
40
  cli.run('key', config)
41
41
 
42
- out_stream.string.should include("Api key 'key' is not valid")
42
+ out_stream.string.should include("API key 'key' is not valid")
43
43
  end
44
44
 
45
45
  it "should exit if there was an error" do
@@ -47,7 +47,7 @@ describe Appsignal::CLI::Install do
47
47
 
48
48
  cli.run('key', config)
49
49
 
50
- out_stream.string.should include("There was an error validating your api key")
50
+ out_stream.string.should include("There was an error validating your API key")
51
51
  end
52
52
  end
53
53
  end
@@ -61,8 +61,8 @@ describe Appsignal::CLI::Install do
61
61
 
62
62
  cli.run('key', config)
63
63
 
64
- out_stream.string.should include("Validating api key...")
65
- out_stream.string.should include("Api key valid")
64
+ out_stream.string.should include("Validating API key...")
65
+ out_stream.string.should include("API key valid")
66
66
  out_stream.string.should include("Installing for Ruby on Rails")
67
67
  out_stream.string.should include("export APPSIGNAL_PUSH_API_KEY=key")
68
68
  out_stream.string.should include("AppSignal installation complete")
@@ -75,8 +75,8 @@ describe Appsignal::CLI::Install do
75
75
 
76
76
  cli.run('key', config)
77
77
 
78
- out_stream.string.should include("Validating api key...")
79
- out_stream.string.should include("Api key valid")
78
+ out_stream.string.should include("Validating API key...")
79
+ out_stream.string.should include("API key valid")
80
80
  out_stream.string.should include("Installing for Ruby on Rails")
81
81
  out_stream.string.should include("AppSignal installation complete")
82
82
  end
@@ -88,8 +88,8 @@ describe Appsignal::CLI::Install do
88
88
 
89
89
  cli.run('key', config)
90
90
 
91
- out_stream.string.should include("Validating api key...")
92
- out_stream.string.should include("Api key valid")
91
+ out_stream.string.should include("Validating API key...")
92
+ out_stream.string.should include("API key valid")
93
93
  out_stream.string.should include("Installing for Ruby on Rails")
94
94
  out_stream.string.should include("export APPSIGNAL_PUSH_API_KEY=key")
95
95
  out_stream.string.should include("export APPSIGNAL_APP_NAME=Appname")
@@ -104,8 +104,8 @@ describe Appsignal::CLI::Install do
104
104
 
105
105
  cli.run('key', config)
106
106
 
107
- out_stream.string.should include("Validating api key...")
108
- out_stream.string.should include("Api key valid")
107
+ out_stream.string.should include("Validating API key...")
108
+ out_stream.string.should include("API key valid")
109
109
  out_stream.string.should include("Installing for Ruby on Rails")
110
110
  out_stream.string.should include("AppSignal installation complete")
111
111
  end
@@ -138,8 +138,8 @@ describe Appsignal::CLI::Install do
138
138
 
139
139
  cli.run('key', config)
140
140
 
141
- out_stream.string.should include("Validating api key...")
142
- out_stream.string.should include("Api key valid")
141
+ out_stream.string.should include("Validating API key...")
142
+ out_stream.string.should include("API key valid")
143
143
  out_stream.string.should include("Installing for Sinatra")
144
144
  out_stream.string.should include("export APPSIGNAL_PUSH_API_KEY=key")
145
145
  out_stream.string.should include("AppSignal installation complete")
@@ -152,8 +152,8 @@ describe Appsignal::CLI::Install do
152
152
 
153
153
  cli.run('key', config)
154
154
 
155
- out_stream.string.should include("Validating api key...")
156
- out_stream.string.should include("Api key valid")
155
+ out_stream.string.should include("Validating API key...")
156
+ out_stream.string.should include("API key valid")
157
157
  out_stream.string.should include("Installing for Sinatra")
158
158
  out_stream.string.should include("AppSignal installation complete")
159
159
  end
@@ -176,8 +176,8 @@ describe Appsignal::CLI::Install do
176
176
 
177
177
  cli.run('key', config)
178
178
 
179
- out_stream.string.should include("Validating api key...")
180
- out_stream.string.should include("Api key valid")
179
+ out_stream.string.should include("Validating API key...")
180
+ out_stream.string.should include("API key valid")
181
181
  out_stream.string.should include("Installing for Padrino")
182
182
  out_stream.string.should include("export APPSIGNAL_PUSH_API_KEY=key")
183
183
  out_stream.string.should include("AppSignal installation complete")
@@ -190,8 +190,8 @@ describe Appsignal::CLI::Install do
190
190
 
191
191
  cli.run('key', config)
192
192
 
193
- out_stream.string.should include("Validating api key...")
194
- out_stream.string.should include("Api key valid")
193
+ out_stream.string.should include("Validating API key...")
194
+ out_stream.string.should include("API key valid")
195
195
  out_stream.string.should include("Installing for Padrino")
196
196
  out_stream.string.should include("AppSignal installation complete")
197
197
  end
@@ -214,8 +214,8 @@ describe Appsignal::CLI::Install do
214
214
 
215
215
  cli.run('key', config)
216
216
 
217
- out_stream.string.should include("Validating api key...")
218
- out_stream.string.should include("Api key valid")
217
+ out_stream.string.should include("Validating API key...")
218
+ out_stream.string.should include("API key valid")
219
219
  out_stream.string.should include("Installing for Grape")
220
220
  out_stream.string.should include("export APPSIGNAL_PUSH_API_KEY=key")
221
221
  out_stream.string.should include("AppSignal installation complete")
@@ -228,8 +228,8 @@ describe Appsignal::CLI::Install do
228
228
 
229
229
  cli.run('key', config)
230
230
 
231
- out_stream.string.should include("Validating api key...")
232
- out_stream.string.should include("Api key valid")
231
+ out_stream.string.should include("Validating API key...")
232
+ out_stream.string.should include("API key valid")
233
233
  out_stream.string.should include("Installing for Grape")
234
234
  out_stream.string.should include("AppSignal installation complete")
235
235
  end
@@ -249,8 +249,8 @@ describe Appsignal::CLI::Install do
249
249
  it "should give a message about unknown framework" do
250
250
  cli.run('key', config)
251
251
 
252
- out_stream.string.should include("Validating api key...")
253
- out_stream.string.should include("Api key valid")
252
+ out_stream.string.should include("Validating API key...")
253
+ out_stream.string.should include("API key valid")
254
254
  out_stream.string.should include("We could not detect which framework you are using.")
255
255
  end
256
256
  end
@@ -92,5 +92,21 @@ if defined?(::Rails)
92
92
 
93
93
  after { middleware.call(env) rescue VerySpecificError }
94
94
  end
95
+
96
+ describe "#request_id" do
97
+ subject { middleware.request_id(env) }
98
+
99
+ context "with request id set" do
100
+ let(:env) { {'action_dispatch.request_id' => 'id'} }
101
+
102
+ it { should == 'id' }
103
+ end
104
+
105
+ context "with request id not set" do
106
+ let(:env) { {} }
107
+
108
+ its(:length) { should == 36 }
109
+ end
110
+ end
95
111
  end
96
112
  end
@@ -525,21 +525,21 @@ describe Appsignal do
525
525
  let(:error) { VerySpecificError.new }
526
526
 
527
527
  it "should send the error to AppSignal" do
528
- Appsignal::Transaction.should_receive(:create).and_call_original
528
+ Appsignal::Transaction.should_receive(:new).and_call_original
529
529
  end
530
530
 
531
531
  context "with tags" do
532
532
  let(:tags) { {:a => 'a', :b => 'b'} }
533
533
 
534
534
  it "should tag the request before sending" do
535
- transaction = Appsignal::Transaction.create(
535
+ transaction = Appsignal::Transaction.new(
536
536
  SecureRandom.uuid,
537
537
  Appsignal::Transaction::HTTP_REQUEST,
538
538
  Appsignal::Transaction::GenericRequest.new({})
539
539
  )
540
- Appsignal::Transaction.stub(:create => transaction)
540
+ Appsignal::Transaction.stub(:new => transaction)
541
541
  transaction.should_receive(:set_tags).with(tags)
542
- Appsignal::Transaction.should_receive(:complete_current!)
542
+ transaction.should_receive(:complete)
543
543
  end
544
544
  end
545
545
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
5
- prerelease:
4
+ version: 1.1.3.beta.1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Robert Beekman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-04-02 00:00:00.000000000 Z
13
+ date: 2016-04-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -307,12 +307,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
307
307
  required_rubygems_version: !ruby/object:Gem::Requirement
308
308
  none: false
309
309
  requirements:
310
- - - ! '>='
310
+ - - ! '>'
311
311
  - !ruby/object:Gem::Version
312
- version: '0'
313
- segments:
314
- - 0
315
- hash: 1564789879550157319
312
+ version: 1.3.1
316
313
  requirements: []
317
314
  rubyforge_project:
318
315
  rubygems_version: 1.8.23.2