Skip to content

Commit

Permalink
Fix crew creation telemetry (#939)
Browse files Browse the repository at this point in the history
* Fix crew creation telemetry

* Remove task index
  • Loading branch information
gvieira committed Jul 15, 2024
1 parent 67b04b3 commit 161c4a6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/crewai/telemetry/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def task_started(self, crew: Crew, task: Task) -> Span | None:
created_span = tracer.start_span("Task Created")

self._add_attribute(created_span, "crew_id", str(crew.id))
self._add_attribute(created_span, "task_index", crew.tasks.index(task))
self._add_attribute(created_span, "task_id", str(task.id))

if crew.share_crew:
Expand All @@ -188,7 +187,6 @@ def task_started(self, crew: Crew, task: Task) -> Span | None:
span = tracer.start_span("Task Execution")

self._add_attribute(span, "crew_id", str(crew.id))
self._add_attribute(span, "task_index", crew.tasks.index(task))
self._add_attribute(span, "task_id", str(task.id))

if crew.share_crew:
Expand Down Expand Up @@ -284,10 +282,10 @@ def crew_execution_span(self, crew: Crew, inputs: dict[str, Any] | None):
"""Records the complete execution of a crew.
This is only collected if the user has opted-in to share the crew.
"""
self.crew_creation(crew, inputs)

if (self.ready) and (crew.share_crew):
try:
self.crew_creation(crew, inputs)

tracer = trace.get_tracer("crewai.telemetry")
span = tracer.start_span("Crew Execution")
self._add_attribute(
Expand Down

0 comments on commit 161c4a6

Please sign in to comment.