Skip to content

Commit 8f3ec46

Browse files
committed
fixed ld config tracker param bug and linting
1 parent 90b0cee commit 8f3ec46

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

ldai/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def config(
186186
tracker = LDAIConfigTracker(
187187
self._client,
188188
variation.get('_ldMeta', {}).get('variationKey', ''),
189-
variation.get('_ldMeta', {}).get('version', 1),
190189
key,
190+
int(variation.get('_ldMeta', {}).get('version', 1)),
191191
context,
192192
)
193193

ldai/tracker.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,21 @@ class LDAIConfigTracker:
6969
"""
7070

7171
def __init__(
72-
self, ld_client: LDClient, variation_key: str, config_key: str, variation_version: int, context: Context
72+
self, ld_client: LDClient, variation_key: str, config_key: str, version: int, context: Context
7373
):
7474
"""
7575
Initialize an AI configuration tracker.
7676
7777
:param ld_client: LaunchDarkly client instance.
7878
:param variation_key: Variation key for tracking.
7979
:param config_key: Configuration key for tracking.
80+
:param version: Version of the variation.
8081
:param context: Context for evaluation.
8182
"""
8283
self._ld_client = ld_client
8384
self._variation_key = variation_key
8485
self._config_key = config_key
85-
self._variation_version = variation_version
86+
self._version = version
8687
self._context = context
8788
self._summary = LDAIMetricSummary()
8889

@@ -95,7 +96,7 @@ def __get_track_data(self):
9596
return {
9697
'variationKey': self._variation_key,
9798
'configKey': self._config_key,
98-
'version': self._variation_version,
99+
'version': self._version,
99100
}
100101

101102
def track_duration(self, duration: int) -> None:

0 commit comments

Comments
 (0)