Module: AppOpticsAPM::SDK::CurrentTrace
- Included in:
- AppOpticsAPM::SDK
- Defined in:
- lib/appoptics_apm/sdk/current_trace.rb
Defined Under Namespace
Classes: TraceId
Instance Method Summary collapse
-
#current_trace ⇒ Object
Creates an instance of TraceId with instance methods TraceId#id, TraceId#for_log and TraceId#hash_for_log.
Instance Method Details
#current_trace ⇒ Object
Creates an instance of TraceId with instance methods AppOpticsAPM::SDK::CurrentTrace::TraceId#id, AppOpticsAPM::SDK::CurrentTrace::TraceId#for_log and AppOpticsAPM::SDK::CurrentTrace::TraceId#hash_for_log.
Example:
trace = AppOpticsAPM::SDK.current_trace
trace.id # '7435A9FE510AE4533414D425DADF4E180D2B4E36-0'
trace.for_log # 'ao.traceId=7435A9FE510AE4533414D425DADF4E180D2B4E36-0' or '' depends on Config
trace.hash_for_log # { ao: { traceId: '7435A9FE510AE4533414D425DADF4E180D2B4E36-0 } } or {} depends on Config
Configure traceId injection with lograge:
Lograge. = lambda do |event|
AppOpticsAPM::SDK.current_trace.hash_for_log
end
27 28 29 |
# File 'lib/appoptics_apm/sdk/current_trace.rb', line 27 def current_trace TraceId.new end |