lib/ddtrace/tracer.rb in ddtrace-0.49.0 vs lib/ddtrace/tracer.rb in ddtrace-0.50.0

- old
+ new

@@ -72,11 +72,13 @@ # # * +enabled+: set if the tracer submits or not spans to the local agent. It's enabled # by default. def initialize(options = {}) # Configurable options - @context_flush = if options[:partial_flush] + @context_flush = if options[:context_flush] + options[:context_flush] + elsif options[:partial_flush] Datadog::ContextFlush::Partial.new(options) else Datadog::ContextFlush::Finished.new end @@ -116,12 +118,14 @@ @enabled = enabled unless enabled.nil? @sampler = sampler unless sampler.nil? configure_writer(options) - if options.key?(:partial_flush) - @context_flush = if options[:partial_flush] + if options.key?(:context_flush) || options.key?(:partial_flush) + @context_flush = if options[:context_flush] + options[:context_flush] + elsif options[:partial_flush] Datadog::ContextFlush::Partial.new(options) else Datadog::ContextFlush::Finished.new end end @@ -160,10 +164,10 @@ # appended to each span created by the tracer. Keys and values must be strings. # A valid example is: # # tracer.set_tags('env' => 'prod', 'component' => 'core') def set_tags(tags) - string_tags = Hash[tags.collect { |k, v| [k.to_s, v] }] + string_tags = tags.collect { |k, v| [k.to_s, v] }.to_h @tags = @tags.merge(string_tags) end # Guess context and parent from child_of entry. def guess_context_and_parent(child_of)