Module: Labkit::Correlation::CorrelationId
- Defined in:
- lib/labkit/correlation/correlation_id.rb
Overview
CorrelationId module provides access the Correlation-ID of the current request
Constant Summary collapse
- LOG_KEY =
Labkit::Context::CORRELATION_ID_KEY
Class Method Summary collapse
Class Method Details
.current_id ⇒ Object
17 18 19 |
# File 'lib/labkit/correlation/correlation_id.rb', line 17 def current_id Labkit::Context.correlation_id end |
.current_or_new_id ⇒ Object
21 22 23 |
# File 'lib/labkit/correlation/correlation_id.rb', line 21 def current_or_new_id current_id || Labkit::Context.push.correlation_id end |
.use_id(correlation_id) ⇒ Object
11 12 13 14 15 |
# File 'lib/labkit/correlation/correlation_id.rb', line 11 def use_id(correlation_id) Labkit::Context.with_context(LOG_KEY => correlation_id) do |context| yield(context.correlation_id) end end |