periskop-client 0.1.0 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/periskop/client/collector.rb +1 -14
- data/lib/periskop/client/exporter.rb +7 -5
- data/lib/periskop/client/models.rb +27 -0
- data/lib/periskop/rack/middleware.rb +2 -2
- 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: b61d0c35c5c67e1c67aab8772fed198c4d21c6647c67e47e939fa82634a191fe
|
4
|
+
data.tar.gz: bf1dc3f8abb7afeedc2fb03e8a182078b8433a64c1e7d6c7631b23b57f4b094d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac96694adbc8ed1990727f82696ac155b876073630dc46f3cff16894481cb64618107d8085fe952dbe9a04ab878d77585e77360997493aa628433126a76207f2
|
7
|
+
data.tar.gz: a15722d5ea09b54bf757bb651c959eeddbf91eaf6987568560723c75d904c2c722a5c49e88894f1a7107ea54304df2a61805111623ddad6ef26569a009021e0c
|
@@ -35,12 +35,7 @@ module Periskop
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def add_exception(exception, context)
|
38
|
-
exception_instance = ExceptionInstance.
|
39
|
-
exception.class.name,
|
40
|
-
exception.message,
|
41
|
-
exception.backtrace,
|
42
|
-
get_cause(exception)
|
43
|
-
)
|
38
|
+
exception_instance = ExceptionInstance.from_exception(exception)
|
44
39
|
exception_with_context = ExceptionWithContext.new(
|
45
40
|
exception_instance,
|
46
41
|
context,
|
@@ -58,14 +53,6 @@ module Periskop
|
|
58
53
|
aggregated_exception = @aggregated_exceptions_dict[aggregation_key]
|
59
54
|
aggregated_exception.add_exception(exception_with_context)
|
60
55
|
end
|
61
|
-
|
62
|
-
def get_cause(exception)
|
63
|
-
if RUBY_VERSION > '2.0'
|
64
|
-
return exception.cause
|
65
|
-
end
|
66
|
-
|
67
|
-
nil
|
68
|
-
end
|
69
56
|
end
|
70
57
|
end
|
71
58
|
end
|
@@ -14,11 +14,13 @@ module Periskop
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def push_to_gateway(addr)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
if !addr.nil? && !addr.empty?
|
18
|
+
uri = URI.parse("#{addr}/errors")
|
19
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
20
|
+
request = Net::HTTP::Post.new(uri.request_uri, 'Content-Type' => 'application/json')
|
21
|
+
request.body = export
|
22
|
+
http.request(request)
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
@@ -18,6 +18,33 @@ module Periskop
|
|
18
18
|
@cause = cause
|
19
19
|
end
|
20
20
|
|
21
|
+
def self.from_exception(exception)
|
22
|
+
ExceptionInstance.new(
|
23
|
+
exception.class.name,
|
24
|
+
exception.message,
|
25
|
+
get_backtrace(exception),
|
26
|
+
get_cause(exception)
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.get_cause(exception)
|
31
|
+
if RUBY_VERSION > '2.0'
|
32
|
+
if exception.cause.is_a?(Exception)
|
33
|
+
return ExceptionInstance.from_exception(exception.cause)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.get_backtrace(exception)
|
41
|
+
if !exception.backtrace.nil?
|
42
|
+
exception.backtrace
|
43
|
+
else
|
44
|
+
caller
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
21
48
|
def as_json(_options = {})
|
22
49
|
{
|
23
50
|
class: @class,
|
@@ -9,12 +9,12 @@ module Periskop
|
|
9
9
|
|
10
10
|
def initialize(app, options = {})
|
11
11
|
@app = app
|
12
|
-
@pushgateway_address = options.fetch(:pushgateway_address)
|
12
|
+
@pushgateway_address = options.fetch(:pushgateway_address, nil)
|
13
13
|
options[:collector] ||= Periskop::Client::ExceptionCollector.new
|
14
14
|
@collector = options.fetch(:collector)
|
15
15
|
|
16
16
|
@exporter =
|
17
|
-
|
17
|
+
unless @pushgateway_address.nil? || @pushgateway_address.empty?
|
18
18
|
@exporter = Periskop::Client::Exporter.new(@collector)
|
19
19
|
end
|
20
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: periskop-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julio Zynger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Periskop client for Ruby
|
15
15
|
email:
|