google_cloud_logging_extension 0.1.0 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44415cf20a26f3450f298d5071b7817126c693f0f2d43f2157124306d2169e06
4
- data.tar.gz: 0be5fd106d23db06709a09ac284d5d1733c9fbcb04b6a0be23acc8a3a666fded
3
+ metadata.gz: 9e8e21269aec809bae86832647700f5c148b00e9509ec5d42d9bd95fb3888f67
4
+ data.tar.gz: 6a03bdc729fa8d729190b16290e226b7dbcab2ef2faba50284fbc35f7fd59c26
5
5
  SHA512:
6
- metadata.gz: 85350a0b3b8e487c8c516584cde20941fa9efe259c4df4e29b4d41638fb2d0e3d37dfdd7d40451bee0e0a5a265047003ecac1377c16f43a4a3e3dbdb388ed5c6
7
- data.tar.gz: 1e42ab6bc5547c0d5cb2e1e0a5e58db9fc10f89766a3a4b12ee684b648989bc821c5638fdb009471bd3a8520dde0c5675d12ec47d08599c2a56c0f6a51891aeb
6
+ metadata.gz: ea952ef3015dc8c513fcbe46a73db810371723b8dd46ca2d533274405eb0d895eae8823fea9fb97f2d6e4cfcf6d0a2cdd49074fc49377e208da6bcb139164797
7
+ data.tar.gz: 6ecd6ec725e78de64d19c84643de3477ad262f8bd6351031e52103997bda99bbb3f534e8456e18f1045a0cc4289a84563a188111177438486fc5a53299db8581
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in google_cloud_logging_extension.gemspec
6
6
  gemspec
7
7
 
8
+ gem 'google-cloud-logging'
8
9
  gem 'rake', '~> 13.0'
9
10
 
10
11
  group :development, :test do
data/Gemfile.lock CHANGED
@@ -1,26 +1,96 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- google_cloud_logging_extension (0.1.0)
4
+ google_cloud_logging_extension (0.1.2)
5
5
 
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
@@ -1,8 +1,38 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'google/cloud/logging'
4
+
3
5
  module Google
4
6
  module Cloud
5
7
  module Logging
8
+ module Convert
9
+ class << self
10
+ # @param [Exception] exception
11
+ def exception_to_hash(exception, root: false)
12
+ hash = {
13
+ class: exception.class.name,
14
+ message: exception.full_message(highlight: false),
15
+ summary: exception.message,
16
+ backtrace: exception.backtrace,
17
+ cause: exception.cause.is_a?(Exception) ? exception_to_hash(exception.cause) : exception.cause
18
+ }
19
+ hash['@type'] = 'type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent' if root
20
+ hash
21
+ end
22
+
23
+ alias object_to_value_default object_to_value
24
+ def object_to_value(obj)
25
+ if obj.is_a?(Exception)
26
+ return Google::Protobuf::Value.new(struct_value: hash_to_struct(exception_to_hash(obj)))
27
+ end
28
+ return Google::Protobuf::Value.new(struct_value: hash_to_struct(obj.to_hash)) if obj.respond_to?(:to_hash)
29
+ return Google::Protobuf::Value.new(list_value: array_to_list(obj.to_ary)) if obj.respond_to?(:to_ary)
30
+
31
+ object_to_value_default(obj)
32
+ end
33
+ end
34
+ end
35
+
6
36
  def self.create(log_name, resource_type = 'gce_project', **labels)
7
37
  logging = Google::Cloud::Logging.new
8
38
  writer = logging.async_writer(max_queue_size: 1000)
@@ -17,20 +47,10 @@ module Google
17
47
  end
18
48
 
19
49
  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
50
  def payload=(payload)
31
51
  @payload = case payload
32
52
  when Exception
33
- create_exception_payload(payload)
53
+ Google::Cloud::Logging::Convert.exception_to_hash(payload, root: true)
34
54
  else
35
55
  payload
36
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoogleCloudLoggingExtension
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.3'
5
5
  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.0
4
+ version: 0.1.3
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-01 00:00:00.000000000 Z
11
+ date: 2022-06-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Extension of google-cloud-logging-gem.
14
14
  email: