Skip to content

Commit d5ae2c9

Browse files
committed
update wasm for eval events, set flagMetadata for openfeature
1 parent fd37a0a commit d5ae2c9

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed
1.33 KB
Binary file not shown.

devcycle_python_sdk/local_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def variable(self, user: DevCycleUser, key: str, default_value: Any) -> Variable
135135
try:
136136
self.event_queue_manager.queue_aggregate_event(
137137
event=DevCycleEvent(
138-
type=EventType.AggVariableDefaulted, target=key, value=1
138+
type=EventType.AggVariableDefaulted, target=key, value=1, metaData={"evalReason": EvalReasons.DEFAULT}
139139
),
140140
bucketed_config=None,
141141
)

devcycle_python_sdk/open_feature_provider/provider.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,28 @@ def _resolve(
8080
reason=Reason.DEFAULT,
8181
)
8282
else:
83+
# TODO: once eval enabled from cloud bucketing, eval reason won't be null unless defaulted
84+
if variable.eval and variable.eval.reason:
85+
reason = variable.eval.reason
86+
elif variable.isDefaulted:
87+
reason = Reason.DEFAULT
88+
else:
89+
reason = Reason.TARGETING_MATCH
90+
91+
# Build flag metadata if eval details exist
92+
flag_metadata = {}
93+
if variable.eval:
94+
if variable.eval.details:
95+
flag_metadata["evalReasonDetails"] = variable.eval.details
96+
if variable.eval.target_id:
97+
flag_metadata["evalReasonTargetId"] = (
98+
variable.eval.target_id
99+
)
100+
83101
return FlagResolutionDetails(
84102
value=variable.value,
85-
reason=(
86-
Reason.DEFAULT
87-
if variable.isDefaulted
88-
else Reason.TARGETING_MATCH
89-
),
103+
reason=reason,
104+
flag_metadata=flag_metadata if flag_metadata else None,
90105
)
91106
except ValueError as e:
92107
# occurs if the key or default value is None

update_wasm_lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
BUCKETING_LIB_VERSION="1.40.2"
3+
BUCKETING_LIB_VERSION="1.41.0"
44

55
if [[ -n "$1" ]]; then
66
BUCKETING_LIB_VERSION="$1"

0 commit comments

Comments
 (0)