Class: Datadog::Trace::LambdaContext
- Inherits:
-
XRay::DefaultContext
- Object
- XRay::DefaultContext
- Datadog::Trace::LambdaContext
- Defined in:
- lib/datadog/lambda/trace/xray_lambda.rb
Overview
LambdaContext updated the trace id based on the curren trace header, using a FacadeSegment
Instance Method Summary collapse
Instance Method Details
#check_context ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/datadog/lambda/trace/xray_lambda.rb', line 43 def check_context # Create a new FacadeSegment if the _X_AMZN_TRACE_ID changes. return if ENV['_X_AMZN_TRACE_ID'] == @current_trace_id # puts "XRAY: Starting new segment for #{ENV['_X_AMZN_TRACE_ID']}" @current_trace_id = ENV['_X_AMZN_TRACE_ID'] trace_header = XRay::TraceHeader.from_header_string( header_str: @current_trace_id ) segment = FacadeSegment.new(trace_id: trace_header.root, parent_id: trace_header.parent_id, id: trace_header.parent_id, name: 'lambda_context', sampled: trace_header.sampled) store_entity(entity: segment) end |
#current_entity ⇒ Object
60 61 62 63 64 65 |
# File 'lib/datadog/lambda/trace/xray_lambda.rb', line 60 def current_entity # ensure the FacadeSegment is current whenever the current_entity is # retrieved check_context super end |
#handle_context_missing ⇒ Object
39 40 41 |
# File 'lib/datadog/lambda/trace/xray_lambda.rb', line 39 def handle_context_missing nil end |