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 +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/lib/labkit/context.rb +11 -0
- data/lib/labkit/tracing/jaeger_factory.rb +1 -1
- data/lib/labkit/tracing/tracing_utils.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e864e350d93a5e548f45e62e01a17d202417b8a704b312459a2bbc473e138a5
|
4
|
+
data.tar.gz: 3d4c3eca906b444e92a58f998b39053d749ab2ced25d749fee287bb890b68d78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 481b991d04eeb4dd91f4774656676044b10fac05aba31bdd2d1a84c2bd94b71b0a5e444c2d7639957cf63aecdba6bbc3a61548564414645b849a901449ec025b
|
7
|
+
data.tar.gz: 44be5b6acde66b7d2ba1fed2413e85a9edeaff9cd66deab4b878b31498f7fdb77d015f6ebabfe8c6d52a4ba7fe2b26b5c6f2e1433a8c276a9f35b662516e7f14
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/lib/labkit/context.rb
CHANGED
@@ -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)
|
@@ -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.
|
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-
|
11
|
+
date: 2020-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|