lib/labkit/context.rb in gitlab-labkit-0.31.1 vs lib/labkit/context.rb in gitlab-labkit-0.32.0
- old
+ new
@@ -24,11 +24,10 @@
#
class Context
LOG_KEY = "meta"
CORRELATION_ID_KEY = "correlation_id"
RAW_KEYS = [CORRELATION_ID_KEY].freeze
- HEADER_PREFIX = "X-Gitlab-"
class << self
def with_context(attributes = {})
context = push(attributes)
@@ -69,14 +68,10 @@
def known_log_keys
@known_log_keys ||= (KNOWN_KEYS.map(&method(:log_key)) + RAW_KEYS).freeze
end
- def header_name(name)
- HEADER_PREFIX + log_key(name).titlecase(keep_id_suffix: true).gsub(/\W/, "-")
- end
-
private
def contexts
Thread.current[:labkit_contexts] ||= []
end
@@ -99,15 +94,9 @@
expand_data
end
def correlation_id
data[CORRELATION_ID_KEY]
- end
-
- def to_headers
- to_h.except(CORRELATION_ID_KEY).transform_keys do |key|
- self.class.header_name(key)
- end
end
def get_attribute(attribute)
raw = call_or_value(data[log_key(attribute)])