From 85ed6a6ae92363b0eda917f6f414b30ecf2ea9e9 Mon Sep 17 00:00:00 2001 From: Ali Saleh Date: Thu, 29 May 2025 23:58:51 +0500 Subject: [PATCH] fix: Enable Tracing Support For Self-Hosted Phoenix Instance (#8256) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Enable Tracing Support For Self-Hosted Phoenix Instance * [autofix.ci] apply automated fixes * fix: Clarify Phoenix Tracing Without Auth --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Ítalo Johnny --- .../langflow/services/tracing/arize_phoenix.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/backend/base/langflow/services/tracing/arize_phoenix.py b/src/backend/base/langflow/services/tracing/arize_phoenix.py index 94389c250..2e5a3716b 100644 --- a/src/backend/base/langflow/services/tracing/arize_phoenix.py +++ b/src/backend/base/langflow/services/tracing/arize_phoenix.py @@ -111,12 +111,17 @@ class ArizePhoenixTracer(BaseTracer): # Phoenix Config phoenix_api_key = os.getenv("PHOENIX_API_KEY", None) phoenix_collector_endpoint = os.getenv("PHOENIX_COLLECTOR_ENDPOINT", "https://app.phoenix.arize.com") - enable_phoenix_tracing = bool(phoenix_api_key) + phoenix_auth_disabled = "localhost" in phoenix_collector_endpoint or "127.0.0.1" in phoenix_collector_endpoint + enable_phoenix_tracing = bool(phoenix_api_key) or phoenix_auth_disabled phoenix_endpoint = f"{phoenix_collector_endpoint}/v1/traces" - phoenix_headers = { - "api_key": phoenix_api_key, - "authorization": f"Bearer {phoenix_api_key}", - } + phoenix_headers = ( + { + "api_key": phoenix_api_key, + "authorization": f"Bearer {phoenix_api_key}", + } + if phoenix_api_key + else {} + ) if not (enable_arize_tracing or enable_phoenix_tracing): return False