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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26359f4fec97f64445df7d373d67cd7344e415d4b8db5adedce24d02f03228ec
4
- data.tar.gz: 11f8e6195ec18d7a3ea81b2b533609ae68f76f50f55ae32fb5b3c4b41434ebaf
3
+ metadata.gz: f4dba9a8d7d752a24d9f95fa756388866f125c4db97cc9a3748bd80337a192e8
4
+ data.tar.gz: 403cec2f579dbb0ad26e191c1690fc60f27bb937aa433432f58529cf54936cca
5
5
  SHA512:
6
- metadata.gz: 2fb683c423ec1e34fc92b5dda0e2973b2259768a6dccf5fca9c6f3d7089d3130bf8e820ca8e751f27c325399b0739a73ae145667702f395e98e09dd58ff18fac
7
- data.tar.gz: 1dbab7f8469391b9d6105aef90d3cc0af93ac87622a49052780ce843be941f592f4174fa5bff493cf528c8e1aceef1aad0352b992215309935e6f1edbd5bacfd
6
+ metadata.gz: 5d4c64f4543928835f3c8071f186a77bf904e461d4f003874b33c8ca59dd0008812d9e467d9356b81452e759ccf0a39f3b1876998473e0bd16abd5164bbb3153
7
+ data.tar.gz: e37e1d0ac8f9899b997350d960ff0dcc43ee57a3733f566147fae91537568893d531467c01bb440950a023a98e817a55826c12dc7d87fd85722f5d922acb5151
@@ -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.respond_to?(:call) ? value.call : 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
- message["exception"] = ex.message if ex
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.15.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-02-10 00:00:00.000000000 Z
11
+ date: 2021-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack