module Pliny::RequestStore

Public Class Methods

clear!() click to toggle source
# File lib/pliny/request_store.rb, line 3
def self.clear!
  Thread.current[:request_store] = {}
end
seed(env) click to toggle source
# File lib/pliny/request_store.rb, line 7
def self.seed(env)
  store[:request_id] =
    env["REQUEST_IDS"] ? env["REQUEST_IDS"].join(",") : nil

  # a global context that evolves over the lifetime of the request, and is
  # used to tag all log messages that it produces
  store[:log_context] = {
    request_id: store[:request_id]
  }
end
store() click to toggle source
# File lib/pliny/request_store.rb, line 18
def self.store
  Thread.current[:request_store] ||= {}
end