Class: AppProfiler::Sampler::Config
- Inherits:
-
Object
- Object
- AppProfiler::Sampler::Config
- Defined in:
- lib/app_profiler/sampler/config.rb
Constant Summary collapse
- SAMPLE_RATE =
0.1%
0.001
- TARGETS =
["/"]
- BACKEND_PROBABILITES =
{ stackprof: 1.0, vernier: 0.0 }
Instance Attribute Summary collapse
-
#backends_probability ⇒ Object
readonly
Returns the value of attribute backends_probability.
-
#cpu_interval ⇒ Object
readonly
Returns the value of attribute cpu_interval.
-
#sample_rate ⇒ Object
readonly
Returns the value of attribute sample_rate.
-
#targets ⇒ Object
readonly
Returns the value of attribute targets.
Instance Method Summary collapse
- #get_backend_config(backend_name) ⇒ Object
-
#initialize(sample_rate: SAMPLE_RATE, targets: TARGETS, backends_probability: BACKEND_PROBABILITES, backends_config: { stackprof: StackprofConfig.new, }, paths: nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(sample_rate: SAMPLE_RATE, targets: TARGETS, backends_probability: BACKEND_PROBABILITES, backends_config: { stackprof: StackprofConfig.new, }, paths: nil) ⇒ Config
Returns a new instance of Config.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/app_profiler/sampler/config.rb', line 15 def initialize(sample_rate: SAMPLE_RATE, targets: TARGETS, backends_probability: BACKEND_PROBABILITES, backends_config: { stackprof: StackprofConfig.new, }, paths: nil) if sample_rate < 0.0 || sample_rate > 1.0 raise ArgumentError, "sample_rate must be between 0 and 1" end raise ArgumentError, "mode probabilities must sum to 1" unless backends_probability.values.sum == 1.0 ActiveSupport::Deprecation.new.warn("passing paths is deprecated, use targets instead") if paths @sample_rate = sample_rate @targets = paths || targets @backends_config = backends_config @backends_probability = backends_probability end |
Instance Attribute Details
#backends_probability ⇒ Object (readonly)
Returns the value of attribute backends_probability.
8 9 10 |
# File 'lib/app_profiler/sampler/config.rb', line 8 def backends_probability @backends_probability end |
#cpu_interval ⇒ Object (readonly)
Returns the value of attribute cpu_interval.
8 9 10 |
# File 'lib/app_profiler/sampler/config.rb', line 8 def cpu_interval @cpu_interval end |
#sample_rate ⇒ Object (readonly)
Returns the value of attribute sample_rate.
8 9 10 |
# File 'lib/app_profiler/sampler/config.rb', line 8 def sample_rate @sample_rate end |
#targets ⇒ Object (readonly)
Returns the value of attribute targets.
8 9 10 |
# File 'lib/app_profiler/sampler/config.rb', line 8 def targets @targets end |
Instance Method Details
#get_backend_config(backend_name) ⇒ Object
37 38 39 |
# File 'lib/app_profiler/sampler/config.rb', line 37 def get_backend_config(backend_name) @backends_config[backend_name] end |