Skip to content

Commit 0686e28

Browse files
committed
Remove dcid extract from message and inject to span logic. Will be added to python-zocalo
1 parent 8b2a2f1 commit 0686e28

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

src/workflows/recipe/__init__.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def unwrap_recipe(header, message):
7272
rw = RecipeWrapper(message=message, transport=transport_layer)
7373
logger.debug("RecipeWrapper created: %s", rw)
7474

75-
# Extract and set DCID and recipe_id on the current span
75+
# Extract recipe_id on the current span
7676
span = trace.get_current_span()
7777
dcid = None
7878
recipe_id = None
@@ -83,32 +83,6 @@ def unwrap_recipe(header, message):
8383
if isinstance(environment, dict):
8484
recipe_id = environment.get("ID")
8585

86-
# Try multiple locations where DCID might be stored
87-
top_level_params = {}
88-
if isinstance(message, dict):
89-
# Direct parameters (top-level or in recipe)
90-
top_level_params = message.get("parameters", {})
91-
92-
# Payload parameters (most common location)
93-
payload = message.get("payload", {})
94-
payload_params = {}
95-
if isinstance(payload, dict):
96-
payload_params = payload.get("parameters", {})
97-
98-
# Try all common locations
99-
dcid = (
100-
top_level_params.get("ispyb_dcid") or
101-
top_level_params.get("dcid") or
102-
payload_params.get("ispyb_dcid") or
103-
payload_params.get("dcid") or
104-
payload.get("ispyb_dcid") or
105-
payload.get("dcid")
106-
)
107-
108-
if dcid:
109-
span.set_attribute("dcid", dcid)
110-
span.add_event("recipe.dcid_extracted", attributes={"dcid": dcid})
111-
11286
if recipe_id:
11387
span.set_attribute("recipe_id", recipe_id)
11488
span.add_event("recipe.id_extracted", attributes={"recipe_id": recipe_id})
@@ -129,6 +103,7 @@ def unwrap_recipe(header, message):
129103
log_extra["recipe_id"] = recipe_id
130104

131105
logger.info(
106+
132107
"Processing recipe message",
133108
extra=log_extra
134109
)

0 commit comments

Comments
 (0)