google_cloud_logging_extension 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +79 -0
- data/lib/google_cloud_logging_extension/google/cloud/logging.rb +26 -11
- data/lib/google_cloud_logging_extension/version.rb +1 -1
- 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: 0b531e0aa67e857eef2b2d35905a937f4705ce9db98f87dc9a9931eb2d97290e
|
4
|
+
data.tar.gz: 6b6b600fae4e9df160c5fde311c521a497e6c4b509e97ae915d0c730b6ec4124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbf33b877249a68db0980097ec856979c4201e97ace5e109d03e0ee2a9aca13ad8c2f884c9fd81f125bf0254d872cf17cecc109b31dd91456ebf6dbd084542eb
|
7
|
+
data.tar.gz: 5a761abb9bcc6268218aafcd51a71a884040fc8f162d5cc6b788731a5383487942ed23b124bb59019271d88cea5244f3dcfbec3e87e6feeabbba3b3c907a3d01
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -6,21 +6,91 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
addressable (2.8.0)
|
10
|
+
public_suffix (>= 2.0.2, < 5.0)
|
9
11
|
ast (2.4.2)
|
10
12
|
backport (1.2.0)
|
11
13
|
benchmark (0.2.0)
|
14
|
+
concurrent-ruby (1.1.10)
|
12
15
|
diff-lcs (1.5.0)
|
13
16
|
e2mmap (0.1.0)
|
17
|
+
faraday (1.10.0)
|
18
|
+
faraday-em_http (~> 1.0)
|
19
|
+
faraday-em_synchrony (~> 1.0)
|
20
|
+
faraday-excon (~> 1.1)
|
21
|
+
faraday-httpclient (~> 1.0)
|
22
|
+
faraday-multipart (~> 1.0)
|
23
|
+
faraday-net_http (~> 1.0)
|
24
|
+
faraday-net_http_persistent (~> 1.0)
|
25
|
+
faraday-patron (~> 1.0)
|
26
|
+
faraday-rack (~> 1.0)
|
27
|
+
faraday-retry (~> 1.0)
|
28
|
+
ruby2_keywords (>= 0.0.4)
|
29
|
+
faraday-em_http (1.0.0)
|
30
|
+
faraday-em_synchrony (1.0.0)
|
31
|
+
faraday-excon (1.1.0)
|
32
|
+
faraday-httpclient (1.0.1)
|
33
|
+
faraday-multipart (1.0.3)
|
34
|
+
multipart-post (>= 1.2, < 3)
|
35
|
+
faraday-net_http (1.0.1)
|
36
|
+
faraday-net_http_persistent (1.2.0)
|
37
|
+
faraday-patron (1.0.0)
|
38
|
+
faraday-rack (1.0.0)
|
39
|
+
faraday-retry (1.0.3)
|
40
|
+
gapic-common (0.9.0)
|
41
|
+
faraday (~> 1.3)
|
42
|
+
google-protobuf (~> 3.14)
|
43
|
+
googleapis-common-protos (>= 1.3.11, < 2.a)
|
44
|
+
googleapis-common-protos-types (>= 1.0.6, < 2.a)
|
45
|
+
googleauth (>= 0.17.0, < 2.a)
|
46
|
+
grpc (~> 1.36)
|
47
|
+
google-cloud-core (1.6.0)
|
48
|
+
google-cloud-env (~> 1.0)
|
49
|
+
google-cloud-errors (~> 1.0)
|
50
|
+
google-cloud-env (1.6.0)
|
51
|
+
faraday (>= 0.17.3, < 3.0)
|
52
|
+
google-cloud-errors (1.2.0)
|
53
|
+
google-cloud-logging (2.2.2)
|
54
|
+
concurrent-ruby (~> 1.1)
|
55
|
+
google-cloud-core (~> 1.5)
|
56
|
+
google-cloud-logging-v2 (~> 0.0)
|
57
|
+
stackdriver-core (~> 1.3)
|
58
|
+
google-cloud-logging-v2 (0.7.0)
|
59
|
+
gapic-common (>= 0.7, < 2.a)
|
60
|
+
google-cloud-errors (~> 1.0)
|
61
|
+
google-protobuf (3.21.1)
|
62
|
+
googleapis-common-protos (1.3.12)
|
63
|
+
google-protobuf (~> 3.14)
|
64
|
+
googleapis-common-protos-types (~> 1.2)
|
65
|
+
grpc (~> 1.27)
|
66
|
+
googleapis-common-protos-types (1.3.1)
|
67
|
+
google-protobuf (~> 3.14)
|
68
|
+
googleauth (1.1.3)
|
69
|
+
faraday (>= 0.17.3, < 3.a)
|
70
|
+
jwt (>= 1.4, < 3.0)
|
71
|
+
memoist (~> 0.16)
|
72
|
+
multi_json (~> 1.11)
|
73
|
+
os (>= 0.9, < 2.0)
|
74
|
+
signet (>= 0.16, < 2.a)
|
75
|
+
grpc (1.46.3)
|
76
|
+
google-protobuf (~> 3.19)
|
77
|
+
googleapis-common-protos-types (~> 1.0)
|
14
78
|
jaro_winkler (1.5.4)
|
79
|
+
jwt (2.3.0)
|
15
80
|
kramdown (2.4.0)
|
16
81
|
rexml
|
17
82
|
kramdown-parser-gfm (1.1.0)
|
18
83
|
kramdown (~> 2.0)
|
84
|
+
memoist (0.16.2)
|
85
|
+
multi_json (1.15.0)
|
86
|
+
multipart-post (2.1.1)
|
19
87
|
nokogiri (1.13.6-arm64-darwin)
|
20
88
|
racc (~> 1.4)
|
89
|
+
os (1.1.4)
|
21
90
|
parallel (1.22.1)
|
22
91
|
parser (3.1.2.0)
|
23
92
|
ast (~> 2.4.1)
|
93
|
+
public_suffix (4.0.7)
|
24
94
|
racc (1.6.0)
|
25
95
|
rainbow (3.1.1)
|
26
96
|
rake (13.0.6)
|
@@ -40,6 +110,12 @@ GEM
|
|
40
110
|
rubocop-ast (1.18.0)
|
41
111
|
parser (>= 3.1.1.0)
|
42
112
|
ruby-progressbar (1.11.0)
|
113
|
+
ruby2_keywords (0.0.5)
|
114
|
+
signet (0.16.1)
|
115
|
+
addressable (~> 2.8)
|
116
|
+
faraday (>= 0.17.5, < 3.0)
|
117
|
+
jwt (>= 1.5, < 3.0)
|
118
|
+
multi_json (~> 1.10)
|
43
119
|
solargraph (0.45.0)
|
44
120
|
backport (~> 1.2)
|
45
121
|
benchmark
|
@@ -55,6 +131,8 @@ GEM
|
|
55
131
|
thor (~> 1.0)
|
56
132
|
tilt (~> 2.0)
|
57
133
|
yard (~> 0.9, >= 0.9.24)
|
134
|
+
stackdriver-core (1.5.0)
|
135
|
+
google-cloud-core (~> 1.2)
|
58
136
|
thor (1.2.1)
|
59
137
|
tilt (2.0.10)
|
60
138
|
unicode-display_width (2.1.0)
|
@@ -66,6 +144,7 @@ PLATFORMS
|
|
66
144
|
arm64-darwin-21
|
67
145
|
|
68
146
|
DEPENDENCIES
|
147
|
+
google-cloud-logging
|
69
148
|
google_cloud_logging_extension!
|
70
149
|
rake (~> 13.0)
|
71
150
|
solargraph
|
@@ -3,6 +3,31 @@
|
|
3
3
|
module Google
|
4
4
|
module Cloud
|
5
5
|
module Logging
|
6
|
+
module Convert
|
7
|
+
class << self
|
8
|
+
# @param [Exception] exception
|
9
|
+
def exception_to_hash(exception)
|
10
|
+
{
|
11
|
+
class: exception.class.name,
|
12
|
+
message: exception.message,
|
13
|
+
backtrace: exception.backtrace,
|
14
|
+
cause: exception.cause.is_a?(Exception) ? exception_to_hash(exception.cause) : exception.cause
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
alias object_to_value_default object_to_value
|
19
|
+
def object_to_value(obj)
|
20
|
+
if obj.is_a?(Exception)
|
21
|
+
return Google::Protobuf::Value.new(struct_value: hash_to_struct(exception_to_hash(obj)))
|
22
|
+
end
|
23
|
+
return Google::Protobuf::Value.new(struct_value: hash_to_struct(obj.to_hash)) if obj.respond_to?(:to_hash)
|
24
|
+
return Google::Protobuf::Value.new(list_value: array_to_list(obj.to_ary)) if obj.respond_to?(:to_ary)
|
25
|
+
|
26
|
+
object_to_value_default(obj)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
6
31
|
def self.create(log_name, resource_type = 'gce_project', **labels)
|
7
32
|
logging = Google::Cloud::Logging.new
|
8
33
|
writer = logging.async_writer(max_queue_size: 1000)
|
@@ -17,20 +42,10 @@ module Google
|
|
17
42
|
end
|
18
43
|
|
19
44
|
class Entry
|
20
|
-
# @param [Exception] exception
|
21
|
-
def create_exception_payload(exception)
|
22
|
-
{
|
23
|
-
class: exception.class.name,
|
24
|
-
message: exception.message,
|
25
|
-
backtrace: exception.backtrace,
|
26
|
-
cause: exception.cause.is_a?(Exception) ? create_exception_payload(exception.cause) : exception
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
45
|
def payload=(payload)
|
31
46
|
@payload = case payload
|
32
47
|
when Exception
|
33
|
-
|
48
|
+
Google::Cloud::Logging::Convert.exception_to_hash(payload)
|
34
49
|
else
|
35
50
|
payload
|
36
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_cloud_logging_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ishotihadus
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Extension of google-cloud-logging-gem.
|
14
14
|
email:
|