Class: Datadog::Sampling::SimpleRule
- Defined in:
 - lib/ddtrace/sampling/rule.rb
 
Overview
A \Rule that matches a span based on operation name and/or service name and applies a fixed sampling to matching spans.
Instance Attribute Summary
Attributes inherited from Rule
Instance Method Summary collapse
- 
  
    
      #initialize(name: SimpleMatcher::MATCH_ALL, service: SimpleMatcher::MATCH_ALL, sample_rate: 1.0)  ⇒ SimpleRule 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of SimpleRule.
 
Methods inherited from Rule
Constructor Details
#initialize(name: SimpleMatcher::MATCH_ALL, service: SimpleMatcher::MATCH_ALL, sample_rate: 1.0) ⇒ SimpleRule
Returns a new instance of SimpleRule.
      46 47 48 49 50 51 52 53 54 55 56 57 58 59  | 
    
      # File 'lib/ddtrace/sampling/rule.rb', line 46 def initialize(name: SimpleMatcher::MATCH_ALL, service: SimpleMatcher::MATCH_ALL, sample_rate: 1.0) # We want to allow 0.0 to drop all traces, but \RateSampler # considers 0.0 an invalid rate and falls back to 100% sampling. # # We address that here by not setting the rate in the constructor, # but using the setter method. # # We don't want to make this change directly to \RateSampler # because it breaks its current contract to existing users. sampler = Datadog::RateSampler.new sampler.sample_rate = sample_rate super(SimpleMatcher.new(name: name, service: service), sampler) end  |