posthog-ruby 3.10.0 → 3.11.0
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 +4 -4
- data/lib/posthog/exception_capture.rb +3 -2
- data/lib/posthog/feature_flags.rb +24 -6
- data/lib/posthog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 334d837a2faf144afce1125f198607af7d4078b34329c394df8e4e221bf1ab89
|
|
4
|
+
data.tar.gz: 62c48db3c45c0a962294546c06b485ace4e4d6f40bd5178f6c393f61e4243344
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e23767920c9f2169e45dfae59515e15bb17df9d6c69d08caaea786b4ee3a84f2e47aac6ac0f677b9193862eaf571c6657f1975142b749d8766fb49fcbf4c2c4
|
|
7
|
+
data.tar.gz: 7e51f30ec5ff951e639ce97efba159fa63a419897b12b5ca6418149323fd7a2ae469bbca2ba13eb9fa02cf8071cf0e39453cd96282eaadf4bdf1331e4269ae6e
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Portions of this file are derived from getsentry/sentry-ruby
|
|
4
|
-
#
|
|
3
|
+
# Portions of this file are derived from getsentry/sentry-ruby
|
|
4
|
+
# Copyright (c) 2020 Sentry
|
|
5
|
+
# Licensed under the MIT License: https://github.com/getsentry/sentry-ruby/blob/master/LICENSE
|
|
5
6
|
# - sentry-ruby/lib/sentry/interfaces/single_exception.rb
|
|
6
7
|
# - sentry-ruby/lib/sentry/interfaces/stacktrace_builder.rb
|
|
7
8
|
# - sentry-ruby/lib/sentry/backtrace.rb
|
|
@@ -961,6 +961,7 @@ module PostHog
|
|
|
961
961
|
|
|
962
962
|
flag_conditions = flag_filters[:groups] || []
|
|
963
963
|
flag_aggregation = flag_filters[:aggregation_group_type_index]
|
|
964
|
+
early_exit = flag_filters[:early_exit] == true
|
|
964
965
|
is_inconclusive = false
|
|
965
966
|
result = nil
|
|
966
967
|
|
|
@@ -997,8 +998,9 @@ module PostHog
|
|
|
997
998
|
end
|
|
998
999
|
end
|
|
999
1000
|
|
|
1000
|
-
|
|
1001
|
-
|
|
1001
|
+
case condition_match_outcome(flag, effective_bucketing, condition, effective_properties, evaluation_cache,
|
|
1002
|
+
cohort_properties)
|
|
1003
|
+
when :match
|
|
1002
1004
|
variant_override = condition[:variant]
|
|
1003
1005
|
flag_multivariate = flag_filters[:multivariate] || {}
|
|
1004
1006
|
flag_variants = flag_multivariate[:variants] || []
|
|
@@ -1009,6 +1011,8 @@ module PostHog
|
|
|
1009
1011
|
end
|
|
1010
1012
|
result = variant || true
|
|
1011
1013
|
break
|
|
1014
|
+
when :out_of_rollout_bound
|
|
1015
|
+
break if early_exit
|
|
1012
1016
|
end
|
|
1013
1017
|
rescue RequiresServerEvaluation
|
|
1014
1018
|
# Static cohort or other missing server-side data - must fallback to API
|
|
@@ -1030,6 +1034,18 @@ module PostHog
|
|
|
1030
1034
|
end
|
|
1031
1035
|
|
|
1032
1036
|
def condition_match(flag, distinct_id, condition, properties, evaluation_cache, cohort_properties = {})
|
|
1037
|
+
condition_match_outcome(flag, distinct_id, condition, properties, evaluation_cache,
|
|
1038
|
+
cohort_properties) == :match
|
|
1039
|
+
end
|
|
1040
|
+
|
|
1041
|
+
# Evaluates a single condition group and returns a tri-state outcome:
|
|
1042
|
+
# :match - property filters matched AND the rollout included the user
|
|
1043
|
+
# :no_match - a property filter did NOT match
|
|
1044
|
+
# :out_of_rollout_bound - property filters matched (or there were none) but the
|
|
1045
|
+
# rollout percentage excluded the user
|
|
1046
|
+
# Distinguishing :no_match from :out_of_rollout_bound lets the caller implement the
|
|
1047
|
+
# early_exit behavior (mirrors the server-side Rust evaluation engine).
|
|
1048
|
+
def condition_match_outcome(flag, distinct_id, condition, properties, evaluation_cache, cohort_properties = {})
|
|
1033
1049
|
rollout_percentage = condition[:rollout_percentage]
|
|
1034
1050
|
|
|
1035
1051
|
unless (condition[:properties] || []).empty?
|
|
@@ -1040,15 +1056,17 @@ module PostHog
|
|
|
1040
1056
|
FeatureFlagsPoller.match_property(prop, properties, cohort_properties)
|
|
1041
1057
|
end
|
|
1042
1058
|
end
|
|
1043
|
-
return
|
|
1059
|
+
return :no_match
|
|
1044
1060
|
end
|
|
1045
1061
|
|
|
1046
|
-
return
|
|
1062
|
+
return :match if rollout_percentage.nil?
|
|
1047
1063
|
end
|
|
1048
1064
|
|
|
1049
|
-
|
|
1065
|
+
if !rollout_percentage.nil? && (_hash(flag[:key], distinct_id) > (rollout_percentage.to_f / 100))
|
|
1066
|
+
return :out_of_rollout_bound
|
|
1067
|
+
end
|
|
1050
1068
|
|
|
1051
|
-
|
|
1069
|
+
:match
|
|
1052
1070
|
end
|
|
1053
1071
|
|
|
1054
1072
|
# This function takes a distinct_id and a feature flag key and returns a float between 0 and 1.
|
data/lib/posthog/version.rb
CHANGED