From ad6ffe9886a2821d44c8f059cdeef0432c8343e8 Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Wed, 30 Oct 2024 16:31:44 -0400 Subject: [PATCH 1/3] Disable telemetry explicitly --- src/crewai/telemetry/telemetry.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/crewai/telemetry/telemetry.py b/src/crewai/telemetry/telemetry.py index a08ccd96f6..aa0f8b9fff 100644 --- a/src/crewai/telemetry/telemetry.py +++ b/src/crewai/telemetry/telemetry.py @@ -21,7 +21,9 @@ def suppress_warnings(): from opentelemetry import trace # noqa: E402 -from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter # noqa: E402 +from opentelemetry.exporter.otlp.proto.http.trace_exporter import ( + OTLPSpanExporter, # noqa: E402 +) from opentelemetry.sdk.resources import SERVICE_NAME, Resource # noqa: E402 from opentelemetry.sdk.trace import TracerProvider # noqa: E402 from opentelemetry.sdk.trace.export import BatchSpanProcessor # noqa: E402 @@ -48,6 +50,10 @@ class Telemetry: def __init__(self): self.ready = False self.trace_set = False + + if os.getenv("OTEL_SDK_DISABLED", "false").lower() == "true": + return + try: telemetry_endpoint = "https://telemetry.crewai.com:4319" self.resource = Resource( From c0120e0a41570ca888ba0a6a031ddbf6d99d0cda Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Wed, 30 Oct 2024 16:34:54 -0400 Subject: [PATCH 2/3] fix linting --- src/crewai/telemetry/telemetry.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/crewai/telemetry/telemetry.py b/src/crewai/telemetry/telemetry.py index aa0f8b9fff..debb790f8f 100644 --- a/src/crewai/telemetry/telemetry.py +++ b/src/crewai/telemetry/telemetry.py @@ -21,9 +21,7 @@ def suppress_warnings(): from opentelemetry import trace # noqa: E402 -from opentelemetry.exporter.otlp.proto.http.trace_exporter import ( - OTLPSpanExporter, # noqa: E402 -) +from opentelemetry.exporter.otlp.proto.http.trace_exporter import (OTLPSpanExporter) # noqa: E402 from opentelemetry.sdk.resources import SERVICE_NAME, Resource # noqa: E402 from opentelemetry.sdk.trace import TracerProvider # noqa: E402 from opentelemetry.sdk.trace.export import BatchSpanProcessor # noqa: E402 From 1bf65999d358b9252ee8443547f1cfe7e01b2303 Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Wed, 30 Oct 2024 16:35:27 -0400 Subject: [PATCH 3/3] revert parts to og --- src/crewai/telemetry/telemetry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crewai/telemetry/telemetry.py b/src/crewai/telemetry/telemetry.py index debb790f8f..e191f8d4d4 100644 --- a/src/crewai/telemetry/telemetry.py +++ b/src/crewai/telemetry/telemetry.py @@ -21,7 +21,7 @@ def suppress_warnings(): from opentelemetry import trace # noqa: E402 -from opentelemetry.exporter.otlp.proto.http.trace_exporter import (OTLPSpanExporter) # noqa: E402 +from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter # noqa: E402 from opentelemetry.sdk.resources import SERVICE_NAME, Resource # noqa: E402 from opentelemetry.sdk.trace import TracerProvider # noqa: E402 from opentelemetry.sdk.trace.export import BatchSpanProcessor # noqa: E402