Skip to content
Merged
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
2 changes: 1 addition & 1 deletion contract-tests/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 8 additions & 2 deletions ldclient/impl/events/event_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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},
}

Expand Down
4 changes: 2 additions & 2 deletions ldclient/testing/impl/events/test_event_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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


Expand Down