class Datadog::Profiling::TraceIdentifiers::Helper
Helper
used to retrieve the trace identifiers (trace id and span id) for a given thread, if there is an active trace for that thread for the supported tracing APIs.
This data is used to connect profiles to the traces – samples in a profile will be tagged with this data and the profile can be filtered down to look at only the samples for a given trace.
Constants
- DEFAULT_SUPPORTED_APIS
Public Class Methods
new( tracer:, extract_trace_resource:, supported_apis: DEFAULT_SUPPORTED_APIS.map { |api| api.new(tracer: tracer) } )
click to toggle source
# File lib/ddtrace/profiling/trace_identifiers/helper.rb, line 20 def initialize( tracer:, # If this is disabled, the helper will strip the optional trace_resource_container even if provided by the api extract_trace_resource:, supported_apis: DEFAULT_SUPPORTED_APIS.map { |api| api.new(tracer: tracer) } ) @extract_trace_resource = extract_trace_resource @supported_apis = supported_apis end
Public Instance Methods
trace_identifiers_for(thread)
click to toggle source
Expected output of the trace_identifiers_for
duck type is [trace_id, span_id, (optional trace_resource_container)]
# File lib/ddtrace/profiling/trace_identifiers/helper.rb, line 32 def trace_identifiers_for(thread) @supported_apis.each do |api| trace_identifiers = api.trace_identifiers_for(thread) if trace_identifiers return @extract_trace_resource ? trace_identifiers : trace_identifiers[0..1] end end nil end