class Sentry::Profiler

def set_initial_sample_decision(transaction_sampled)

Returns:
  • (void) -
def set_initial_sample_decision(transaction_sampled)
  unless @profiling_enabled
    @sampled = false
    return
  end
  unless transaction_sampled
    @sampled = false
    log('Discarding profile because transaction not sampled')
    return
  end
  case @profiles_sample_rate
  when 0.0
    @sampled = false
    log('Discarding profile because sample_rate is 0')
    return
  when 1.0
    @sampled = true
    return
  else
    @sampled = Random.rand < @profiles_sample_rate
  end
  log('Discarding profile due to sampling decision') unless @sampled
end