Skip to content

Commit

Permalink
Add span event for generator case
Browse files Browse the repository at this point in the history
  • Loading branch information
liucheng-ms committed Mar 26, 2024
1 parent 6661f1d commit 5134767
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/promptflow-tracing/promptflow/tracing/_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ def traced_generator(original_span: ReadableSpan, inputs, generator):
links=[link],
) as span:
enrich_span_with_original_attributes(span, original_span.attributes)
# Enrich the new span with input before generator iteration to prevent loss of input information.
# The input is as an event within this span.
enrich_span_with_input(span, inputs)
generator_proxy = GeneratorProxy(generator)
yield from generator_proxy
generator_output = generator_proxy.items
Expand Down

0 comments on commit 5134767

Please sign in to comment.