Class: Contrast::Agent::Reporting::Settings::Sampling

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/agent/reporting/settings/sampling.rb

Overview

Sampling controls for the Assess Features provided by TeamServer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hsh) ⇒ Sampling

Returns a new instance of Sampling.



25
26
27
28
29
30
31
32
# File 'lib/contrast/agent/reporting/settings/sampling.rb', line 25

def initialize hsh
  @baseline = hsh[:baseline]
  # NG endpoints vs non-ng
  @enabled = hsh[:enabled] || hsh[:enable]
  @request_frequency = hsh[:frequency] || hsh[:request_frequency]
  @response_frequency = hsh[:responseFrequency] || hsh[:response_frequency]
  @window_ms = hsh[:window] || hsh[:window_ms]
end

Instance Attribute Details

#baselineInteger (readonly)

Returns The number of baseline requests to take before switching to sampling for the window.

Returns:

  • (Integer)

    The number of baseline requests to take before switching to sampling for the window.



13
14
15
# File 'lib/contrast/agent/reporting/settings/sampling.rb', line 13

def baseline
  @baseline
end

#enabledBoolean (readonly)

Returns If the sampling feature should be used or not.

Returns:

  • (Boolean)

    If the sampling feature should be used or not.



15
16
17
# File 'lib/contrast/agent/reporting/settings/sampling.rb', line 15

def enabled
  @enabled
end

#request_frequencyInteger (readonly)

Returns The number of requests to skip before observing during the sampling window after the baseline.

Returns:

  • (Integer)

    The number of requests to skip before observing during the sampling window after the baseline.



18
19
20
# File 'lib/contrast/agent/reporting/settings/sampling.rb', line 18

def request_frequency
  @request_frequency
end

#response_frequencyInteger (readonly)

Returns The number of responses to skip before observing during the sampling window after the baseline.

Returns:

  • (Integer)

    The number of responses to skip before observing during the sampling window after the baseline.



21
22
23
# File 'lib/contrast/agent/reporting/settings/sampling.rb', line 21

def response_frequency
  @response_frequency
end

#window_msInteger (readonly)

Returns The length of time for which the sample period is valid, in ms.

Returns:

  • (Integer)

    The length of time for which the sample period is valid, in ms.



23
24
25
# File 'lib/contrast/agent/reporting/settings/sampling.rb', line 23

def window_ms
  @window_ms
end

Instance Method Details

#to_controlled_hashObject



34
35
36
37
38
39
40
41
42
# File 'lib/contrast/agent/reporting/settings/sampling.rb', line 34

def to_controlled_hash
  {
      baseline: baseline,
      enabled: enabled,
      frequency: request_frequency,
      responseFrequency: response_frequency,
      window: window_ms
  }
end