Skip to content

Commit 3feea2e

Browse files
committed
FEA: Add more originator and parent information to handled events
BREAKING CHANGE: Redeploy your cloud function and BigQuery table and use with events from `octue>=0.56.0`.
1 parent 8e6ba8d commit 3feea2e

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

functions/event_handler/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,18 @@ def store_pub_sub_event_in_bigquery(cloud_event):
3838
"uuid": attributes.pop("uuid"),
3939
"kind": event.pop("kind"),
4040
"event": event,
41+
# Any attributes not popped below will end up in the `other_attributes` column.
4142
"other_attributes": attributes,
4243
# Pull out some attributes into columns for querying.
44+
"parent": attributes.pop("parent"),
4345
"originator": attributes.pop("originator"),
4446
"sender": attributes.pop("sender"),
4547
"sender_type": attributes.pop("sender_type"),
4648
"sender_sdk_version": attributes.pop("sender_sdk_version"),
4749
"recipient": attributes.pop("recipient"),
4850
"question_uuid": attributes.pop("question_uuid"),
51+
"parent_question_uuid": attributes.pop("parent_question_uuid"),
52+
"originator_question_uuid": attributes.pop("originator_question_uuid"),
4953
"order": attributes.pop("order"),
5054
# Backend-specific metadata.
5155
"backend": BACKEND,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name="twined-gcp",
6-
version="0.5.1",
6+
version="0.6.0",
77
author="Marcus Lugg <marcus@octue.com>",
88
install_requires=[
99
"setuptools",

tests/test_event_handler.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ def test_store_pub_sub_event_in_bigquery(self):
2020
"attributes": {
2121
"datetime": "2024-04-11T09:26:39.144818",
2222
"uuid": "c8bda9fa-f072-4330-92b1-96920d06b28d",
23-
"originator": "octue/test-service:5.6.3",
23+
"parent": "octue/parent-test-service:5.6.3",
24+
"originator": "octue/ancestor-test-service:5.6.3",
2425
"sender": "octue/test-service:5.6.3",
2526
"sender_type": "PARENT",
2627
"sender_sdk_version": "1.0.3",
2728
"recipient": "octue/another-service:1.0.0",
2829
"question_uuid": "ca534cdd-24cb-4ed2-af57-e36757192acb",
30+
"parent_question_uuid": "1d897229-155d-498d-b6ae-21960fab3754",
31+
"originator_question_uuid": "fb6cf9a3-84fb-45ce-a4da-0d2257bec319",
2932
"order": "0",
3033
"forward_logs": True,
3134
},
@@ -49,12 +52,15 @@ def test_store_pub_sub_event_in_bigquery(self):
4952
"other_attributes": {
5053
"forward_logs": True,
5154
},
52-
"originator": "octue/test-service:5.6.3",
55+
"parent": "octue/parent-test-service:5.6.3",
56+
"originator": "octue/ancestor-test-service:5.6.3",
5357
"sender": "octue/test-service:5.6.3",
5458
"sender_type": "PARENT",
5559
"sender_sdk_version": "1.0.3",
5660
"recipient": "octue/another-service:1.0.0",
5761
"question_uuid": "ca534cdd-24cb-4ed2-af57-e36757192acb",
62+
"parent_question_uuid": "1d897229-155d-498d-b6ae-21960fab3754",
63+
"originator_question_uuid": "fb6cf9a3-84fb-45ce-a4da-0d2257bec319",
5864
"order": "0",
5965
"backend": "GoogleCloudPubSub",
6066
"backend_metadata": {"message_id": "1234", "ordering_key": None},

0 commit comments

Comments
 (0)