statsig 1.19.1 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/statsig.rb +24 -12
  3. data/lib/statsig_options.rb +11 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 768ca65c5f2e54afdc7896eedc8ceb095b44f99ebb861f56ecb10d82c965c9db
4
- data.tar.gz: 9b644e6659565eb44d266fee5d37374f1feee076d789d57c32d744cab6530bb9
3
+ metadata.gz: 31a3f19ad19ba6b7ce4ebd18e2632ee04a85d3a2176b2c914e75fcd8f326f578
4
+ data.tar.gz: b3d6905b985889b60a0e713231d7bb5576cb9638972d331243bf93c881557130
5
5
  SHA512:
6
- metadata.gz: fca05aceecc4389eec081e98159bcaef3aa1ca91447c99770c62cad3e5e16f5ebf500edf257081b051462028c47cfee060fe41ab362db4468429faea88516872
7
- data.tar.gz: 64755e9303545ba9915e241460c4468a508dcad79057bc4475ba68d6e8edd3fa874e89f1d0709557121bffd037c11ab0d7d229c0da0fb61369a5b0f75e4ec6ee
6
+ metadata.gz: 4a15075766b794eeefdc187cd225edac10a35810a8066ffab521db2228466a5687007a58077a9c788b668b5ed25cddc0c125f5f74fbf4bdea0488318159e9c00
7
+ data.tar.gz: 74e4ded54a6dc0198ca99cca62d12517109957316a45b562c26df5eca6f154db9a2f1cb59f4a1c6575035a6863f5a7055ee7d4d7e38c6f8eeaa7930eb487cebd
data/lib/statsig.rb CHANGED
@@ -21,6 +21,8 @@ module Statsig
21
21
  return @shared_instance
22
22
  end
23
23
 
24
+ self.bind_sorbet_loggers(options)
25
+
24
26
  @shared_instance = StatsigDriver.new(secret_key, options, error_callback)
25
27
  end
26
28
 
@@ -225,7 +227,7 @@ module Statsig
225
227
  def self.get_statsig_metadata
226
228
  {
227
229
  'sdkType' => 'ruby-server',
228
- 'sdkVersion' => '1.19.1',
230
+ 'sdkVersion' => '1.20.0',
229
231
  }
230
232
  end
231
233
 
@@ -237,20 +239,30 @@ module Statsig
237
239
  end
238
240
  end
239
241
 
240
- T::Configuration.call_validation_error_handler = lambda do |signature, opts|
241
- puts "[Type Error] " + opts[:pretty_message]
242
- end
242
+ sig { params(options: T.any(StatsigOptions, NilClass)).void }
243
243
 
244
- T::Configuration.inline_type_error_handler = lambda do |error, opts|
245
- puts "[Type Error] " + error.message
246
- end
244
+ def self.bind_sorbet_loggers(options)
245
+ if options&.disable_sorbet_logging_handlers == true
246
+ return
247
+ end
247
248
 
248
- T::Configuration.sig_builder_error_handler = lambda do |error, location|
249
- puts "[Type Error] " + error.message
250
- end
249
+ T::Configuration.call_validation_error_handler = lambda do |signature, opts|
250
+ puts "[Type Error] " + opts[:pretty_message]
251
+ end
252
+
253
+ T::Configuration.inline_type_error_handler = lambda do |error, opts|
254
+ puts "[Type Error] " + error.message
255
+ end
256
+
257
+ T::Configuration.sig_builder_error_handler = lambda do |error, location|
258
+ puts "[Type Error] " + error.message
259
+ end
260
+
261
+ T::Configuration.sig_validation_error_handler = lambda do |error, opts|
262
+ puts "[Type Error] " + error.message
263
+ end
251
264
 
252
- T::Configuration.sig_validation_error_handler = lambda do |error, opts|
253
- puts "[Type Error] " + error.message
265
+ return
254
266
  end
255
267
 
256
268
  end
@@ -69,6 +69,12 @@ class StatsigOptions
69
69
  # default: false
70
70
  attr_accessor :disable_diagnostics_logging
71
71
 
72
+ sig { returns(T::Boolean) }
73
+ # Statsig utilizes Sorbet (https://sorbet.org) to ensure type safety of the SDK. This includes logging
74
+ # to console when errors are detected. You can disable this logging by setting this flag to true.
75
+ # default: false
76
+ attr_accessor :disable_sorbet_logging_handlers
77
+
72
78
  sig do
73
79
  params(
74
80
  environment: T.any(T::Hash[String, String], NilClass),
@@ -82,7 +88,8 @@ class StatsigOptions
82
88
  rules_updated_callback: T.any(Method, Proc, NilClass),
83
89
  data_store: T.any(Statsig::Interfaces::IDataStore, NilClass),
84
90
  idlist_threadpool_size: Integer,
85
- disable_diagnostics_logging: T::Boolean
91
+ disable_diagnostics_logging: T::Boolean,
92
+ disable_sorbet_logging_handlers: T::Boolean
86
93
  ).void
87
94
  end
88
95
 
@@ -98,7 +105,8 @@ class StatsigOptions
98
105
  rules_updated_callback: nil,
99
106
  data_store: nil,
100
107
  idlist_threadpool_size: 3,
101
- disable_diagnostics_logging: false)
108
+ disable_diagnostics_logging: false,
109
+ disable_sorbet_logging_handlers: false)
102
110
  @environment = environment.is_a?(Hash) ? environment : nil
103
111
  @api_url_base = api_url_base
104
112
  @rulesets_sync_interval = rulesets_sync_interval
@@ -111,5 +119,6 @@ class StatsigOptions
111
119
  @data_store = data_store
112
120
  @idlist_threadpool_size = idlist_threadpool_size
113
121
  @disable_diagnostics_logging = disable_diagnostics_logging
122
+ @disable_sorbet_logging_handlers = disable_sorbet_logging_handlers
114
123
  end
115
124
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statsig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.1
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Statsig, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-17 00:00:00.000000000 Z
11
+ date: 2023-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler