gitlab-labkit 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/labkit/context.rb +11 -1
- data/lib/labkit/logging/grpc/server_interceptor.rb +4 -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: f4dba9a8d7d752a24d9f95fa756388866f125c4db97cc9a3748bd80337a192e8
|
4
|
+
data.tar.gz: 403cec2f579dbb0ad26e191c1690fc60f27bb937aa433432f58529cf54936cca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d4c64f4543928835f3c8071f186a77bf904e461d4f003874b33c8ca59dd0008812d9e467d9356b81452e759ccf0a39f3b1876998473e0bd16abd5164bbb3153
|
7
|
+
data.tar.gz: e37e1d0ac8f9899b997350d960ff0dcc43ee57a3733f566147fae91537568893d531467c01bb440950a023a98e817a55826c12dc7d87fd85722f5d922acb5151
|
data/lib/labkit/context.rb
CHANGED
@@ -106,6 +106,12 @@ module Labkit
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
+
def get_attribute(attribute)
|
110
|
+
raw = call_or_value(data[log_key(attribute)])
|
111
|
+
|
112
|
+
call_or_value(raw)
|
113
|
+
end
|
114
|
+
|
109
115
|
protected
|
110
116
|
|
111
117
|
def assign_attributes(attributes)
|
@@ -130,9 +136,13 @@ module Labkit
|
|
130
136
|
|
131
137
|
attr_reader :data
|
132
138
|
|
139
|
+
def call_or_value(value)
|
140
|
+
value.respond_to?(:call) ? value.call : value
|
141
|
+
end
|
142
|
+
|
133
143
|
def expand_data
|
134
144
|
data.transform_values do |value|
|
135
|
-
value = value
|
145
|
+
value = call_or_value(value)
|
136
146
|
|
137
147
|
value.presence
|
138
148
|
end.compact
|
@@ -77,7 +77,10 @@ module Labkit
|
|
77
77
|
time: Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S.%LZ"),
|
78
78
|
)
|
79
79
|
|
80
|
-
|
80
|
+
if ex
|
81
|
+
message["exception"] = ex.message
|
82
|
+
message["exception_backtrace"] = ex.backtrace[0..5] if ex.backtrace
|
83
|
+
end
|
81
84
|
|
82
85
|
@log_file.puts(JSON.dump(message))
|
83
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-labkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Newdigate
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|