appsignal 0.8.6.beta.1 → 0.8.6
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 +8 -8
- data/CHANGELOG.md +6 -1
- data/lib/appsignal.rb +1 -1
- data/lib/appsignal/cli.rb +10 -10
- data/lib/appsignal/config.rb +1 -0
- data/lib/appsignal/integrations/delayed_job.rb +1 -1
- data/lib/appsignal/integrations/resque.rb +1 -1
- data/lib/appsignal/integrations/sidekiq.rb +1 -1
- data/lib/appsignal/transaction/formatter.rb +1 -0
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/cli_spec.rb +23 -8
- data/spec/lib/appsignal/config_spec.rb +2 -0
- data/spec/lib/appsignal/transaction/formatter_spec.rb +53 -14
- data/spec/support/helpers/notification_helpers.rb +5 -0
- data/spec/support/helpers/transaction_helpers.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTdmNjgwM2IzMDBmNzE0ZGQxM2IwODRhMzdkM2RhZmVlOTIxNWEzMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTA1OWI5NjBmN2FmZmIwOGMxZjRkMmEwODkxODkwMDNiMDliMGI3YQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWQ2ZTE0Y2I3NjM2MDljZGZmYmFlOWI3NmQ2MGNiNWJiODJhYWNjMWY3MjYx
|
10
|
+
MjQyN2ZlODQ2M2ZkZGI2MmMyZjIwYTcxNGFhZDk3OTFiZDg4NGVjNmFlMDdk
|
11
|
+
MGUxMzliYzdjNjA0YTQ4YWEwMDJjMTk2MzdiMDQ3NzQ4NzZiMzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2RjZmEzMDg0ZTJhYWFkMzMwYTQxZTE4ZGI0NzMzYzc5ODFjNjZlN2IzMDFi
|
14
|
+
NjljNTljNmYwMzU1NTFmNGU2ZTE4MWNhMzgzMjA1Y2M3ZGJlODg2NmQwMTAy
|
15
|
+
NzUzZTQ5ZGUzMGQ4ZjNiMDc5YTg4NjRiMWZkMjgwYzYxZjEzZWM=
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
# 0.8.6
|
2
|
-
* Resque support
|
2
|
+
* Resque support (beta)
|
3
3
|
* Support tags in Appsignal.send_exception
|
4
4
|
* Alias tag_request to tag_job, for background jobs
|
5
5
|
* Skip sanitization of env if env is nil
|
6
6
|
* Small bugfix in forking logic
|
7
|
+
* Don't send params if send_params is off in config
|
8
|
+
* Remove --repository option in CLI
|
9
|
+
* Name option in appsignal notify_of_deploy CLI
|
10
|
+
* Don't call to_hash on ENV
|
11
|
+
* Get error message in CLI when config is not active
|
7
12
|
|
8
13
|
# 0.8.5
|
9
14
|
* Don't require revision in CLI notify_of_deploy
|
data/lib/appsignal.rb
CHANGED
@@ -63,7 +63,7 @@ module Appsignal
|
|
63
63
|
|
64
64
|
def send_exception(exception, tags=nil)
|
65
65
|
return if is_ignored_exception?(exception)
|
66
|
-
transaction = Appsignal::Transaction.create(SecureRandom.uuid, ENV
|
66
|
+
transaction = Appsignal::Transaction.create(SecureRandom.uuid, ENV)
|
67
67
|
transaction.add_exception(exception)
|
68
68
|
transaction.set_tags(tags) if tags
|
69
69
|
transaction.complete!
|
data/lib/appsignal/cli.rb
CHANGED
@@ -8,10 +8,11 @@ module Appsignal
|
|
8
8
|
AVAILABLE_COMMANDS = %w(notify_of_deploy).freeze
|
9
9
|
|
10
10
|
class << self
|
11
|
-
attr_accessor :options, :config
|
11
|
+
attr_accessor :options, :config, :initial_config
|
12
12
|
|
13
13
|
def run(argv=ARGV)
|
14
14
|
@options = {}
|
15
|
+
@initial_config = {}
|
15
16
|
global = global_option_parser
|
16
17
|
commands = command_option_parser
|
17
18
|
global.order!(argv)
|
@@ -43,7 +44,7 @@ module Appsignal
|
|
43
44
|
@config ||= Appsignal::Config.new(
|
44
45
|
ENV['PWD'],
|
45
46
|
options[:environment],
|
46
|
-
|
47
|
+
@initial_config,
|
47
48
|
logger
|
48
49
|
)
|
49
50
|
end
|
@@ -76,10 +77,6 @@ module Appsignal
|
|
76
77
|
options[:revision] = arg
|
77
78
|
end
|
78
79
|
|
79
|
-
o.on '--repository=<repository>', "The location of the main code repository" do |arg|
|
80
|
-
options[:repository] = arg
|
81
|
-
end
|
82
|
-
|
83
80
|
o.on '--user=<user>', "The name of the user that's deploying" do |arg|
|
84
81
|
options[:user] = arg
|
85
82
|
end
|
@@ -87,18 +84,21 @@ module Appsignal
|
|
87
84
|
o.on '--environment=<rails_env>', "The environment you're deploying to" do |arg|
|
88
85
|
options[:environment] = arg
|
89
86
|
end
|
87
|
+
|
88
|
+
o.on '--name=<name>', "The name of the app (optional)" do |arg|
|
89
|
+
initial_config[:name] = arg
|
90
|
+
end
|
90
91
|
end
|
91
92
|
}
|
92
93
|
end
|
93
94
|
|
94
95
|
def notify_of_deploy
|
95
|
-
|
96
|
+
validate_active_config
|
96
97
|
validate_required_options([:revision, :user, :environment])
|
97
98
|
|
98
99
|
Appsignal::Marker.new(
|
99
100
|
{
|
100
101
|
:revision => options[:revision],
|
101
|
-
:repository => options[:repository],
|
102
102
|
:user => options[:user]
|
103
103
|
},
|
104
104
|
config,
|
@@ -118,8 +118,8 @@ module Appsignal
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
def
|
122
|
-
unless config.
|
121
|
+
def validate_active_config
|
122
|
+
unless config.active?
|
123
123
|
puts 'Exiting: No config file or push api key env var found'
|
124
124
|
exit(1)
|
125
125
|
end
|
data/lib/appsignal/config.rb
CHANGED
@@ -12,7 +12,7 @@ if defined?(::Delayed::Plugin)
|
|
12
12
|
|
13
13
|
def self.invoke_with_instrumentation(job, block)
|
14
14
|
begin
|
15
|
-
Appsignal::Transaction.create(SecureRandom.uuid, ENV
|
15
|
+
Appsignal::Transaction.create(SecureRandom.uuid, ENV)
|
16
16
|
class_name, method_name = job.name.split('#')
|
17
17
|
ActiveSupport::Notifications.instrument(
|
18
18
|
'perform_job.delayed_job',
|
@@ -6,7 +6,7 @@ if defined?(::Resque)
|
|
6
6
|
module ResquePlugin
|
7
7
|
|
8
8
|
def around_perform_resque_plugin(*args)
|
9
|
-
Appsignal::Transaction.create(SecureRandom.uuid, ENV
|
9
|
+
Appsignal::Transaction.create(SecureRandom.uuid, ENV)
|
10
10
|
ActiveSupport::Notifications.instrument(
|
11
11
|
'perform_job.resque',
|
12
12
|
:class => self.to_s,
|
@@ -5,7 +5,7 @@ if defined?(::Sidekiq)
|
|
5
5
|
module Integrations
|
6
6
|
class SidekiqPlugin
|
7
7
|
def call(worker, item, queue)
|
8
|
-
Appsignal::Transaction.create(SecureRandom.uuid, ENV
|
8
|
+
Appsignal::Transaction.create(SecureRandom.uuid, ENV)
|
9
9
|
ActiveSupport::Notifications.instrument(
|
10
10
|
'perform_job.sidekiq',
|
11
11
|
:class => item['class'],
|
data/lib/appsignal/version.rb
CHANGED
@@ -9,6 +9,7 @@ describe Appsignal::CLI do
|
|
9
9
|
$stdout = out_stream
|
10
10
|
ENV['PWD'] = project_fixture_path
|
11
11
|
cli.config = nil
|
12
|
+
cli.initial_config = {}
|
12
13
|
cli.options = {:environment => 'production'}
|
13
14
|
end
|
14
15
|
after do
|
@@ -61,7 +62,7 @@ describe Appsignal::CLI do
|
|
61
62
|
|
62
63
|
describe "#notify_of_deploy" do
|
63
64
|
it "should validate that the config has been loaded and all options have been supplied" do
|
64
|
-
cli.should_receive(:
|
65
|
+
cli.should_receive(:validate_active_config)
|
65
66
|
cli.should_receive(:validate_required_options).with(
|
66
67
|
[:revision, :user, :environment]
|
67
68
|
)
|
@@ -75,7 +76,6 @@ describe Appsignal::CLI do
|
|
75
76
|
Appsignal::Marker.should_receive(:new).with(
|
76
77
|
{
|
77
78
|
:revision => 'aaaaa',
|
78
|
-
:repository => 'git@github.com:our/project.git',
|
79
79
|
:user => 'thijs'
|
80
80
|
},
|
81
81
|
kind_of(Appsignal::Config),
|
@@ -86,18 +86,19 @@ describe Appsignal::CLI do
|
|
86
86
|
cli.run([
|
87
87
|
'notify_of_deploy',
|
88
88
|
'--revision=aaaaa',
|
89
|
-
'--repository=git@github.com:our/project.git',
|
90
89
|
'--user=thijs',
|
91
90
|
'--environment=production'
|
92
91
|
])
|
93
92
|
end
|
94
93
|
|
95
|
-
it "should notify of a deploy
|
94
|
+
it "should notify of a deploy with no config file and a name specified" do
|
95
|
+
ENV['PWD'] = '/nonsense'
|
96
|
+
ENV['APPSIGNAL_PUSH_API_KEY'] = 'key'
|
97
|
+
|
96
98
|
marker = double
|
97
99
|
Appsignal::Marker.should_receive(:new).with(
|
98
100
|
{
|
99
101
|
:revision => 'aaaaa',
|
100
|
-
:repository => nil,
|
101
102
|
:user => 'thijs'
|
102
103
|
},
|
103
104
|
kind_of(Appsignal::Config),
|
@@ -107,10 +108,13 @@ describe Appsignal::CLI do
|
|
107
108
|
|
108
109
|
cli.run([
|
109
110
|
'notify_of_deploy',
|
111
|
+
'--name=project-production',
|
110
112
|
'--revision=aaaaa',
|
111
113
|
'--user=thijs',
|
112
114
|
'--environment=production'
|
113
115
|
])
|
116
|
+
|
117
|
+
cli.config[:name].should == 'project-production'
|
114
118
|
end
|
115
119
|
end
|
116
120
|
|
@@ -161,10 +165,10 @@ describe Appsignal::CLI do
|
|
161
165
|
end
|
162
166
|
end
|
163
167
|
|
164
|
-
describe "#
|
168
|
+
describe "#validate_active_config" do
|
165
169
|
context "when config is present" do
|
166
170
|
it "should do nothing" do
|
167
|
-
cli.send(:
|
171
|
+
cli.send(:validate_active_config)
|
168
172
|
out_stream.string.should be_empty
|
169
173
|
end
|
170
174
|
end
|
@@ -174,7 +178,18 @@ describe Appsignal::CLI do
|
|
174
178
|
|
175
179
|
it "should print a message and exit" do
|
176
180
|
lambda {
|
177
|
-
cli.send(:
|
181
|
+
cli.send(:validate_active_config)
|
182
|
+
}.should raise_error(SystemExit)
|
183
|
+
out_stream.string.should include('Exiting: No config file or push api key env var found')
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
context "when config is not active" do
|
188
|
+
before { ENV['PWD'] = '/nonsense' }
|
189
|
+
|
190
|
+
it "should print a message and exit" do
|
191
|
+
lambda {
|
192
|
+
cli.send(:validate_active_config)
|
178
193
|
}.should raise_error(SystemExit)
|
179
194
|
out_stream.string.should include('Exiting: No config file or push api key env var found')
|
180
195
|
end
|
@@ -17,6 +17,7 @@ describe Appsignal::Config do
|
|
17
17
|
it "should merge with the default config and fill the config hash" do
|
18
18
|
subject.config_hash.should == {
|
19
19
|
:ignore_exceptions => [],
|
20
|
+
:send_params => true,
|
20
21
|
:endpoint => 'https://push.appsignal.com/1',
|
21
22
|
:slow_request_threshold => 200,
|
22
23
|
:push_api_key => 'abc',
|
@@ -121,6 +122,7 @@ describe Appsignal::Config do
|
|
121
122
|
subject.config_hash.should == {
|
122
123
|
:push_api_key => 'push_api_key',
|
123
124
|
:ignore_exceptions => [],
|
125
|
+
:send_params => true,
|
124
126
|
:endpoint => 'https://push.appsignal.com/1',
|
125
127
|
:slow_request_threshold => 200,
|
126
128
|
:active => true
|
@@ -11,8 +11,7 @@ describe Appsignal::Transaction::Formatter do
|
|
11
11
|
before { transaction.stub(:fullpath => '/foo') }
|
12
12
|
|
13
13
|
describe "#to_hash" do
|
14
|
-
|
15
|
-
subject { formatter.hash }
|
14
|
+
subject { formatter.to_hash }
|
16
15
|
|
17
16
|
context "with a regular request" do
|
18
17
|
let(:transaction) { regular_transaction }
|
@@ -22,19 +21,15 @@ describe Appsignal::Transaction::Formatter do
|
|
22
21
|
its([:request_id]) { should == '1' }
|
23
22
|
its([:log_entry]) { should == {
|
24
23
|
:action => "BlogPostsController#show",
|
25
|
-
:db_runtime => 500,
|
26
24
|
:duration => be_within(0.01).of(100.0),
|
27
25
|
:end => 1389783600.1,
|
28
26
|
:environment => {},
|
29
27
|
:kind => "http_request",
|
30
|
-
:path => "/
|
31
|
-
:request_format => "html",
|
32
|
-
:request_method => "GET",
|
28
|
+
:path => "/foo",
|
33
29
|
:session_data => {},
|
34
|
-
:status => "200",
|
35
30
|
:time => 1389783600.0,
|
36
|
-
:view_runtime => 500
|
37
31
|
} }
|
32
|
+
its([:events]) { should be_nil }
|
38
33
|
its([:failed]) { should be_false }
|
39
34
|
end
|
40
35
|
|
@@ -43,7 +38,7 @@ describe Appsignal::Transaction::Formatter do
|
|
43
38
|
before { transaction.truncate! }
|
44
39
|
|
45
40
|
context "log_entry content" do
|
46
|
-
subject { formatter.
|
41
|
+
subject { formatter.to_hash[:log_entry] }
|
47
42
|
|
48
43
|
its([:queue_duration]) { should be_within(0.01).of(40.0) }
|
49
44
|
end
|
@@ -57,13 +52,24 @@ describe Appsignal::Transaction::Formatter do
|
|
57
52
|
its([:failed]) { should be_true }
|
58
53
|
|
59
54
|
context "log_entry content" do
|
60
|
-
subject { formatter.
|
55
|
+
subject { formatter.to_hash[:log_entry] }
|
61
56
|
|
62
57
|
its([:tags]) { should == {'user_id' => 123} }
|
58
|
+
its([:action]) { should == 'BlogPostsController#show' }
|
59
|
+
its([:params]) { should == {'action' => 'show', 'controller' => 'blog_posts', 'id' => '1'} }
|
60
|
+
|
61
|
+
context "when send_params in the config is false" do
|
62
|
+
before { Appsignal.config.config_hash[:send_params] = false }
|
63
|
+
after { Appsignal.config.config_hash[:send_params] = true }
|
64
|
+
|
65
|
+
it "should not send the params" do
|
66
|
+
subject[:params].should be_nil
|
67
|
+
end
|
68
|
+
end
|
63
69
|
end
|
64
70
|
|
65
71
|
context "exception content" do
|
66
|
-
subject { formatter.
|
72
|
+
subject { formatter.to_hash[:exception] }
|
67
73
|
|
68
74
|
its(:keys) { should =~ [:exception, :message, :backtrace] }
|
69
75
|
its([:exception]) { should == 'ArgumentError' }
|
@@ -88,10 +94,39 @@ describe Appsignal::Transaction::Formatter do
|
|
88
94
|
|
89
95
|
its(:keys) { should =~ [:request_id, :log_entry, :failed, :events] }
|
90
96
|
its([:request_id]) { should == '1' }
|
97
|
+
its([:log_entry]) { should == {
|
98
|
+
:action => "BlogPostsController#show",
|
99
|
+
:duration => be_within(0.01).of(200.0),
|
100
|
+
:end => 1389783600.200002,
|
101
|
+
:environment => {},
|
102
|
+
:params => {
|
103
|
+
'action' => 'show',
|
104
|
+
'controller' => 'blog_posts',
|
105
|
+
'id' => '1'
|
106
|
+
},
|
107
|
+
:kind => "http_request",
|
108
|
+
:path => "/blog",
|
109
|
+
:session_data => {},
|
110
|
+
:time => 1389783600.0,
|
111
|
+
:db_runtime => 500,
|
112
|
+
:view_runtime => 500,
|
113
|
+
:request_format => 'html',
|
114
|
+
:request_method => 'GET',
|
115
|
+
:status => '200'
|
116
|
+
} }
|
91
117
|
its([:failed]) { should be_false }
|
92
118
|
|
119
|
+
context "when send_params in the config is false" do
|
120
|
+
before { Appsignal.config.config_hash[:send_params] = false }
|
121
|
+
after { Appsignal.config.config_hash[:send_params] = true }
|
122
|
+
|
123
|
+
it "should not send the params" do
|
124
|
+
subject[:log_entry][:params].should be_nil
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
93
128
|
context "events content" do
|
94
|
-
subject { formatter.
|
129
|
+
subject { formatter.to_hash[:events] }
|
95
130
|
|
96
131
|
its(:length) { should == 1 }
|
97
132
|
its(:first) { should == {
|
@@ -103,6 +138,11 @@ describe Appsignal::Transaction::Formatter do
|
|
103
138
|
:path => "/blog",
|
104
139
|
:action => "show",
|
105
140
|
:controller => "BlogPostsController",
|
141
|
+
:params => {
|
142
|
+
'action' => 'show',
|
143
|
+
'controller' => 'blog_posts',
|
144
|
+
'id' => '1'
|
145
|
+
},
|
106
146
|
:request_format => "html",
|
107
147
|
:request_method => "GET",
|
108
148
|
:status => "200",
|
@@ -116,7 +156,6 @@ describe Appsignal::Transaction::Formatter do
|
|
116
156
|
context "with a background request" do
|
117
157
|
let(:payload) { create_background_payload }
|
118
158
|
let(:transaction) { background_job_transaction({}, payload) }
|
119
|
-
before { transaction.truncate! }
|
120
159
|
|
121
160
|
its(:keys) { should =~ [:request_id, :log_entry, :failed] }
|
122
161
|
its([:request_id]) { should == '1' }
|
@@ -140,7 +179,7 @@ describe Appsignal::Transaction::Formatter do
|
|
140
179
|
let(:payload) { create_background_payload(:queue_start => 0) }
|
141
180
|
|
142
181
|
context "log entry" do
|
143
|
-
subject { formatter.
|
182
|
+
subject { formatter.to_hash[:log_entry] }
|
144
183
|
|
145
184
|
its([:queue_duration]) { should be_nil }
|
146
185
|
end
|
@@ -17,6 +17,11 @@ module NotificationHelpers
|
|
17
17
|
:path => '/blog',
|
18
18
|
:action => 'show',
|
19
19
|
:controller => 'BlogPostsController',
|
20
|
+
:params => {
|
21
|
+
'controller' => 'blog_posts',
|
22
|
+
'action' => 'show',
|
23
|
+
'id' => '1'
|
24
|
+
},
|
20
25
|
:request_format => 'html',
|
21
26
|
:request_method => "GET",
|
22
27
|
:status => '200',
|
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.8.6
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-02-
|
15
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|
@@ -241,9 +241,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
241
241
|
version: 1.9.3
|
242
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
243
|
requirements:
|
244
|
-
- - ! '
|
244
|
+
- - ! '>='
|
245
245
|
- !ruby/object:Gem::Version
|
246
|
-
version:
|
246
|
+
version: '0'
|
247
247
|
requirements: []
|
248
248
|
rubyforge_project:
|
249
249
|
rubygems_version: 2.0.3
|