gitlab-labkit 0.18.0 → 0.19.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: 2d1b3569e3032ab75917a5fccc48dc4d29a7f8bb7ce25bd94b07552693cde66f
4
- data.tar.gz: 521050774784e77217b6ac86e9faa4c82455802b10d9a33d263849e65c91be62
3
+ metadata.gz: 2eed1c5eae7363851222a82aaeae8088a5227912d0d01d1f1b30e3e0514a25e2
4
+ data.tar.gz: 44167dc3c31083dcb58028c7851106ba47dcd8ac590a02e3306d3f8ef741fd41
5
5
  SHA512:
6
- metadata.gz: c7956a088be110af584ebc8f5e4979e6edd154cf8f13dc587b413afb1247feb9ed5712e5f76625bf48c800d5d36e896f58b62de909d212d4292235d02d57b9d6
7
- data.tar.gz: 9dbc20edb7bf500cc30317c5c4f385de32cf03980907e993802850710f3d797ee05cc086e74948df4110c4a0f63a511e5c8857cb3aeb93288e9fe47acce0011e
6
+ metadata.gz: 44f99cd2425d95c738d522c496d37319f318360d5c79be3ab3822f38bd95c7aec7f40fb307c2435c28bb43642539d7c84f5501d1f83c4f1905f5cc6fd645f0f9
7
+ data.tar.gz: 5603763f8cee8f7fff87d963ef87e66989a5860d4d6dc58d35c5530383bfd7c99f88a62e768982e87e1b7a9fc56f20f0101db9a140a2765818d39807c9f2e14a
@@ -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.18.0
4
+ version: 0.19.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-05-31 00:00:00.000000000 Z
11
+ date: 2021-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack