gitlab-labkit 0.13.3 → 0.13.4

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: f7365b2f12b026f6b497d56738197b66e34014676dc284f568e97fad669cecef
4
- data.tar.gz: ca9da033595aed9506edd7ba376a1bdd0b15c8e880a5e6b3edc52dc72b5a5570
3
+ metadata.gz: 5e864e350d93a5e548f45e62e01a17d202417b8a704b312459a2bbc473e138a5
4
+ data.tar.gz: 3d4c3eca906b444e92a58f998b39053d749ab2ced25d749fee287bb890b68d78
5
5
  SHA512:
6
- metadata.gz: 87aaa07295098883563e77694fdb1401ba9e2e5fbc26569ee0b87f8ce7bc329f0d26b78df5d2e1c2e97b86f3d7ec3c41200406eb2b7028aba8ce8bdec4001ab4
7
- data.tar.gz: 42f5dcee07855cd347b9585b96e44ac3e36e05a5fd634db55ddea02676b82df9c35e0ba3d6bbbbf0e4c6b4ec16906ff8a86f041db67d392485008d811f3d20b2
6
+ metadata.gz: 481b991d04eeb4dd91f4774656676044b10fac05aba31bdd2d1a84c2bd94b71b0a5e444c2d7639957cf63aecdba6bbc3a61548564414645b849a901449ec025b
7
+ data.tar.gz: 44be5b6acde66b7d2ba1fed2413e85a9edeaff9cd66deab4b878b31498f7fdb77d015f6ebabfe8c6d52a4ba7fe2b26b5c6f2e1433a8c276a9f35b662516e7f14
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  Gemfile.lock
2
2
  *.gem
3
3
  node_modules
4
+ .bundle
@@ -1 +1 @@
1
- 2.6.3
1
+ 2.7.2
@@ -21,6 +21,7 @@ module Labkit
21
21
  LOG_KEY = "meta"
22
22
  CORRELATION_ID_KEY = "correlation_id"
23
23
  RAW_KEYS = [CORRELATION_ID_KEY].freeze
24
+ HEADER_PREFIX = "X-Gitlab-"
24
25
  KNOWN_KEYS = %w[user project root_namespace subscription_plan caller_id
25
26
  related_class feature_category].freeze
26
27
 
@@ -67,6 +68,10 @@ module Labkit
67
68
  @known_log_keys ||= (KNOWN_KEYS.map(&method(:log_key)) + RAW_KEYS).freeze
68
69
  end
69
70
 
71
+ def header_name(name)
72
+ HEADER_PREFIX + log_key(name).titlecase(keep_id_suffix: true).gsub(/\W/, "-")
73
+ end
74
+
70
75
  private
71
76
 
72
77
  def contexts
@@ -95,6 +100,12 @@ module Labkit
95
100
  data[CORRELATION_ID_KEY]
96
101
  end
97
102
 
103
+ def to_headers
104
+ to_h.except(CORRELATION_ID_KEY).transform_keys do |key|
105
+ self.class.header_name(key)
106
+ end
107
+ end
108
+
98
109
  protected
99
110
 
100
111
  def assign_attributes(attributes)
@@ -37,7 +37,7 @@ module Labkit
37
37
  warn message
38
38
  end
39
39
 
40
- Jaeger::Client.build(kwargs)
40
+ Jaeger::Client.build(**kwargs)
41
41
  end
42
42
 
43
43
  def self.get_sampler(sampler_type, sampler_param)
@@ -49,7 +49,7 @@ module Labkit
49
49
  # Add exception logging to a span
50
50
  def self.log_exception_on_span(span, exception)
51
51
  span.set_tag("error", true)
52
- span.log_kv(kv_tags_for_exception(exception))
52
+ span.log_kv(**kv_tags_for_exception(exception))
53
53
  end
54
54
 
55
55
  # Generate key-value tags for an exception
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.13.3
4
+ version: 0.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newdigate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-01 00:00:00.000000000 Z
11
+ date: 2020-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack