lib/ddtrace/tracer.rb in ddtrace-0.40.0 vs lib/ddtrace/tracer.rb in ddtrace-0.41.0
- old
+ new
@@ -1,6 +1,5 @@
-require 'pp'
require 'thread'
require 'logger'
require 'pathname'
require 'ddtrace/environment'
@@ -184,12 +183,11 @@
# * +span_type+: the type of the span (such as \http, \db and so on)
# * +child_of+: a \Span or a \Context instance representing the parent for this span.
# * +start_time+: when the span actually starts (defaults to \now)
# * +tags+: extra tags which should be added to the span.
def start_span(name, options = {})
- start_time = options.fetch(:start_time, Time.now.utc)
-
+ start_time = options[:start_time]
tags = options.fetch(:tags, {})
span_options = options.select do |k, _v|
# Filter options, we want no side effects with unexpected args.
ALLOWED_SPAN_OPTIONS.include?(k)
@@ -210,12 +208,13 @@
end
else
# child span
span.parent = parent # sets service, trace_id, parent_id, sampled
end
+
span.set_tags(@tags) unless @tags.empty?
span.set_tags(tags) unless tags.empty?
- span.start_time = start_time
+ span.start(start_time)
# this could at some point be optional (start_active_span vs start_manual_span)
ctx.add_span(span) unless ctx.nil?
span