Sha256: d0c2b923ebe3c78bcf1ed4ab9a7e12fb4ea3636f6a24b59da6bb9cee6435793f
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
# typed: true # frozen_string_literal: true require 'ddtrace/ext/http' module Datadog module Profiling module TraceIdentifiers # Used by Datadog::Profiling::TraceIdentifiers::Helper to get the trace identifiers (trace id and span id) for a # given thread, if there is an active trace for that thread in Datadog.tracer. class Ddtrace def initialize(tracer: nil) @tracer = (tracer if tracer.respond_to?(:call_context)) end def trace_identifiers_for(thread) return unless @tracer context = @tracer.call_context(thread) return unless context trace_id = context.trace_id || 0 span_id = context.span_id || 0 [trace_id, span_id, maybe_extract_resource(context.current_root_span)] if trace_id != 0 && span_id != 0 end private # NOTE: Currently we're only interested in HTTP service endpoints. Over time, this list may be expanded. # Resources MUST NOT include personal identifiable information (PII); this should not be the case with # ddtrace integrations, but worth mentioning just in case :) def maybe_extract_resource(root_span) return unless root_span root_span.resource if root_span.span_type == Datadog::Ext::HTTP::TYPE_INBOUND end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ddtrace-0.53.0 | lib/ddtrace/profiling/trace_identifiers/ddtrace.rb |