gitlab-labkit 0.17.1 → 0.21.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: 235f0b00e0d08d7ee809ae43736e0ce5c900c0c75d402028bfb1247df868f9ac
4
- data.tar.gz: 759c4d7bd91c75aeb7bc2b737f55558c6426b32940a399cca982efebb7b1740f
3
+ metadata.gz: e04a68390f7e0f702df828d84e7aca653078d2f2c9fd43c2a4d28ce4c0a0264c
4
+ data.tar.gz: 1a798386f1356e7accec88c005130a13bb362c7eb092689345f611d138823d5d
5
5
  SHA512:
6
- metadata.gz: 42c83bbcdcb9c588a703400bd5d1830e426680e9d433a223026566d1417a7eb8000dec99530e2e9887935686938e6e2128c8953f44540ead950447c3a3d2b564
7
- data.tar.gz: 9cd740e3bd04db453cf812b1efc71a6d5b516c875cfce4cfb0837660390c8457b86679c775f2d23b1dd373b59183255268340d710215d1f1bac5864fdf03c2f6
6
+ metadata.gz: f722b472734581147d9ec3352647623a1ad6095889a68f6366368932e9c96fc127494bb8aa66e16ec216df9136d8311707e1f0e4731d27e9779b6805323a1c08
7
+ data.tar.gz: ff2e00b52a0dd6ab6cc232fba570c8bd0f74adb682d3fe8f67e72934f9fba6cf28bfeb7f9ad1272df1f67203c25986a2313136738891254fdddb97ae2dc38cfe
data/.gitlab-ci.yml CHANGED
@@ -17,6 +17,10 @@ workflow:
17
17
  - bundle install
18
18
  - bundle exec rake verify build install
19
19
 
20
+ test:3.0:
21
+ image: ruby:3.0
22
+ <<: *test_definition
23
+
20
24
  test:2.7:
21
25
  image: ruby:2.7
22
26
  <<: *test_definition
data/Rakefile CHANGED
@@ -3,10 +3,8 @@
3
3
  require "bundler/gem_tasks"
4
4
  require "rufo"
5
5
 
6
- begin
7
- require "rspec/core/rake_task"
8
- RSpec::Core::RakeTask.new(:spec)
9
- end
6
+ require "rspec/core/rake_task"
7
+ RSpec::Core::RakeTask.new(:spec)
10
8
 
11
9
  require "rubocop/rake_task"
12
10
  RuboCop::RakeTask.new(:rubocop) do |task|
@@ -21,17 +21,17 @@ 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 "grpc", "~> 1.19" # Be sure to update the "grpc-tools" dev_depenency too
24
+ spec.add_runtime_dependency "grpc", "~> 1.38" # Be sure to update the "grpc-tools" dev_dependency too
25
25
  spec.add_runtime_dependency "jaeger-client", "~> 1.1"
26
26
  spec.add_runtime_dependency "opentracing", "~> 0.4"
27
- spec.add_runtime_dependency "pg_query", "~> 2.0"
27
+ spec.add_runtime_dependency "pg_query", "~> 2.1"
28
28
  spec.add_runtime_dependency "redis", ">3.0.0", "<5.0.0"
29
29
 
30
30
  # Please maintain alphabetical order for dev dependencies
31
31
  spec.add_development_dependency "excon", "~> 0.78.1"
32
32
  spec.add_development_dependency "faraday", "~> 1.2.0"
33
33
  spec.add_development_dependency "gitlab-styles", "~> 6.2.0"
34
- spec.add_development_dependency "grpc-tools", "~> 1.19"
34
+ spec.add_development_dependency "grpc-tools", "~> 1.38"
35
35
  spec.add_development_dependency "httparty", "~> 0.17.3"
36
36
  spec.add_development_dependency "httpclient", "~> 2.8.3"
37
37
  spec.add_development_dependency "pry", "~> 0.12"
@@ -42,4 +42,5 @@ Gem::Specification.new do |spec|
42
42
  spec.add_development_dependency "rspec-parameterized", "~> 0.4"
43
43
  spec.add_development_dependency "rufo", "0.9.0"
44
44
  spec.add_development_dependency "sidekiq", "~> 5.2.7"
45
+ spec.add_development_dependency "webrick", "~> 1.7.0"
45
46
  end
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "securerandom"
4
+
3
5
  require "active_support/core_ext/module/delegation"
4
6
  require "active_support/core_ext/string/starts_ends_with"
7
+ require "active_support/core_ext/string/inflections"
5
8
 
6
9
  module Labkit
7
10
  # A context can be used to provide structured information on what resources
@@ -28,6 +28,12 @@ module Labkit
28
28
  ""
29
29
  end
30
30
 
31
+ def self.sql_fingerprint(normalized_sql)
32
+ PgQuery.parse(normalized_sql)&.fingerprint
33
+ rescue PgQuery::ParseError
34
+ ""
35
+ end
36
+
31
37
  # Ensures that URLS are sanitized to hide credentials
32
38
  def self.mask_url(url)
33
39
  url = url.to_s.strip
@@ -14,7 +14,11 @@ module Labkit
14
14
  end
15
15
 
16
16
  def tags(payload)
17
- sql = Labkit::Logging::Sanitizer.sanitize_sql(payload[:sql]) if Labkit::Tracing.sampled? && payload[:sql]
17
+ if Labkit::Tracing.sampled? && payload[:sql]
18
+ sql = Labkit::Logging::Sanitizer.sanitize_sql(payload[:sql])
19
+ fingerprint = Labkit::Logging::Sanitizer.sql_fingerprint(sql)
20
+ end
21
+
18
22
  {
19
23
  "component" => COMPONENT_TAG,
20
24
  "span.kind" => "client",
@@ -22,6 +26,7 @@ module Labkit
22
26
  "db.connection_id" => payload[:connection_id],
23
27
  "db.cached" => payload[:cached] || false,
24
28
  "db.statement" => sql,
29
+ "db.statement_fingerprint" => fingerprint,
25
30
  }
26
31
  end
27
32
  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.17.1
4
+ version: 0.21.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-04-23 00:00:00.000000000 Z
11
+ date: 2021-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -56,14 +56,14 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.19'
59
+ version: '1.38'
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.19'
66
+ version: '1.38'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: jaeger-client
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -98,14 +98,14 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '2.0'
101
+ version: '2.1'
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: '2.0'
108
+ version: '2.1'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: redis
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -174,14 +174,14 @@ dependencies:
174
174
  requirements:
175
175
  - - "~>"
176
176
  - !ruby/object:Gem::Version
177
- version: '1.19'
177
+ version: '1.38'
178
178
  type: :development
179
179
  prerelease: false
180
180
  version_requirements: !ruby/object:Gem::Requirement
181
181
  requirements:
182
182
  - - "~>"
183
183
  - !ruby/object:Gem::Version
184
- version: '1.19'
184
+ version: '1.38'
185
185
  - !ruby/object:Gem::Dependency
186
186
  name: httparty
187
187
  requirement: !ruby/object:Gem::Requirement
@@ -322,6 +322,20 @@ dependencies:
322
322
  - - "~>"
323
323
  - !ruby/object:Gem::Version
324
324
  version: 5.2.7
325
+ - !ruby/object:Gem::Dependency
326
+ name: webrick
327
+ requirement: !ruby/object:Gem::Requirement
328
+ requirements:
329
+ - - "~>"
330
+ - !ruby/object:Gem::Version
331
+ version: 1.7.0
332
+ type: :development
333
+ prerelease: false
334
+ version_requirements: !ruby/object:Gem::Requirement
335
+ requirements:
336
+ - - "~>"
337
+ - !ruby/object:Gem::Version
338
+ version: 1.7.0
325
339
  description:
326
340
  email:
327
341
  - andrew@gitlab.com