Sha256: 59509fcc302bcff9e0e615678efa56d8f2f9c3ab6fe86e79f297cc08a1ef9f6c

Contents?: true

Size: 903 Bytes

Versions: 10

Compression:

Stored size: 903 Bytes

Contents

# Copyright (c) 2012 by Tracelytics, Inc.
# All rights reserved.

module Oboe
  # The following is done for compatability with older versions of oboe and
  # oboe_fu (0.2.x)
  if not defined?(Oboe::Config)
    Config = {
        :tracing_mode => "through",
        :reporter_host => "127.0.0.1",
        :sample_rate => 3e5
    }
  end

  class << Config 
    def always?
      self[:tracing_mode].to_s == "always"
    end
  
    def never?
      self[:tracing_mode].to_s == "never"
    end
  
    def tracing?
      Oboe::Context.isValid and not never?
    end
  
    def start?
      not Oboe::Context.isValid and always?
    end

    def sample?
      # Note that this the only point in the code that currently does and
      # should ever read the sample rate. When autopilot is released, modify
      # the line below and that line only.
      self[:sample_rate].to_i < rand(1e6)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
oboe-1.3.9.1 lib/oboe/config.rb
oboe-1.3.8 lib/oboe/config.rb
oboe-1.3.0 lib/oboe/config.rb
oboe-1.3.1 lib/oboe/config.rb
oboe-1.3.2 lib/oboe/config.rb
oboe-1.3.3 lib/oboe/config.rb
oboe-1.3.4 lib/oboe/config.rb
oboe-1.3.5 lib/oboe/config.rb
oboe-1.3.6 lib/oboe/config.rb
oboe-1.3.7 lib/oboe/config.rb