diff --git a/contract-tests/service.py b/contract-tests/service.py index ffa6d3e2..cab1d489 100644 --- a/contract-tests/service.py +++ b/contract-tests/service.py @@ -73,7 +73,7 @@ def status(): 'optional-event-gzip', 'event-sampling', 'polling-gzip', - 'inline-context', + 'inline-context-all', 'anonymous-redaction', 'evaluation-hooks', 'omit-anonymous-contexts', diff --git a/ldclient/impl/events/event_processor.py b/ldclient/impl/events/event_processor.py index dbcc3fc2..c9489adb 100644 --- a/ldclient/impl/events/event_processor.py +++ b/ldclient/impl/events/event_processor.py @@ -82,7 +82,13 @@ def make_output_event(self, e: Any): elif isinstance(e, IndexEvent): return {'kind': 'index', 'creationDate': e.timestamp, 'context': self._process_context(e.context, False)} elif isinstance(e, EventInputCustom): - out = {'kind': 'custom', 'creationDate': e.timestamp, 'key': e.key, 'contextKeys': self._context_keys(e.context)} + out = { + 'kind': 'custom', + 'creationDate': e.timestamp, + 'key': e.key, + 'context': self._process_context(e.context, True) + } + if e.data is not None: out['data'] = e.data if e.metric_value is not None: @@ -93,7 +99,7 @@ def make_output_event(self, e: Any): 'kind': 'migration_op', 'creationDate': e.timestamp, 'operation': e.operation.value, - 'contextKeys': self._context_keys(e.context), + 'context': self._process_context(e.context, True), 'evaluation': {'key': e.key, 'value': e.detail.value}, } diff --git a/ldclient/testing/impl/events/test_event_processor.py b/ldclient/testing/impl/events/test_event_processor.py index 455ad69d..b1279a76 100644 --- a/ldclient/testing/impl/events/test_event_processor.py +++ b/ldclient/testing/impl/events/test_event_processor.py @@ -798,7 +798,7 @@ def check_feature_event(data, source: EventInputEvaluation, context_json: Option def check_migration_op_event(data, source: MigrationOpEvent): assert data['kind'] == 'migration_op' assert data['creationDate'] == source.timestamp - assert data['contextKeys'] == make_context_keys(source.context) + assert data['context'] == source.context.to_dict() assert data['evaluation']['key'] == source.key assert data['evaluation']['value'] == source.detail.value @@ -861,7 +861,7 @@ def check_custom_event(data, source: EventInputCustom): assert data['creationDate'] == source.timestamp assert data['key'] == source.key assert data['data'] == source.data - assert data['contextKeys'] == make_context_keys(source.context) + assert data['context'] == source.context.to_dict() assert data.get('metricValue') == source.metric_value