lib/ddtrace/tracer.rb in ddtrace-0.29.0 vs lib/ddtrace/tracer.rb in ddtrace-0.29.1
- old
+ new
@@ -118,10 +118,13 @@
@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:
#
@@ -439,10 +442,13 @@
def activate_priority_sampling!(base_sampler = nil)
@sampler = if base_sampler.is_a?(PrioritySampler)
base_sampler
else
- PrioritySampler.new(base_sampler: base_sampler)
+ PrioritySampler.new(
+ base_sampler: base_sampler,
+ post_sampler: Datadog::RateByServiceSampler.new(1.0, env: proc { tags[:env] })
+ )
end
end
def deactivate_priority_sampling!(base_sampler = nil)
@sampler = base_sampler || Datadog::AllSampler.new if @sampler.is_a?(PrioritySampler)