Module: RequestId
- Defined in:
- lib/request_id.rb,
lib/request_id/version.rb
Constant Summary collapse
- VERSION =
'0.1.2'
Class Method Summary collapse
-
.request_id ⇒ Object
Public: Retrieve the current request_id, which is generally set by the Rack or Sidekiq middleware.
-
.request_id=(request_id) ⇒ Object
Internal: Set the current request_id.
Class Method Details
.request_id ⇒ Object
Public: Retrieve the current request_id, which is generally set by the Rack or Sidekiq middleware.
Examples
RequestId.request_id
# => "0b482498be0d6084d2b634cd6523418d"
Returns the String request id.
15 16 17 |
# File 'lib/request_id.rb', line 15 def request_id Thread.current[:request_id] end |
.request_id=(request_id) ⇒ Object
Internal: Set the current request_id.
Examples
RequestId.request_id = SecureRandom.hex
# => "2297456c027c536d0eb3eb86583fe5a9"
Returns the new String request id.
27 28 29 |
# File 'lib/request_id.rb', line 27 def request_id=(request_id) Thread.current[:request_id] = request_id end |