Skip to content
Merged
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
12 changes: 10 additions & 2 deletions pydantic_graph/pydantic_graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ async def iter(
entered_span: AbstractSpan | None = None
if span is None:
if self.auto_instrument: # pragma: no branch
entered_span = stack.enter_context(logfire_span('run graph {graph.name}', graph=self))
# Separate variable because we actually don't want logfire's f-string magic here,
# we want the span_name to be preformatted for other backends
# as requested in https://github.com/pydantic/pydantic-ai/issues/3173.
span_name = f'run graph {self.name}'
entered_span = stack.enter_context(logfire_span(span_name, graph=self))
else:
entered_span = stack.enter_context(span)
traceparent = None if entered_span is None else get_traceparent(entered_span)
Expand Down Expand Up @@ -724,7 +728,11 @@ async def main():

with ExitStack() as stack:
if self.graph.auto_instrument: # pragma: no branch
stack.enter_context(logfire_span('run node {node_id}', node_id=node_id, node=node))
# Separate variable because we actually don't want logfire's f-string magic here,
# we want the span_name to be preformatted for other backends
# as requested in https://github.com/pydantic/pydantic-ai/issues/3173.
span_name = f'run node {node_id}'
stack.enter_context(logfire_span(span_name, node_id=node_id, node=node))

async with self.persistence.record_run(node_snapshot_id):
ctx = GraphRunContext(state=self.state, deps=self.deps)
Expand Down