lib/ddtrace/tracer.rb in ddtrace-0.36.0 vs lib/ddtrace/tracer.rb in ddtrace-0.37.0
- old
+ new
@@ -312,11 +312,11 @@
# trace is not available to flush or if the trace has not been
# chosen to be sampled.
def record_context(context)
trace = @context_flush.consume!(context)
- write(trace) if trace && !trace.empty?
+ write(trace) if @enabled && trace && !trace.empty?
end
# Return the current active span or +nil+.
def active_span
call_context.current_span
@@ -333,10 +333,10 @@
end
# Send the trace to the writer to enqueue the spans list in the agent
# sending queue.
def write(trace)
- return if @writer.nil? || !@enabled
+ return if @writer.nil?
if Datadog.configuration.diagnostics.debug
Datadog.logger.debug("Writing #{trace.length} spans (enabled: #{@enabled})")
str = String.new('')
PP.pp(trace, str)