Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions splitio/api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from splitio.spec import SPEC_VERSION
from splitio.util.time import get_current_epoch_time_ms
from splitio.api.client import HttpClientException
from splitio.models.token import from_raw
from splitio.models.telemetry import HTTPExceptionsAndLatencies
from harness_commons.models.token import from_raw
from harness_commons.models.telemetry import HTTPExceptionsAndLatencies

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -39,7 +39,7 @@ def authenticate(self):
Perform authentication.

:return: Json representation of an authentication.
:rtype: splitio.models.token.Token
:rtype: harness_commons.models.token.Token
"""
try:
response = self._client.get(
Expand Down Expand Up @@ -86,7 +86,7 @@ async def authenticate(self):
Perform authentication.

:return: Json representation of an authentication.
:rtype: splitio.models.token.Token
:rtype: harness_commons.models.token.Token
"""
try:
response = await self._client.get(
Expand Down
4 changes: 2 additions & 2 deletions splitio/api/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from splitio.api import APIException, headers_from_metadata
from splitio.api.client import HttpClientException
from splitio.models.telemetry import HTTPExceptionsAndLatencies
from harness_commons.models.telemetry import HTTPExceptionsAndLatencies


_LOGGER = logging.getLogger(__name__)
Expand All @@ -18,7 +18,7 @@ def _build_bulk(events):
Build event bulk as expected by the API.

:param events: Events to be bundled.
:type events: list(splitio.models.events.Event)
:type events: list(harness_commons.models.events.Event)

:return: Formatted bulk.
:rtype: dict
Expand Down
4 changes: 2 additions & 2 deletions splitio/api/impressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from splitio.api import APIException, headers_from_metadata
from splitio.api.client import HttpClientException
from splitio.engine.impressions import ImpressionsMode
from splitio.models.telemetry import HTTPExceptionsAndLatencies
from harness_commons.models.telemetry import HTTPExceptionsAndLatencies


_LOGGER = logging.getLogger(__name__)
Expand All @@ -21,7 +21,7 @@ def _build_bulk(impressions):
Build an impression bulk formatted as the API expects it.

:param impressions: List of impressions to bundle.
:type impressions: list(splitio.models.impressions.Impression)
:type impressions: list(harness_commons.models.impressions.Impression)

:return: Dictionary of lists of impressions.
:rtype: list
Expand Down
2 changes: 1 addition & 1 deletion splitio/api/segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from splitio.api import APIException, headers_from_metadata
from splitio.api.commons import build_fetch
from splitio.api.client import HttpClientException
from splitio.models.telemetry import HTTPExceptionsAndLatencies
from harness_commons.models.telemetry import HTTPExceptionsAndLatencies


_LOGGER = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion splitio/api/splits.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from splitio.api import APIException, headers_from_metadata
from splitio.api.commons import build_fetch, FetchOptions
from splitio.api.client import HttpClientException
from splitio.models.telemetry import HTTPExceptionsAndLatencies
from harness_commons.models.telemetry import HTTPExceptionsAndLatencies
from splitio.util.time import utctime_ms
from splitio.spec import SPEC_VERSION
from splitio.sync import util
Expand Down
2 changes: 1 addition & 1 deletion splitio/api/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from splitio.api import APIException, headers_from_metadata
from splitio.api.client import HttpClientException
from splitio.models.telemetry import HTTPExceptionsAndLatencies
from harness_commons.models.telemetry import HTTPExceptionsAndLatencies

_LOGGER = logging.getLogger(__name__)

Expand Down
25 changes: 13 additions & 12 deletions splitio/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
from splitio.client import input_validator
from splitio.engine.evaluator import Evaluator, CONTROL, EvaluationDataFactory, AsyncEvaluationDataFactory
from splitio.engine.splitters import Splitter
from splitio.models.impressions import Impression, Label, ImpressionDecorated
from splitio.models.events import Event, EventWrapper, SdkEvent
from splitio.models.telemetry import get_latency_bucket_index, MethodExceptionsAndLatencies
from harness_commons.models.impressions import Impression, ImpressionDecorated
from splitio.models.label import Label
from harness_commons.models.events import Event, EventWrapper, SdkEvent
from harness_commons.models.telemetry import get_latency_bucket_index, MethodExceptionsAndLatencies
from splitio.optional.loaders import asyncio
from splitio.util.time import get_current_epoch_time_ms, utctime_ms

Expand Down Expand Up @@ -174,7 +175,7 @@ def _validate_track(self, key, traffic_type, event_type, value=None, properties=
:type properties: dict

:return: validation, event created and its properties size.
:rtype: tuple(bool, splitio.models.events.Event, int)
:rtype: tuple(bool, harness_commons.models.events.Event, int)
"""
if self.destroyed:
_LOGGER.error("Client has already been destroyed - no calls possible")
Expand Down Expand Up @@ -338,7 +339,7 @@ def _get_treatment(self, method, key, feature, attributes=None, evaluation_optio
:param attributes: An optional dictionary of attributes
:type attributes: dict
:param method: The method calling this function
:type method: splitio.models.telemetry.MethodExceptionsAndLatencies
:type method: harness_commons.models.telemetry.MethodExceptionsAndLatencies
:param evaluation_options: An optional dictionary of options
:type evaluation_options: dict
:return: The treatment and config for the key and feature flag
Expand Down Expand Up @@ -508,7 +509,7 @@ def _get_treatments_by_flag_sets(self, key, flag_sets, method, attributes=None,
:param flag_sets: list of flag sets
:type flag_sets: list
:param method: Treatment by flag set method flavor
:type method: splitio.models.telemetry.MethodExceptionsAndLatencies
:type method: harness_commons.models.telemetry.MethodExceptionsAndLatencies
:param attributes: An optional dictionary of attributes
:type attributes: dict
:param evaluation_options: An optional dictionary of options
Expand Down Expand Up @@ -637,7 +638,7 @@ def _get_treatments(self, key, features, method, attributes=None, evaluation_opt
:param feature_flag_names: Array of feature flag names for which to get the treatments
:type feature_flag_names: list(str)
:param method: The method calling this function
:type method: splitio.models.telemetry.MethodExceptionsAndLatencies
:type method: harness_commons.models.telemetry.MethodExceptionsAndLatencies
:param attributes: An optional dictionary of attributes
:type attributes: dict
:param evaluation_options: An optional dictionary of options
Expand Down Expand Up @@ -688,7 +689,7 @@ def _record_stats(self, impressions_decorated, start, operation):
Record impressions.

:param impressions_decorated: Generated impressions
:type impressions_decorated: list[tuple[splitio.models.impression.ImpressionDecorated, dict]]
:type impressions_decorated: list[tuple[harness_commons.models.impression.ImpressionDecorated, dict]]

:param start: timestamp when get_treatment or get_treatments was called
:type start: int
Expand Down Expand Up @@ -845,7 +846,7 @@ async def _get_treatment(self, method, key, feature, attributes=None, evaluation
:param attributes: An optional dictionary of attributes
:type attributes: dict
:param method: The method calling this function
:type method: splitio.models.telemetry.MethodExceptionsAndLatencies
:type method: harness_commons.models.telemetry.MethodExceptionsAndLatencies
:param evaluation_options: An optional dictionary of options
:type evaluation_options: dict
:return: The treatment and config for the key and feature flag
Expand Down Expand Up @@ -1013,7 +1014,7 @@ async def _get_treatments_by_flag_sets(self, key, flag_sets, method, attributes=
:param flag_sets: list of flag sets
:type flag_sets: list
:param method: Treatment by flag set method flavor
:type method: splitio.models.telemetry.MethodExceptionsAndLatencies
:type method: harness_commons.models.telemetry.MethodExceptionsAndLatencies
:param attributes: An optional dictionary of attributes
:type attributes: dict
:param evaluation_options: An optional dictionary of options
Expand Down Expand Up @@ -1057,7 +1058,7 @@ async def _get_treatments(self, key, features, method, attributes=None, evaluati
:param feature_flag_names: Array of feature flag names for which to get the treatments
:type feature_flag_names: list(str)
:param method: The method calling this function
:type method: splitio.models.telemetry.MethodExceptionsAndLatencies
:type method: harness_commons.models.telemetry.MethodExceptionsAndLatencies
:param attributes: An optional dictionary of attributes
:type attributes: dict
:param evaluation_options: An optional dictionary of options
Expand Down Expand Up @@ -1107,7 +1108,7 @@ async def _record_stats(self, impressions_decorated, start, operation):
Record impressions for async calls

:param impressions_decorated: Generated impressions decorated
:type impressions_decorated: list[tuple[splitio.models.impression.Impression, dict]]
:type impressions_decorated: list[tuple[harness_commons.models.impression.Impression, dict]]

:param start: timestamp when get_treatment or get_treatments was called
:type start: int
Expand Down
2 changes: 1 addition & 1 deletion splitio/client/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from splitio.engine.impressions import ImpressionsMode
from splitio.client.input_validator import validate_flag_sets, validate_fallback_treatment, validate_regex_name
from splitio.models.fallback_config import FallbackTreatmentsConfiguration
from harness_commons.models.fallback_config import FallbackTreatmentsConfiguration

_LOGGER = logging.getLogger(__name__)
DEFAULT_DATA_SAMPLING = 1
Expand Down
6 changes: 3 additions & 3 deletions splitio/client/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
from splitio.events.events_manager_config import EventsManagerConfig
from splitio.events.events_task import EventsTask, EventsTaskAsync
from splitio.events.events_delivery import EventsDelivery
from splitio.models.fallback_config import FallbackTreatmentCalculator
from splitio.models.notification import SdkInternalEventNotification
from splitio.models.events import SdkInternalEvent
from harness_commons.models.fallback_config import FallbackTreatmentCalculator
from harness_commons.models.notification import SdkInternalEventNotification
from harness_commons.models.events import SdkInternalEvent

# Storage
from splitio.storage.inmemmory import InMemorySplitStorage, InMemorySegmentStorage, \
Expand Down
2 changes: 1 addition & 1 deletion splitio/client/input_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from splitio.client.key import Key
from splitio.client import client
from splitio.engine.evaluator import CONTROL
from splitio.models.fallback_treatment import FallbackTreatment
from harness_commons.models.fallback_treatment import FallbackTreatment


_LOGGER = logging.getLogger(__name__)
Expand Down
16 changes: 8 additions & 8 deletions splitio/engine/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import logging
from collections import namedtuple

from splitio.models.impressions import Label
from splitio.models.grammar.condition import ConditionType
from splitio.models.grammar.matchers.misc import DependencyMatcher
from splitio.models.grammar.matchers.keys import UserDefinedSegmentMatcher
from splitio.models.grammar.matchers import RuleBasedSegmentMatcher
from splitio.models.grammar.matchers.prerequisites import PrerequisitesMatcher
from splitio.models.rule_based_segments import SegmentType
from splitio.models.label import Label
from harness_commons.models.grammar.condition import ConditionType
from harness_commons.models.grammar.matchers.misc import DependencyMatcher
from harness_commons.models.grammar.matchers.keys import UserDefinedSegmentMatcher
from harness_commons.models.grammar.matchers import RuleBasedSegmentMatcher
from harness_commons.models.grammar.matchers.prerequisites import PrerequisitesMatcher
from harness_commons.models.rule_based_segments import SegmentType
from splitio.optional.loaders import asyncio

CONTROL = 'control'
Expand Down Expand Up @@ -252,4 +252,4 @@ def update_objects(fetched, fetched_rbs, splits, rb_segments):
return features, rbsegments, splits, rb_segments

def get_prerequisites(feature):
return [prerequisite.feature_flag_name for prerequisite in feature.prerequisites]
return [prerequisite.definition_name for prerequisite in feature.prerequisites]
4 changes: 2 additions & 2 deletions splitio/engine/impressions/impressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def process_impressions(self, impressions_decorated):
Impressions are analyzed to see if they've been seen before and counted.

:param impressions_decorated: List of impression objects with attributes
:type impressions_decorated: list[tuple[splitio.models.impression.ImpressionDecorated, dict]]
:type impressions_decorated: list[tuple[harness_commons.models.impression.ImpressionDecorated, dict]]

:return: processed and deduped impressions.
:rtype: tuple(list[tuple[splitio.models.impression.Impression, dict]], list(int))
:rtype: tuple(list[tuple[harness_commons.models.impression.Impression, dict]], list(int))
"""
for_listener_all = []
for_log_all = []
Expand Down
16 changes: 8 additions & 8 deletions splitio/engine/impressions/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from collections import defaultdict, namedtuple

from splitio.util.time import utctime_ms
from splitio.models.impressions import Impression
from harness_commons.models.impressions import Impression
from splitio.engine.hashfns import murmur_128
from splitio.engine.cache.lru import SimpleLruCache
from splitio.optional.loaders import asyncio
Expand All @@ -28,10 +28,10 @@ def truncate_impressions_time(imps, counter = None):
Impressions are truncated based on time

:param impressions: List of impression objects with attributes
:type impressions: list[tuple[splitio.models.impression.Impression, dict]]
:type impressions: list[tuple[harness_commons.models.impression.Impression, dict]]

:returns: truncated list of impressions
:rtype: list[splitio.models.impression.Impression]
:rtype: list[harness_commons.models.impression.Impression]
"""
this_hour = truncate_time(utctime_ms())
return [imp for imp, _ in imps] if counter is None \
Expand Down Expand Up @@ -61,7 +61,7 @@ def _stringify(self, impression):
Stringify an impression.

:param impression: Impression to stringify using _PATTERN
:type impression: splitio.models.impressions.Impression
:type impression: harness_commons.models.impressions.Impression

:returns: a string representation of the impression
:rtype: str
Expand All @@ -77,7 +77,7 @@ def process(self, impression):
Hash an impression.

:param impression: Impression to hash.
:type impression: splitio.models.impressions.Impression
:type impression: harness_commons.models.impressions.Impression

:returns: a hash of the supplied impression's relevant fields.
:rtype: int
Expand All @@ -98,10 +98,10 @@ def test_and_set(self, impression):
Examine an impression to determine and set it's previous time accordingly.

:param impression: Impression to track
:type impression: splitio.models.impressions.Impression
:type impression: harness_commons.models.impressions.Impression

:returns: Impression with populated previous time
:rtype: splitio.models.impressions.Impression
:rtype: harness_commons.models.impressions.Impression
"""
previous_time = self._cache.test_and_set(self._hasher.process(impression), impression.time)
return Impression(impression.matching_key,
Expand Down Expand Up @@ -130,7 +130,7 @@ def track(self, impressions, inc=1):
Register N new impressions for a feature in a specific timeframe.

:param impressions: generated impressions
:type impressions: list[splitio.models.impressions.Impression]
:type impressions: list[harness_commons.models.impressions.Impression]

:param inc: amount to increment (defaults to 1)
:type inc: int
Expand Down
12 changes: 6 additions & 6 deletions splitio/engine/impressions/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def process_impressions(self, impressions):
Impressions are analyzed to see if they've been seen before.

:param impressions: List of impression objects with attributes
:type impressions: list[tuple[splitio.models.impression.Impression, dict]]
:type impressions: list[tuple[harness_commons.models.impression.Impression, dict]]

:returns: Tuple of to be stored, observed and counted impressions, and unique keys tuple
:rtype: list[tuple[splitio.models.impression.Impression, dict]], list[], list[], list[]
:rtype: list[tuple[harness_commons.models.impression.Impression, dict]], list[], list[], list[]
"""
imps = []
for imp, attrs in impressions:
Expand All @@ -59,10 +59,10 @@ def process_impressions(self, impressions):
Unique keys tracking are updated.

:param impressions: List of impression objects with attributes
:type impressions: list[tuple[splitio.models.impression.Impression, dict]]
:type impressions: list[tuple[harness_commons.models.impression.Impression, dict]]

:returns: Tuple of to be stored, observed and counted impressions, and unique keys tuple
:rtype: list[[], dict]], list[splitio.models.impression.Impression], list[splitio.models.impression.Impression], list[(str, str)]
:rtype: list[[], dict]], list[harness_commons.models.impression.Impression], list[harness_commons.models.impression.Impression], list[(str, str)]
"""
counter_imps = [imp for imp, _ in impressions]
unique_keys_tracker = []
Expand All @@ -87,10 +87,10 @@ def process_impressions(self, impressions):
Impressions are analyzed to see if they've been seen before and counted.

:param impressions: List of impression objects with attributes
:type impressions: list[tuple[splitio.models.impression.Impression, dict]]
:type impressions: list[tuple[harness_commons.models.impression.Impression, dict]]

:returns: Tuple of to be stored, observed and counted impressions, and unique keys tuple
:rtype: list[tuple[splitio.models.impression.Impression, dict]], list[splitio.models.impression.Impression], list[splitio.models.impression.Impression], list[]
:rtype: list[tuple[harness_commons.models.impression.Impression, dict]], list[harness_commons.models.impression.Impression], list[harness_commons.models.impression.Impression], list[]
"""
imps = []
for imp, attrs in impressions:
Expand Down
2 changes: 1 addition & 1 deletion splitio/engine/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging
_LOGGER = logging.getLogger(__name__)

from splitio.models.telemetry import CounterConstants, UpdateFromSSE
from harness_commons.models.telemetry import CounterConstants, UpdateFromSSE

class TelemetryStorageProducerBase(object):
"""Telemetry storage producer base class."""
Expand Down
2 changes: 1 addition & 1 deletion splitio/events/events_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from splitio.optional.loaders import asyncio

from splitio.events import EventsManagerInterface
from splitio.models.events import SdkEvent
from harness_commons.models.events import SdkEvent

_LOGGER = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion splitio/events/events_manager_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Events Manager Configuration."""
from splitio.models.events import SdkEvent, SdkInternalEvent
from harness_commons.models.events import SdkEvent, SdkInternalEvent

class EventsManagerConfig(object):
"""Events Manager Configurations class."""
Expand Down
6 changes: 0 additions & 6 deletions splitio/models/__init__.py

This file was deleted.

Loading