Class: Itly::Plugin::Iteratively::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/itly/plugin/iteratively/options.rb

Overview

Options for the Iteratively plugin class

Constant Summary collapse

DEFAULT_URL =
'https://data.us-east-2.iterative.ly/t'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url: DEFAULT_URL, disabled: nil, flush_queue_size: 10, batch_size: 100, flush_interval_ms: 1_000, max_retries: 25, retry_delay_min: 10.0, retry_delay_max: 3600.0, omit_values: false, branch: nil, version: nil) ⇒ Options

Instantiate a new Options

Parameters:

  • url (String) (defaults to: DEFAULT_URL)

    (optional): specify the url to push events to. Default to data.us-east-2.iterative.ly/t

  • disabled: (TrueClass/FalseClass) (defaults to: nil)

    set to true to disable the Iteratively plugin. Default to true in production environment, to false otherwise

  • flush_queue_size (Integer) (defaults to: 10)

    (optional): Number of event in the buffer before a flush is triggered. Default: 10

  • batch_size (Integer) (defaults to: 100)

    (optional): Maximum number of events to send to the server at once. Default: 100

  • flush_interval_ms (Integer) (defaults to: 1_000)

    (optional): Delay in milliseconds between each automatic flush. Default: 1_000

  • max_retries (Integer) (defaults to: 25)

    (optional): Number of retries for pushing events to the server. Default: 25

  • retry_delay_min: (Float) (defaults to: 10.0)

    Minimum delay between retries in seconds. Default: 10.0

  • retry_delay_max: (Float) (defaults to: 3600.0)

    Maximum delay between retries in seconds. Default: 3600.0 (1 hour)

  • omit_values: (TrueClass/FalseClass) (defaults to: false)

    set to true to send empty data. Default to false

  • branch: (String) (defaults to: nil)

    Tracking plan branch name (e.g. feature/demo)

  • version: (String) (defaults to: nil)

    Tracking plan version number (e.g. 1.0.0)



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/itly/plugin/iteratively/options.rb', line 37

def initialize(
  url: DEFAULT_URL, disabled: nil, flush_queue_size: 10, batch_size: 100, flush_interval_ms: 1_000,
  max_retries: 25, retry_delay_min: 10.0, retry_delay_max: 3600.0, omit_values: false, branch: nil, version: nil
)
  super()
  @url = url
  @disabled = disabled
  @flush_queue_size = flush_queue_size
  @batch_size = batch_size
  @flush_interval_ms = flush_interval_ms
  @max_retries = max_retries
  @retry_delay_min = retry_delay_min
  @retry_delay_max = retry_delay_max
  @omit_values = omit_values
  @branch = branch
  @version = version
end

Instance Attribute Details

#batch_sizeObject (readonly)

Returns the value of attribute batch_size.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def batch_size
  @batch_size
end

#branchObject (readonly)

Returns the value of attribute branch.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def branch
  @branch
end

#disabledObject (readonly)

Returns the value of attribute disabled.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def disabled
  @disabled
end

#flush_interval_msObject (readonly)

Returns the value of attribute flush_interval_ms.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def flush_interval_ms
  @flush_interval_ms
end

#flush_queue_sizeObject (readonly)

Returns the value of attribute flush_queue_size.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def flush_queue_size
  @flush_queue_size
end

#max_retriesObject (readonly)

Returns the value of attribute max_retries.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def max_retries
  @max_retries
end

#omit_valuesObject (readonly)

Returns the value of attribute omit_values.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def omit_values
  @omit_values
end

#retry_delay_maxObject (readonly)

Returns the value of attribute retry_delay_max.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def retry_delay_max
  @retry_delay_max
end

#retry_delay_minObject (readonly)

Returns the value of attribute retry_delay_min.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def retry_delay_min
  @retry_delay_min
end

#urlObject (readonly)

Returns the value of attribute url.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def url
  @url
end

#versionObject (readonly)

Returns the value of attribute version.



14
15
16
# File 'lib/itly/plugin/iteratively/options.rb', line 14

def version
  @version
end

Instance Method Details

#with_overrides(url: nil, disabled: nil, flush_queue_size: nil, batch_size: nil, flush_interval_ms: nil, max_retries: nil, retry_delay_min: nil, retry_delay_max: nil, omit_values: nil, branch: nil, version: nil) ⇒ Object

Returns a copy of this Options with any provided arguments used as overrides



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/itly/plugin/iteratively/options.rb', line 58

def with_overrides(
  url: nil, disabled: nil, flush_queue_size: nil, batch_size: nil, flush_interval_ms: nil,
  max_retries: nil, retry_delay_min: nil, retry_delay_max: nil, omit_values: nil, branch: nil, version: nil
)
  Itly::Plugin::Iteratively::Options.new(
    url: url.nil? ? @url : url,
    disabled: disabled.nil? ? @disabled : disabled,
    flush_queue_size: flush_queue_size.nil? ? @flush_queue_size : flush_queue_size,
    batch_size: batch_size.nil? ? @batch_size : batch_size,
    flush_interval_ms: flush_interval_ms.nil? ? @flush_interval_ms : flush_interval_ms,
    max_retries: max_retries.nil? ? @max_retries : max_retries,
    retry_delay_min: retry_delay_min.nil? ? @retry_delay_min : retry_delay_min,
    retry_delay_max: retry_delay_max.nil? ? @retry_delay_max : retry_delay_max,
    omit_values: omit_values.nil? ? @omit_values : omit_values,
    branch: branch.nil? ? @branch : branch,
    version: version.nil? ? @version : version
  )
end