gitlab-labkit 0.14.0 → 0.15.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: 2b2b166e9a540a6314a2c5e863e7f109f6c3763f2649aa459dfec41a5018e57f
4
- data.tar.gz: 7dc9c77305e855d930420dca4e59cba0e18bd990fae24a7a44e871a7e03e84ed
3
+ metadata.gz: 26359f4fec97f64445df7d373d67cd7344e415d4b8db5adedce24d02f03228ec
4
+ data.tar.gz: 11f8e6195ec18d7a3ea81b2b533609ae68f76f50f55ae32fb5b3c4b41434ebaf
5
5
  SHA512:
6
- metadata.gz: 81819b7e4fd168c805e286f9315dd5a757423367938619021dcb7e81d5ad41a6f057224bfc046d96a132354688b33b0b4ed2c3e2196dfa09725176bb32b6ca3e
7
- data.tar.gz: 35d67adc6f7561609f617df26af9a3942e77cd1b66000523584308bd160c88062dc0fcd1ed6e0d9662f1af6a5c6436c80fe80b53d5b6b4c86ba1e880b24f5a61
6
+ metadata.gz: 2fb683c423ec1e34fc92b5dda0e2973b2259768a6dccf5fca9c6f3d7089d3130bf8e820ca8e751f27c325399b0739a73ae145667702f395e98e09dd58ff18fac
7
+ data.tar.gz: 1dbab7f8469391b9d6105aef90d3cc0af93ac87622a49052780ce843be941f592f4174fa5bff493cf528c8e1aceef1aad0352b992215309935e6f1edbd5bacfd
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
21
21
  # Please maintain alphabetical order for dependencies
22
22
  spec.add_runtime_dependency "actionpack", ">= 5.0.0", "< 7.0.0"
23
23
  spec.add_runtime_dependency "activesupport", ">= 5.0.0", "< 7.0.0"
24
- spec.add_runtime_dependency "gitlab-pg_query", "~> 1.3"
25
24
  spec.add_runtime_dependency "grpc", "~> 1.19" # Be sure to update the "grpc-tools" dev_depenency too
26
25
  spec.add_runtime_dependency "jaeger-client", "~> 1.1"
27
26
  spec.add_runtime_dependency "opentracing", "~> 0.4"
27
+ spec.add_runtime_dependency "pg_query", "~> 1.3"
28
28
  spec.add_runtime_dependency "redis", ">3.0.0", "<5.0.0"
29
29
 
30
30
  # Please maintain alphabetical order for dev dependencies
@@ -92,11 +92,11 @@ module Labkit
92
92
  def start_payload(datum)
93
93
  payload = {
94
94
  method: datum[:method].to_s.upcase,
95
- host: datum[:host],
96
- path: datum[:path],
97
- port: datum[:port],
98
- scheme: datum[:scheme],
99
- query: datum[:query],
95
+ host: nil_or_string(datum[:host]),
96
+ path: nil_or_string(datum[:path]),
97
+ port: nil_or_int(datum[:port]),
98
+ scheme: nil_or_string(datum[:scheme]),
99
+ query: generate_query_string(datum[:query]),
100
100
  start_time: ::Labkit::System.monotonic_time,
101
101
  }
102
102
  unless datum[:proxy].nil?
@@ -126,5 +126,23 @@ module Labkit
126
126
  def remove_connection_payload(datum)
127
127
  connection_payload.delete(datum[:connection])
128
128
  end
129
+
130
+ def nil_or_string(str)
131
+ str&.to_s
132
+ end
133
+
134
+ def nil_or_int(int)
135
+ int&.to_i
136
+ rescue
137
+ nil
138
+ end
139
+
140
+ def generate_query_string(query)
141
+ if query.is_a?(Hash)
142
+ query.to_query
143
+ else
144
+ nil_or_string(query)
145
+ end
146
+ end
129
147
  end
130
148
  end
@@ -77,6 +77,8 @@ 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
81
+
80
82
  @log_file.puts(JSON.dump(message))
81
83
  end
82
84
  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.14.0
4
+ version: 0.15.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-01-13 00:00:00.000000000 Z
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -51,61 +51,61 @@ dependencies:
51
51
  - !ruby/object:Gem::Version
52
52
  version: 7.0.0
53
53
  - !ruby/object:Gem::Dependency
54
- name: gitlab-pg_query
54
+ name: grpc
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.3'
59
+ version: '1.19'
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '1.3'
66
+ version: '1.19'
67
67
  - !ruby/object:Gem::Dependency
68
- name: grpc
68
+ name: jaeger-client
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: '1.19'
73
+ version: '1.1'
74
74
  type: :runtime
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: '1.19'
80
+ version: '1.1'
81
81
  - !ruby/object:Gem::Dependency
82
- name: jaeger-client
82
+ name: opentracing
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: '1.1'
87
+ version: '0.4'
88
88
  type: :runtime
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
- version: '1.1'
94
+ version: '0.4'
95
95
  - !ruby/object:Gem::Dependency
96
- name: opentracing
96
+ name: pg_query
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '0.4'
101
+ version: '1.3'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: '0.4'
108
+ version: '1.3'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: redis
111
111
  requirement: !ruby/object:Gem::Requirement