lib/ddtrace/tracer.rb in ddtrace-0.26.1 vs lib/ddtrace/tracer.rb in ddtrace-0.27.0
- old
+ new
@@ -118,13 +118,10 @@
@context_flush = options[:partial_flush] ? Datadog::ContextFlush.new(options) : nil
@mutex = Mutex.new
@tags = {}
-
- # Enable priority sampling by default
- activate_priority_sampling!(@sampler)
end
# Updates the current \Tracer instance, so that the tracer can be configured after the
# initialization. Available +options+ are:
#
@@ -218,20 +215,19 @@
def start_span(name, options = {})
start_time = options.fetch(:start_time, Time.now.utc)
tags = options.fetch(:tags, {})
- opts = options.select do |k, _v|
+ span_options = options.select do |k, _v|
# Filter options, we want no side effects with unexpected args.
- # Plus, this documents the code (Ruby 2 named args would be better but we're Ruby 1.9 compatible)
ALLOWED_SPAN_OPTIONS.include?(k)
end
ctx, parent = guess_context_and_parent(options[:child_of])
- opts[:context] = ctx unless ctx.nil?
+ span_options[:context] = ctx unless ctx.nil?
- span = Span.new(self, name, opts)
+ span = Span.new(self, name, span_options)
if parent.nil?
# root span
@sampler.sample!(span)
span.set_tag('system.pid', Process.pid)
if ctx && ctx.trace_id && ctx.span_id
@@ -442,13 +438,10 @@
def activate_priority_sampling!(base_sampler = nil)
@sampler = if base_sampler.is_a?(PrioritySampler)
base_sampler
else
- PrioritySampler.new(
- base_sampler: base_sampler,
- post_sampler: Datadog::RateByServiceSampler.new(1.0, env: proc { tags[:env] })
- )
+ PrioritySampler.new(base_sampler: base_sampler)
end
end
def deactivate_priority_sampling!(base_sampler = nil)
@sampler = base_sampler || Datadog::AllSampler.new if @sampler.is_a?(PrioritySampler)