Class: StatsigOptions
- Inherits:
-
Object
- Object
- StatsigOptions
- Extended by:
- T::Sig
- Defined in:
- lib/statsig_options.rb
Overview
Configuration options for the Statsig SDK.
Instance Attribute Summary collapse
-
#api_url_base ⇒ Object
The base url used to make network calls to Statsig.
-
#bootstrap_values ⇒ Object
A string that represents all rules for all feature gates, dynamic configs and experiments.
-
#data_store ⇒ Object
A class that extends IDataStore.
-
#disable_diagnostics_logging ⇒ Object
Should diagnostics be logged.
-
#environment ⇒ Object
Hash you can use to set environment variables that apply to all of your users in the same session and will be used for targeting purposes.
-
#idlist_threadpool_size ⇒ Object
The number of threads allocated to syncing IDLists.
-
#idlists_sync_interval ⇒ Object
The interval (in seconds) to poll for changes to your id lists default: 60s.
-
#local_mode ⇒ Object
Restricts the SDK to not issue any network requests and only respond with default values (or local overrides) default: false.
-
#logging_interval_seconds ⇒ Object
How often to flush logs to Statsig default: 60s.
-
#logging_max_buffer_size ⇒ Object
The maximum number of events to batch before flushing logs to the server default: 1000.
-
#rules_updated_callback ⇒ Object
A callback function that will be called anytime the rulesets are updated.
-
#rulesets_sync_interval ⇒ Object
The interval (in seconds) to poll for changes to your Statsig configuration default: 10s.
Instance Method Summary collapse
-
#initialize(environment = nil, api_url_base = 'https://statsigapi.net/v1', rulesets_sync_interval: 10, idlists_sync_interval: 60, logging_interval_seconds: 60, logging_max_buffer_size: 1000, local_mode: false, bootstrap_values: nil, rules_updated_callback: nil, data_store: nil, idlist_threadpool_size: 3, disable_diagnostics_logging: false) ⇒ StatsigOptions
constructor
A new instance of StatsigOptions.
Constructor Details
#initialize(environment = nil, api_url_base = 'https://statsigapi.net/v1', rulesets_sync_interval: 10, idlists_sync_interval: 60, logging_interval_seconds: 60, logging_max_buffer_size: 1000, local_mode: false, bootstrap_values: nil, rules_updated_callback: nil, data_store: nil, idlist_threadpool_size: 3, disable_diagnostics_logging: false) ⇒ StatsigOptions
Returns a new instance of StatsigOptions.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/statsig_options.rb', line 89 def initialize( environment = nil, api_url_base = 'https://statsigapi.net/v1', rulesets_sync_interval: 10, idlists_sync_interval: 60, logging_interval_seconds: 60, logging_max_buffer_size: 1000, local_mode: false, bootstrap_values: nil, rules_updated_callback: nil, data_store: nil, idlist_threadpool_size: 3, disable_diagnostics_logging: false) @environment = environment.is_a?(Hash) ? environment : nil @api_url_base = api_url_base @rulesets_sync_interval = rulesets_sync_interval @idlists_sync_interval = idlists_sync_interval @logging_interval_seconds = logging_interval_seconds @logging_max_buffer_size = [logging_max_buffer_size, 1000].min @local_mode = local_mode @bootstrap_values = bootstrap_values @rules_updated_callback = rules_updated_callback @data_store = data_store @idlist_threadpool_size = idlist_threadpool_size @disable_diagnostics_logging = disable_diagnostics_logging end |
Instance Attribute Details
#api_url_base ⇒ Object
The base url used to make network calls to Statsig. default: statsigapi.net/v1
20 21 22 |
# File 'lib/statsig_options.rb', line 20 def api_url_base @api_url_base end |
#bootstrap_values ⇒ Object
A string that represents all rules for all feature gates, dynamic configs and experiments. It can be provided to bootstrap the Statsig server SDK at initialization in case your server runs into network issue or Statsig is down temporarily.
51 52 53 |
# File 'lib/statsig_options.rb', line 51 def bootstrap_values @bootstrap_values end |
#data_store ⇒ Object
A class that extends IDataStore. Can be used to provide values from a common data store (like Redis) to initialize the Statsig SDK.
60 61 62 |
# File 'lib/statsig_options.rb', line 60 def data_store @data_store end |
#disable_diagnostics_logging ⇒ Object
Should diagnostics be logged. These include performance metrics for initialize. default: false
70 71 72 |
# File 'lib/statsig_options.rb', line 70 def disable_diagnostics_logging @disable_diagnostics_logging end |
#environment ⇒ Object
Hash you can use to set environment variables that apply to all of your users in the same session and will be used for targeting purposes. eg. { “tier” => “development” }
15 16 17 |
# File 'lib/statsig_options.rb', line 15 def environment @environment end |
#idlist_threadpool_size ⇒ Object
The number of threads allocated to syncing IDLists. default: 3
65 66 67 |
# File 'lib/statsig_options.rb', line 65 def idlist_threadpool_size @idlist_threadpool_size end |
#idlists_sync_interval ⇒ Object
The interval (in seconds) to poll for changes to your id lists default: 60s
30 31 32 |
# File 'lib/statsig_options.rb', line 30 def idlists_sync_interval @idlists_sync_interval end |
#local_mode ⇒ Object
Restricts the SDK to not issue any network requests and only respond with default values (or local overrides) default: false
45 46 47 |
# File 'lib/statsig_options.rb', line 45 def local_mode @local_mode end |
#logging_interval_seconds ⇒ Object
How often to flush logs to Statsig default: 60s
35 36 37 |
# File 'lib/statsig_options.rb', line 35 def logging_interval_seconds @logging_interval_seconds end |
#logging_max_buffer_size ⇒ Object
The maximum number of events to batch before flushing logs to the server default: 1000
40 41 42 |
# File 'lib/statsig_options.rb', line 40 def logging_max_buffer_size @logging_max_buffer_size end |
#rules_updated_callback ⇒ Object
A callback function that will be called anytime the rulesets are updated.
55 56 57 |
# File 'lib/statsig_options.rb', line 55 def rules_updated_callback @rules_updated_callback end |
#rulesets_sync_interval ⇒ Object
The interval (in seconds) to poll for changes to your Statsig configuration default: 10s
25 26 27 |
# File 'lib/statsig_options.rb', line 25 def rulesets_sync_interval @rulesets_sync_interval end |