xhummingbird 0.1.3 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/xhummingbird/client.rb +2 -0
- data/lib/xhummingbird/protos/event_pb.rb +1 -0
- data/lib/xhummingbird/rack/capture_exception.rb +5 -1
- data/lib/xhummingbird/version.rb +1 -1
- data/lib/xhummingbird.rb +14 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b960f4ba7e3e231aaf8af9517ef322ba2c595e3e7d0c9502d1a6ad564b65838d
|
4
|
+
data.tar.gz: 03fb222a1590ff0a43d86ecde2968802f9dd291058b41c262a311b472c9d8363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf372106cbefeab3c1e94b89c580825450e51c68cabae36091dc3a6567ae9da8339fc14213636aa790afb66f5d8affee2db3b35096fdace0e9cf34e61f7e7706
|
7
|
+
data.tar.gz: 90c8ea7fef69fecb27f58c0c538f634756de32e1d2733c721ebdc2ec22175ca7249ed4a97fc13dd2018fcdee560e041bb5913c2829f1c7691afe7fdc29429338
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
xhummingbird (0.1.
|
4
|
+
xhummingbird (0.1.6)
|
5
5
|
ffi-rzmq
|
6
6
|
google-protobuf
|
7
7
|
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
ffi-rzmq-core (>= 1.0.7)
|
15
15
|
ffi-rzmq-core (1.0.7)
|
16
16
|
ffi
|
17
|
-
google-protobuf (3.15.
|
17
|
+
google-protobuf (3.15.8-x86_64-linux)
|
18
18
|
minitest (5.14.4)
|
19
19
|
parallel (1.20.1)
|
20
20
|
parser (3.0.0.0)
|
data/lib/xhummingbird/client.rb
CHANGED
@@ -31,7 +31,11 @@ module Xhummingbird
|
|
31
31
|
|
32
32
|
error = env['rack.exception'] || env['sinatra.error']
|
33
33
|
|
34
|
-
|
34
|
+
if error
|
35
|
+
level = (400..499).include?(response.first.to_i) ? 0 : 2
|
36
|
+
|
37
|
+
Xhummingbird.send_exception(error, level: level, tags: convert_to_rack_tags(env))
|
38
|
+
end
|
35
39
|
|
36
40
|
response
|
37
41
|
end
|
data/lib/xhummingbird/version.rb
CHANGED
data/lib/xhummingbird.rb
CHANGED
@@ -13,6 +13,8 @@ require_relative "xhummingbird/protos/event_pb"
|
|
13
13
|
module Xhummingbird
|
14
14
|
class Error < StandardError; end
|
15
15
|
|
16
|
+
XH_SERVICE = 'XH_SERVICE'
|
17
|
+
|
16
18
|
LOGGER = Logger.new(STDERR)
|
17
19
|
|
18
20
|
def self.debug(*args)
|
@@ -27,7 +29,7 @@ module Xhummingbird
|
|
27
29
|
send_trace(title: "Started", message: "Xhummingbird Ruby SDK started.", level: 0)
|
28
30
|
end
|
29
31
|
|
30
|
-
def self.send_trace(title:, message: "", level: 1, tags: {})
|
32
|
+
def self.send_trace(title:, message: "", level: 1, tags: {}, service: nil)
|
31
33
|
debug(__method__)
|
32
34
|
|
33
35
|
return unless enabled?
|
@@ -38,13 +40,14 @@ module Xhummingbird
|
|
38
40
|
message: message.to_s,
|
39
41
|
trace: caller,
|
40
42
|
tags: default_tags.merge(format_hash(tags)),
|
41
|
-
timestamp: Time.now
|
43
|
+
timestamp: Time.now,
|
44
|
+
service: service || default_service
|
42
45
|
)
|
43
46
|
rescue => e
|
44
47
|
debug(e)
|
45
48
|
end
|
46
49
|
|
47
|
-
def self.send_exception(exception, level: 2, tags: {})
|
50
|
+
def self.send_exception(exception, level: 2, tags: {}, service: nil)
|
48
51
|
debug(__method__)
|
49
52
|
|
50
53
|
return unless enabled?
|
@@ -55,7 +58,8 @@ module Xhummingbird
|
|
55
58
|
message: exception.message,
|
56
59
|
trace: exception.backtrace,
|
57
60
|
tags: default_tags.merge(format_hash(tags)),
|
58
|
-
timestamp: Time.now
|
61
|
+
timestamp: Time.now,
|
62
|
+
service: service || default_service
|
59
63
|
)
|
60
64
|
rescue => e
|
61
65
|
debug(e)
|
@@ -108,4 +112,10 @@ module Xhummingbird
|
|
108
112
|
|
109
113
|
formatted
|
110
114
|
end
|
115
|
+
|
116
|
+
def self.default_service
|
117
|
+
debug(__method__)
|
118
|
+
|
119
|
+
ENV.fetch(XH_SERVICE, "")
|
120
|
+
end
|
111
121
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xhummingbird
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xmisao
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi-rzmq
|