crewAI: Connection Timeout Error with telemetry.crewai.com

Hello , I hope this message finds you well. I am reaching out to report an issue that I encountered while using your project. Description: I encountered a ConnectTimeout error when attempting to connect to telemetry.crewai.com on port 4318. The error message is as follows:

requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='telemetry.crewai.com', port=4318): Max retries exceeded with url: /v1/traces (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f34caf38280>, 'Connection to telemetry.crewai.com timed out. (connect timeout=10)')

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 32 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Related, but I am not able to run CrewAI due to the fact that it hits telemetry.crewai.com which I can’t access through my company’s proxy. It would be nice if the user could choose to optionally disable telemetry.

@Yamijalaa

Set the env var OTEL_SDK_DISABLED=true

import os
from crewai import Agent, Task, Crew, Process
from crewai_tools import SerperDevTool

os.environ["OTEL_SDK_DISABLED"] = "true"

it’s not pretty, but a tiny bit of monkey patching might get ya there. Mind the typo on crewai.telemtry at the moment (have a PR to fix that one: https://github.com/joaomdmoura/crewAI/pull/295 ).

from crewai.telemtry import Telemetry

def noop(*args, **kwargs):
    # with open("./logfile.txt", "a") as f:
    #     f.write("Telemetry method called and noop'd\n")
    pass


for attr in dir(Telemetry):
    if callable(getattr(Telemetry, attr)) and not attr.startswith("__"):
        setattr(Telemetry, attr, noop)

I want to add to this.

Put this in .env file; worked for me

OTEL_SDK_DISABLED = True

@Yamijalaa

Set the env var OTEL_SDK_DISABLED=true

import os
from crewai import Agent, Task, Crew, Process
from crewai_tools import SerperDevTool

os.environ["OTEL_SDK_DISABLED"] = "true"

Thank you so much this works for me

I just hit the same problem. I disabled telemetry with one line change to the file “<python_lib_dir>/site-packages/crewai/telemetry/telemetry.py” shown as diff below:

- self.ready = True
+ self.ready = False

Indeed, crewai should probably provide an option to allow clients to opt out of telemetry. In my case, the company’s security policy wouldn’t allow this without legal process and approval.

bumped, this is an issue still and needs to be resolved. Add an opt out completely option.

I am also facing the same issue even after this.

Bump, still is happening on my side, has a fix been pushed to pip ?

I agree to the previous speaker. Their must be a setting to turn those requests off. You can leave them on by default but allow disabling them for good. In best case it’d be a env var so that we do not need to do it over and over again.

Hey folks sorry this got automatically close, we did update out docs with instructions to disable it if people want and more details around the data. We did a while ago but I never closed the loop in here: https://docs.crewai.com/telemetry/Telemetry/

The link is no longer working. The same problem still exists. It has been so long. Why hasn’t the problem been solved yet?

I was also facing this issue but it may be mostly due to the firewall blocking access of this Link. After changing my connection to my personal hotspot from my Ogranasition one it worked.

I solved the issue by faking the response from the telemetry url:

…/lib/python3.11/site-packages/opentelemetry/exporter/otlp/proto/http/trace_exporter/init.py

from requests.models import Response
    ...

    def _export(self, serialized_data: bytes):
        data = serialized_data
        if self._compression == Compression.Gzip:
            gzip_data = BytesIO()
            with gzip.GzipFile(fileobj=gzip_data, mode="w") as gzip_stream:
                gzip_stream.write(serialized_data)
            data = gzip_data.getvalue()
        elif self._compression == Compression.Deflate:
            data = zlib.compress(serialized_data)

        # return self._session.post(
        #     url=self._endpoint,
        #     data=data,
        #     verify=self._certificate_file,
        #     timeout=self._timeout,
        # )
        # Create a fake response object
        fake_response = Response()
        fake_response.status_code = 200  # Set status code to 200 OK
        fake_response._content = b'{"status": "ok"}'  # Optional: fake response content

        return fake_response  

For now it works like a charm

@johnisanerd that warning looks like it come from the Open Telemetry Python SDK here.

If you add this to your /etc/hosts file:

127.0.0.1	telemetry.crewai.com

You will not see connection errors.

To test if OTEL_SDK_DISABLED has an effect:

If you then run without OTEL_SDK_DISABLED being set, you will see the connection errors. This indicates the underlying OpenTelemetry SDK is succesfully disabled when setting OTEL_SDK_DISABLED = "true"

I just published a pypi package from my opt-out branch: https://pypi.org/project/crewai-clean/

You need to set CREWAI_TELEMETRY_OPT_OUT=True in your environment.

Please test it out and leave a comment on https://github.com/joaomdmoura/crewAI/pull/402

Hey i have a fix for this you can just disable the telemetry calls on the tool usage class and in the crew class

Like below C:/User/…/your-env/site-packages/crewai/crew.py C:/User/…/your-env/site-packages/crewai/tools/tool_usage.py

You can comment all the telemetry related stuff and should work fine again

I cant even hit it in my local environment with telnet.

% telnet telemetry.crewai.com 4318
Trying 10.0.0.1...
telnet: connect to address 10.0.0.1: Connection refused
Trying fd6e:6c73:b178:1::1...
telnet: connect to address fd6e:6c73:b178:1::1: Connection refused
telnet: Unable to connect to remote host

I also get this about a hundred times during runtime:

requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='telemetry.crewai.com', port=4318): Max retries exceeded with url: /v1/traces (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f34caf38280>, 'Connection to telemetry.crewai.com timed out. (connect timeout=10)')