statsig 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e52cea71e52cabc3730c8e9740d7208f1ba45378354a8ef1bd0639c1cfbf9a6
4
- data.tar.gz: a2e74a859c70adace695bff8040bcf23e2e981cb35bcfeb5fa143369ceccd90f
3
+ metadata.gz: 1591515ecdce353516857952fae0e460997315f7c764f680a30df065821d36c4
4
+ data.tar.gz: 4818db100a200ade728aa7b3db42008313b975ed951e37ff9d72f46fe269580d
5
5
  SHA512:
6
- metadata.gz: b472daa96f6a6b6cf43874555c4421d6374c387d3f14683b0d8e7959ffc5b4d2a04d9f72144854ae54e4bcdfd87187e8542ed7b0abd2ac97605fb7e585f7ac0b
7
- data.tar.gz: e1a9505ea5fc5fb27ea9f3a82056932538dc146bdeeaff08d3179bbfffac5cfa3abaf7838c986350b15d0bd1ed9f2392238beb1f5d139658b770659497dd3eb5
6
+ metadata.gz: fe639606633dce22ad66d8216149c2f3db9136c1c2a33799320671df9dc839e06554a91688bc0baf0a638bd29a0258822cc169cc5e01ce8630c5a108d8e883f9
7
+ data.tar.gz: 31912d0a1c2113ce74716987a666695cda53b5532ed154677135332fe17983b145c39d182cc193a510e857083f0290491dfea90df6efe5850935071b3f3dbb64
data/lib/config_result.rb CHANGED
@@ -20,6 +20,7 @@ module Statsig
20
20
  attr_accessor :include_local_overrides
21
21
  attr_accessor :forward_all_exposures
22
22
  attr_accessor :sampling_rate
23
+ attr_accessor :has_seen_analytical_gates
23
24
 
24
25
  def initialize(
25
26
  name:,
@@ -39,7 +40,8 @@ module Statsig
39
40
  config_version: nil,
40
41
  include_local_overrides: true,
41
42
  forward_all_exposures: false,
42
- sampling_rate: nil
43
+ sampling_rate: nil,
44
+ has_seen_analytical_gates: false
43
45
  )
44
46
  @name = name
45
47
  @gate_value = gate_value
@@ -60,6 +62,7 @@ module Statsig
60
62
  @include_local_overrides = include_local_overrides
61
63
  @forward_all_exposures = forward_all_exposures
62
64
  @sampling_rate = sampling_rate
65
+ @has_seen_analytical_gates = has_seen_analytical_gates
63
66
  end
64
67
 
65
68
  def self.from_user_persisted_values(config_name, user_persisted_values)
data/lib/evaluator.rb CHANGED
@@ -302,6 +302,7 @@ module Statsig
302
302
 
303
303
  def eval_spec(config_name, user, config, end_result, is_nested: false)
304
304
  config[:rules].each do |rule|
305
+ end_result.sampling_rate = rule[:samplingRate]
305
306
  eval_rule(user, rule, end_result)
306
307
 
307
308
  if end_result.gate_value
@@ -427,6 +428,9 @@ module Statsig
427
428
  return true
428
429
  when Const::CND_PASS_GATE, Const::CND_FAIL_GATE
429
430
  result = eval_nested_gate(target, user, end_result)
431
+ if end_result.sampling_rate == nil && !target.start_with?("segment")
432
+ end_result.has_seen_analytical_gates = true
433
+ end
430
434
  return type == Const::CND_PASS_GATE ? result : !result
431
435
  when Const::CND_MULTI_PASS_GATE, Const::CND_MULTI_FAIL_GATE
432
436
  return eval_nested_gates(target, type, user, end_result)
@@ -614,7 +618,9 @@ module Statsig
614
618
  is_multi_pass_gate_type = condition_type == Const::CND_MULTI_PASS_GATE
615
619
  gate_names.each { |gate_name|
616
620
  result = eval_nested_gate(gate_name, user, end_result)
617
-
621
+ if end_result.sampling_rate == nil && !target.start_with?("segment")
622
+ end_result.has_seen_analytical_gates = true
623
+ end
618
624
  if is_multi_pass_gate_type == result
619
625
  has_passing_gate = true
620
626
  break
data/lib/statsig.rb CHANGED
@@ -370,7 +370,7 @@ module Statsig
370
370
  def self.get_statsig_metadata
371
371
  {
372
372
  'sdkType' => 'ruby-server',
373
- 'sdkVersion' => '2.3.0',
373
+ 'sdkVersion' => '2.3.1',
374
374
  'languageVersion' => RUBY_VERSION
375
375
  }
376
376
  end
@@ -276,6 +276,7 @@ module Statsig
276
276
 
277
277
  return true, nil, nil if result.forward_all_exposures
278
278
  return true, nil, nil if result.rule_id.end_with?(":override", ":id_override")
279
+ return true, nil, nil if result.has_seen_analytical_gates
279
280
 
280
281
  sampling_set_key = "#{name}_#{result.rule_id}"
281
282
  unless @sampling_key_set.contains?(sampling_set_key)
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: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Statsig, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-25 00:00:00.000000000 Z
11
+ date: 2025-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler