raygun4ruby 1.1.6 → 1.1.8
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 +4 -4
- data/README.md +22 -1
- data/lib/raygun/client.rb +8 -6
- data/lib/raygun/configuration.rb +5 -1
- data/lib/raygun/version.rb +1 -1
- data/test/unit/client_test.rb +17 -1
- data/test/unit/configuration_test.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 273d85a675cf0614daea64f24b92c3a11ac72f51
|
4
|
+
data.tar.gz: 33f936b5e6a73da371987b563481f3ef9e82ea06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0559ec4c81322a5c05ca0c4ebeabbb62d09c1c969e865d7b525ce8ea9de2570b2e3017e30cc60e80a8a58f7b6ab9507bae4c3cb6d87401a79b9e3c5c96b980db
|
7
|
+
data.tar.gz: 65ca7914244a2695511de1616f04706f41b69c88ad36fb38fa9e63e3c90fffc1bd4d5340551a2ccbac5768033c6e3aae7f580661c1b6ae4650a0ef83eec9bb78
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ Raygun4Ruby doesn't currently support Rails 2. If you'd like Rails 2 support, [d
|
|
47
47
|
|
48
48
|
To enable exception tracking in Sinatra, just add configure Raygun and use the Rack middleware in your app:
|
49
49
|
|
50
|
-
```
|
50
|
+
```ruby
|
51
51
|
require 'raygun4ruby'
|
52
52
|
Raygun.setup do |config|
|
53
53
|
config.api_key = "YOUR_API_KEY_HERE"
|
@@ -169,6 +169,27 @@ end
|
|
169
169
|
|
170
170
|
(Remember to set `affected_user_method` to `:raygun_user` in your config block...)
|
171
171
|
|
172
|
+
### Version tracking
|
173
|
+
|
174
|
+
Raygun can attach the version of your application to its error reports. In your Raygun.setup block, set `version` to the current version of your app.
|
175
|
+
|
176
|
+
```ruby
|
177
|
+
Raygun.setup do |config|
|
178
|
+
config.version = "1.0.0.4" # you could also pull this from ENV or however you want to set it.
|
179
|
+
end
|
180
|
+
```
|
181
|
+
|
182
|
+
### Tags
|
183
|
+
|
184
|
+
Raygun allows you to tag error reports with any number of tags. In your Raygun.setup block, set `tags` to an array of strings to have those
|
185
|
+
set on any error reports sent by the gem.
|
186
|
+
|
187
|
+
```ruby
|
188
|
+
Raygun.setup do |config|
|
189
|
+
config.tags = ['heroku']
|
190
|
+
end
|
191
|
+
```
|
192
|
+
|
172
193
|
### Resque Error Tracking
|
173
194
|
|
174
195
|
Raygun4Ruby also includes a Resque failure backend. You should include it inside your Resque initializer (usually something like `config/initializers/load_resque.rb`)
|
data/lib/raygun/client.rb
CHANGED
@@ -30,7 +30,7 @@ module Raygun
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def enable_http_proxy
|
33
|
-
self.class.http_proxy(Raygun.configuration.proxy_settings[:address],
|
33
|
+
self.class.http_proxy(Raygun.configuration.proxy_settings[:address],
|
34
34
|
Raygun.configuration.proxy_settings[:port] || "80",
|
35
35
|
Raygun.configuration.proxy_settings[:username],
|
36
36
|
Raygun.configuration.proxy_settings[:password])
|
@@ -78,11 +78,11 @@ module Raygun
|
|
78
78
|
!!env["raygun.affected_user"]
|
79
79
|
end
|
80
80
|
|
81
|
-
def
|
82
|
-
|
81
|
+
def rack_env
|
82
|
+
ENV["RACK_ENV"]
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
85
|
+
def rack_env_present?
|
86
86
|
!!ENV["RACK_ENV"]
|
87
87
|
end
|
88
88
|
|
@@ -131,13 +131,15 @@ module Raygun
|
|
131
131
|
def raw_data(rack_env)
|
132
132
|
request = Rack::Request.new(rack_env)
|
133
133
|
unless request.form_data?
|
134
|
-
form_params(rack_env)
|
134
|
+
form_params(rack_env)
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
138
|
# see http://raygun.io/raygun-providers/rest-json-api?v=1
|
139
139
|
def build_payload_hash(exception_instance, env = {})
|
140
140
|
custom_data = env.delete(:custom_data) || {}
|
141
|
+
tags = env.delete(:tags) || []
|
142
|
+
tags << rack_env if rack_env_present?
|
141
143
|
|
142
144
|
error_details = {
|
143
145
|
machineName: hostname,
|
@@ -145,10 +147,10 @@ module Raygun
|
|
145
147
|
client: client_details,
|
146
148
|
error: error_details(exception_instance),
|
147
149
|
userCustomData: Raygun.configuration.custom_data.merge(custom_data),
|
150
|
+
tags: Raygun.configuration.tags.concat(tags).uniq,
|
148
151
|
request: request_information(env)
|
149
152
|
}
|
150
153
|
|
151
|
-
error_details.merge!(tags: error_tags) if error_tags_present?
|
152
154
|
error_details.merge!(user: user_information(env)) if affected_user_present?(env)
|
153
155
|
|
154
156
|
{
|
data/lib/raygun/configuration.rb
CHANGED
@@ -23,6 +23,9 @@ module Raygun
|
|
23
23
|
# Custom Data to send with each exception
|
24
24
|
config_option :custom_data
|
25
25
|
|
26
|
+
# Tags to send with each exception
|
27
|
+
config_option :tags
|
28
|
+
|
26
29
|
# Logger to use when if we find an exception :)
|
27
30
|
config_option :logger
|
28
31
|
|
@@ -65,6 +68,7 @@ module Raygun
|
|
65
68
|
@defaults = OpenStruct.new({
|
66
69
|
ignore: IGNORE_DEFAULT,
|
67
70
|
custom_data: {},
|
71
|
+
tags: [],
|
68
72
|
enable_reporting: true,
|
69
73
|
affected_user_method: :current_user,
|
70
74
|
affected_user_identifier_methods: [ :email, :username, :id ],
|
@@ -109,4 +113,4 @@ module Raygun
|
|
109
113
|
end
|
110
114
|
|
111
115
|
end
|
112
|
-
end
|
116
|
+
end
|
data/lib/raygun/version.rb
CHANGED
data/test/unit/client_test.rb
CHANGED
@@ -92,6 +92,22 @@ class ClientTest < Raygun::UnitTest
|
|
92
92
|
assert_equal expected_hash, @client.send(:build_payload_hash, e, test_env)[:details][:user]
|
93
93
|
end
|
94
94
|
|
95
|
+
def test_tags
|
96
|
+
configuration_tags = %w{alpha beta gaga}
|
97
|
+
explicit_env_tags = %w{one two three four}
|
98
|
+
rack_env_tag = %w{test}
|
99
|
+
|
100
|
+
Raygun.setup do |config|
|
101
|
+
config.tags = configuration_tags
|
102
|
+
end
|
103
|
+
|
104
|
+
e = TestException.new("A test message")
|
105
|
+
test_env = { tags: explicit_env_tags }
|
106
|
+
expected_tags = configuration_tags + explicit_env_tags + rack_env_tag
|
107
|
+
|
108
|
+
assert_equal expected_tags, @client.send(:build_payload_hash, e, test_env)[:details][:tags]
|
109
|
+
end
|
110
|
+
|
95
111
|
def test_hostname
|
96
112
|
assert_equal Socket.gethostname, @client.send(:hostname)
|
97
113
|
end
|
@@ -377,7 +393,7 @@ class ClientTest < Raygun::UnitTest
|
|
377
393
|
private
|
378
394
|
|
379
395
|
def sample_env_hash
|
380
|
-
{
|
396
|
+
{
|
381
397
|
"SERVER_NAME"=>"localhost",
|
382
398
|
"REQUEST_METHOD"=>"POST",
|
383
399
|
"REQUEST_PATH"=>"/",
|
@@ -52,6 +52,10 @@ class ConfigurationTest < Raygun::UnitTest
|
|
52
52
|
assert_equal({}, Raygun.configuration.custom_data)
|
53
53
|
end
|
54
54
|
|
55
|
+
def test_default_tags_set
|
56
|
+
assert_equal([], Raygun.configuration.tags)
|
57
|
+
end
|
58
|
+
|
55
59
|
def test_overriding_defaults
|
56
60
|
Raygun.default_configuration.custom_data = { robby: "robot" }
|
57
61
|
assert_equal({ robby: "robot" }, Raygun.configuration.custom_data)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raygun4ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindscape
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
240
|
version: '0'
|
241
241
|
requirements: []
|
242
242
|
rubyforge_project:
|
243
|
-
rubygems_version: 2.
|
243
|
+
rubygems_version: 2.4.6
|
244
244
|
signing_key:
|
245
245
|
specification_version: 4
|
246
246
|
summary: This gem provides support for Ruby and Ruby on Rails for the Raygun.io error
|