mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
store node names
This commit is contained in:
@@ -193,7 +193,9 @@ class Flow(Generic[T], metaclass=FlowMeta):
|
|||||||
if not self._start_methods:
|
if not self._start_methods:
|
||||||
raise ValueError("No start method defined")
|
raise ValueError("No start method defined")
|
||||||
|
|
||||||
self._telemetry.flow_execution_span(self.__class__.__name__)
|
self._telemetry.flow_execution_span(
|
||||||
|
self.__class__.__name__, list(self._methods.keys())
|
||||||
|
)
|
||||||
|
|
||||||
# Create tasks for all start methods
|
# Create tasks for all start methods
|
||||||
tasks = [
|
tasks = [
|
||||||
@@ -276,6 +278,8 @@ class Flow(Generic[T], metaclass=FlowMeta):
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
def plot(self, filename: str = "crewai_flow"):
|
def plot(self, filename: str = "crewai_flow"):
|
||||||
self._telemetry.flow_plotting_span(self.__class__.__name__)
|
self._telemetry.flow_plotting_span(
|
||||||
|
self.__class__.__name__, list(self._methods.keys())
|
||||||
|
)
|
||||||
|
|
||||||
plot_flow(self, filename)
|
plot_flow(self, filename)
|
||||||
|
|||||||
@@ -586,23 +586,25 @@ class Telemetry:
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def flow_plotting_span(self, flow_name: str):
|
def flow_plotting_span(self, flow_name: str, node_names: list[str]):
|
||||||
if self.ready:
|
if self.ready:
|
||||||
try:
|
try:
|
||||||
tracer = trace.get_tracer("crewai.telemetry")
|
tracer = trace.get_tracer("crewai.telemetry")
|
||||||
span = tracer.start_span("Flow Plotting")
|
span = tracer.start_span("Flow Plotting")
|
||||||
self._add_attribute(span, "flow_name", flow_name)
|
self._add_attribute(span, "flow_name", flow_name)
|
||||||
|
self._add_attribute(span, "node_names", json.dumps(node_names))
|
||||||
span.set_status(Status(StatusCode.OK))
|
span.set_status(Status(StatusCode.OK))
|
||||||
span.end()
|
span.end()
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def flow_execution_span(self, flow_name: str):
|
def flow_execution_span(self, flow_name: str, node_names: list[str]):
|
||||||
if self.ready:
|
if self.ready:
|
||||||
try:
|
try:
|
||||||
tracer = trace.get_tracer("crewai.telemetry")
|
tracer = trace.get_tracer("crewai.telemetry")
|
||||||
span = tracer.start_span("Flow Execution")
|
span = tracer.start_span("Flow Execution")
|
||||||
self._add_attribute(span, "flow_name", flow_name)
|
self._add_attribute(span, "flow_name", flow_name)
|
||||||
|
self._add_attribute(span, "node_names", json.dumps(node_names))
|
||||||
span.set_status(Status(StatusCode.OK))
|
span.set_status(Status(StatusCode.OK))
|
||||||
span.end()
|
span.end()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user