crewAIInc / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
20.7k stars 2.86k forks source link

[BUG] Task Ended telemetry has been stopped #1502

Open Hrithikd opened 1 week ago

Hrithikd commented 1 week ago

Description

In version 0.67.1 I was able to get the Task Executed / ended event from opentelemetry. However, in the most recent version, the task ended/ task executed event is not getting emitted. Something happened between 0.67 and latest version.

Steps to Reproduce

Just add a console exporter like this: from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter CrewAILogger._provider.add_span_processor(BatchSpanProcessor(ConsoleSpanExporter())) and you will see that the task executed event is not there in the latest version, but is there in 0.67.1

Expected behavior

The task executed span should be being emitted. I have the share_crew turned on

Screenshots/Code snippets

        from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter
        CrewAILogger._provider.add_span_processor(BatchSpanProcessor(ConsoleSpanExporter()))

Operating System

Ubuntu 20.04

Python Version

3.10

crewAI Version

latest

crewAI Tools Version

any

Virtual Environment

Venv

Evidence

The span isn't there

Possible Solution

Make sure the span is being emitted

Additional context

Thank you!

bhancockio commented 2 days ago

Hey @Hrithikd !

We are working on a big refactor that should fix this issue. I'll be sure to keep you posted about the progress of this change. Ideally, the change should be merged in by the end of this week or the beginning of next.