sentry-raven 0.4.3 → 0.4.4
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.
Potentially problematic release.
This version of sentry-raven might be problematic. Click here for more details.
- data/lib/raven.rb +20 -0
- data/lib/raven/client.rb +11 -1
- data/lib/raven/configuration.rb +3 -0
- data/lib/raven/processors/sanitizedata.rb +1 -1
- data/lib/raven/railtie.rb +1 -0
- data/lib/raven/transports/http.rb +10 -3
- data/lib/raven/version.rb +1 -1
- metadata +11 -31
data/lib/raven.rb
CHANGED
@@ -116,14 +116,34 @@ module Raven
|
|
116
116
|
send(evt) if evt
|
117
117
|
end
|
118
118
|
|
119
|
+
# Bind user context. Merges with existing context (if any).
|
120
|
+
#
|
121
|
+
# It is recommending that you send at least the ``id`` and ``email``
|
122
|
+
# values. All other values are arbitrary.
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
# Raven.user_context('id' => 1, 'email' => 'foo@example.com')
|
119
126
|
def user_context(options={})
|
120
127
|
self.context.user.merge!(options)
|
121
128
|
end
|
122
129
|
|
130
|
+
# Bind tags context. Merges with existing context (if any).
|
131
|
+
#
|
132
|
+
# Tags are key / value pairs which generally represent things like application version,
|
133
|
+
# environment, role, and server names.
|
134
|
+
#
|
135
|
+
# @example
|
136
|
+
# Raven.tags_context('my_custom_tag' => 'tag_value')
|
123
137
|
def tags_context(options={})
|
124
138
|
self.context.tags.merge!(options)
|
125
139
|
end
|
126
140
|
|
141
|
+
# Bind extra context. Merges with existing context (if any).
|
142
|
+
#
|
143
|
+
# Extra context shows up as Additional Data within Sentry, and is completely arbitrary.
|
144
|
+
#
|
145
|
+
# @example
|
146
|
+
# Raven.tags_context('my_custom_data' => 'value')
|
127
147
|
def extra_context(options={})
|
128
148
|
self.context.extra.merge!(options)
|
129
149
|
end
|
data/lib/raven/client.rb
CHANGED
@@ -18,6 +18,7 @@ module Raven
|
|
18
18
|
|
19
19
|
def initialize(configuration)
|
20
20
|
@configuration = configuration
|
21
|
+
@processors = configuration.processors.map { |v| v.new(self) }
|
21
22
|
end
|
22
23
|
|
23
24
|
def send(event)
|
@@ -26,6 +27,7 @@ module Raven
|
|
26
27
|
# Set the project ID correctly
|
27
28
|
event.project = self.configuration.project_id
|
28
29
|
Raven.logger.debug "Sending event #{event.id} to Sentry"
|
30
|
+
|
29
31
|
content_type, encoded_data = encode(event)
|
30
32
|
transport.send(generate_auth_header(encoded_data), encoded_data,
|
31
33
|
:content_type => content_type)
|
@@ -34,7 +36,15 @@ module Raven
|
|
34
36
|
private
|
35
37
|
|
36
38
|
def encode(event)
|
37
|
-
|
39
|
+
hash = event.to_hash
|
40
|
+
|
41
|
+
# apply processors
|
42
|
+
hash = @processors.reduce(hash) do |memo, processor|
|
43
|
+
processor.process(memo)
|
44
|
+
end
|
45
|
+
|
46
|
+
encoded = MultiJson.encode(hash)
|
47
|
+
|
38
48
|
case self.configuration.encoding
|
39
49
|
when 'gzip'
|
40
50
|
gzipped = Zlib::Deflate.deflate(encoded)
|
data/lib/raven/configuration.rb
CHANGED
data/lib/raven/railtie.rb
CHANGED
@@ -26,14 +26,21 @@ module Raven
|
|
26
26
|
|
27
27
|
Raven.logger.debug "Raven HTTP Transport connecting to #{self.configuration.server}"
|
28
28
|
|
29
|
-
Faraday.new(
|
29
|
+
conn = Faraday.new(
|
30
30
|
:url => self.configuration[:server],
|
31
31
|
:ssl => {:verify => self.configuration.ssl_verification}
|
32
32
|
) do |builder|
|
33
33
|
builder.adapter(*adapter)
|
34
|
-
builder.options[:timeout] = self.configuration.timeout if self.configuration.timeout
|
35
|
-
builder.options[:open_timeout] = self.configuration.open_timeout if self.configuration.open_timeout
|
36
34
|
end
|
35
|
+
|
36
|
+
if self.configuration.timeout
|
37
|
+
conn.options[:timeout] = self.configuration.timeout
|
38
|
+
end
|
39
|
+
if self.configuration.open_timeout
|
40
|
+
conn.options[:open_timeout] = self.configuration.open_timeout
|
41
|
+
end
|
42
|
+
|
43
|
+
conn
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
data/lib/raven/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-raven
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-03-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70112682633700 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,15 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.7.6
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ! '>='
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 0.7.6
|
25
|
+
version_requirements: *70112682633700
|
31
26
|
- !ruby/object:Gem::Dependency
|
32
27
|
name: uuidtools
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
28
|
+
requirement: &70112682631820 !ruby/object:Gem::Requirement
|
34
29
|
none: false
|
35
30
|
requirements:
|
36
31
|
- - ! '>='
|
@@ -38,15 +33,10 @@ dependencies:
|
|
38
33
|
version: '0'
|
39
34
|
type: :runtime
|
40
35
|
prerelease: false
|
41
|
-
version_requirements:
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ! '>='
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
36
|
+
version_requirements: *70112682631820
|
47
37
|
- !ruby/object:Gem::Dependency
|
48
38
|
name: multi_json
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirement: &70112682628660 !ruby/object:Gem::Requirement
|
50
40
|
none: false
|
51
41
|
requirements:
|
52
42
|
- - ~>
|
@@ -54,15 +44,10 @@ dependencies:
|
|
54
44
|
version: '1.0'
|
55
45
|
type: :runtime
|
56
46
|
prerelease: false
|
57
|
-
version_requirements:
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '1.0'
|
47
|
+
version_requirements: *70112682628660
|
63
48
|
- !ruby/object:Gem::Dependency
|
64
49
|
name: hashie
|
65
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirement: &70112682643820 !ruby/object:Gem::Requirement
|
66
51
|
none: false
|
67
52
|
requirements:
|
68
53
|
- - ! '>='
|
@@ -70,12 +55,7 @@ dependencies:
|
|
70
55
|
version: '0'
|
71
56
|
type: :runtime
|
72
57
|
prerelease: false
|
73
|
-
version_requirements:
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ! '>='
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: '0'
|
58
|
+
version_requirements: *70112682643820
|
79
59
|
description:
|
80
60
|
email: noah@coderanger.net
|
81
61
|
executables:
|
@@ -133,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
113
|
version: '0'
|
134
114
|
requirements: []
|
135
115
|
rubyforge_project:
|
136
|
-
rubygems_version: 1.8.
|
116
|
+
rubygems_version: 1.8.10
|
137
117
|
signing_key:
|
138
118
|
specification_version: 3
|
139
119
|
summary: A gem that provides a client interface for the Sentry error logger
|