Skip to content

Commit b67f459

Browse files
authored
Merge branch 'main' into fix/ws-rest-event-sync
2 parents 3205b25 + d7b3617 commit b67f459

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

examples/03_github_workflows/02_pr_review/agent_script.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -842,16 +842,22 @@ def main():
842842
else None
843843
)
844844

845-
if trace_id:
846-
# Set trace metadata for later retrieval and filtering
847-
Laminar.set_trace_metadata(
848-
{
849-
"pr_number": pr_info["number"],
850-
"repo_name": pr_info["repo_name"],
851-
"workflow_phase": "review",
852-
"review_style": review_style,
853-
}
854-
)
845+
if trace_id and laminar_span_context:
846+
# Set trace metadata within an active span context
847+
# Using start_as_current_span with parent_span_context to continue the trace
848+
with Laminar.start_as_current_span(
849+
name="pr-review-metadata",
850+
parent_span_context=laminar_span_context,
851+
) as _:
852+
# Set trace metadata within this active span context
853+
Laminar.set_trace_metadata(
854+
{
855+
"pr_number": pr_info["number"],
856+
"repo_name": pr_info["repo_name"],
857+
"workflow_phase": "review",
858+
"review_style": review_style,
859+
}
860+
)
855861

856862
# Store trace context in file for GitHub artifact upload
857863
# This allows the evaluation workflow to add its span to this trace

0 commit comments

Comments
 (0)