Class: Datadog::Transport::TraceFormatter
- Inherits:
-
Object
- Object
- Datadog::Transport::TraceFormatter
- Defined in:
- lib/ddtrace/transport/trace_formatter.rb
Overview
Prepares traces for transport
Instance Attribute Summary collapse
-
#root_span ⇒ Object
readonly
Returns the value of attribute root_span.
-
#trace ⇒ Object
readonly
Returns the value of attribute trace.
Class Method Summary collapse
Instance Method Summary collapse
-
#format! ⇒ Object
Modifies a trace so suitable for transport.
-
#initialize(trace) ⇒ TraceFormatter
constructor
A new instance of TraceFormatter.
Constructor Details
#initialize(trace) ⇒ TraceFormatter
Returns a new instance of TraceFormatter.
21 22 23 24 |
# File 'lib/ddtrace/transport/trace_formatter.rb', line 21 def initialize(trace) @trace = trace @root_span = find_root_span(trace) end |
Instance Attribute Details
#root_span ⇒ Object (readonly)
Returns the value of attribute root_span.
13 14 15 |
# File 'lib/ddtrace/transport/trace_formatter.rb', line 13 def root_span @root_span end |
#trace ⇒ Object (readonly)
Returns the value of attribute trace.
13 14 15 |
# File 'lib/ddtrace/transport/trace_formatter.rb', line 13 def trace @trace end |
Class Method Details
.format!(trace) ⇒ Object
17 18 19 |
# File 'lib/ddtrace/transport/trace_formatter.rb', line 17 def self.format!(trace) new(trace).format! end |
Instance Method Details
#format! ⇒ Object
Modifies a trace so suitable for transport
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ddtrace/transport/trace_formatter.rb', line 27 def format! return unless trace return trace unless root_span # Because the trace API does not support # trace metadata, we must put our trace # metadata on the root span. This "root span" # is needed by the agent/API to ingest the trace. # Apply generic trace tags. Any more specific value will be overridden # by the subsequent calls below. set_resource! tag_agent_sample_rate! tag_hostname! tag_lang! tag_origin! tag_process_id! tag_rule_sample_rate! tag_runtime_id! tag_rate_limiter_rate! tag_sample_rate! tag_sampling_decision_maker! tag_high_order_trace_id! tag_sampling_priority! trace end |