Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat: Enable Tracing Support For Phoenix Cloud Instance (#23196)
Ali Saleh142ab7478415
diff --git a/api/core/ops/arize_phoenix_trace/arize_phoenix_trace.py b/api/core/ops/arize_phoenix_trace/arize_phoenix_trace.pyindex a20f2485c86..e7c90c12296 100644--- a/api/core/ops/arize_phoenix_trace/arize_phoenix_trace.py+++ b/api/core/ops/arize_phoenix_trace/arize_phoenix_trace.py@@ -4,6 +4,7 @@ import loggingimport osfrom datetime import datetime, timedeltafrom typing import Any, Optional, Union, cast+from urllib.parse import urlparsefrom openinference.semconv.trace import OpenInferenceSpanKindValues, SpanAttributesfrom opentelemetry import trace@@ -40,8 +41,14 @@ def setup_tracer(arize_phoenix_config: ArizeConfig | PhoenixConfig) -> tuple[tratry:# Choose the appropriate exporter based on config typeexporter: Union[GrpcOTLPSpanExporter, HttpOTLPSpanExporter]++ # Inspect the provided endpoint to determine its structure+ parsed = urlparse(arize_phoenix_config.endpoint)+ base_endpoint = f"{parsed.scheme}://{parsed.netloc}"+ path = parsed.path.rstrip("/")+if isinstance(arize_phoenix_config, ArizeConfig):- arize_endpoint = f"{arize_phoenix_config.endpoint}/v1"+ arize_endpoint = f"{base_endpoint}/v1"arize_headers = {"api_key": arize_phoenix_config.api_key or "","space_id": arize_phoenix_config.space_id or "",@@ -53,7 +60,7 @@ def setup_tracer(arize_phoenix_config: ArizeConfig | PhoenixConfig) -> tuple[tratimeout=30,)else:- phoenix_endpoint = f"{arize_phoenix_config.endpoint}/v1/traces"+ phoenix_endpoint = f"{base_endpoint}{path}/v1/traces"phoenix_headers = {"api_key": arize_phoenix_config.api_key or "","authorization": f"Bearer {arize_phoenix_config.api_key or ''}",diff --git a/api/core/ops/entities/config_entity.py b/api/core/ops/entities/config_entity.pyindex 626782cee5c..851a77fbc10 100644--- a/api/core/ops/entities/config_entity.py+++ b/api/core/ops/entities/config_entity.py@@ -87,7 +87,7 @@ class PhoenixConfig(BaseTracingConfig):@field_validator("endpoint")@classmethoddef endpoint_validator(cls, v, info: ValidationInfo):- return cls.validate_endpoint_url(v, "https://app.phoenix.arize.com")+ return validate_url_with_path(v, "https://app.phoenix.arize.com")class LangfuseConfig(BaseTracingConfig):diff --git a/api/tests/unit_tests/core/ops/test_config_entity.py b/api/tests/unit_tests/core/ops/test_config_entity.pyindex 209f8b7c579..1dc380ad0b6 100644--- a/api/tests/unit_tests/core/ops/test_config_entity.py+++ b/api/tests/unit_tests/core/ops/test_config_entity.py@@ -102,9 +102,14 @@ class TestPhoenixConfig:assert config.project == "default"def test_endpoint_validation_with_path(self):- """Test endpoint validation normalizes URL by removing path"""- config = PhoenixConfig(endpoint="https://custom.phoenix.com/api/v1")- assert config.endpoint == "https://custom.phoenix.com"+ """Test endpoint validation with path"""+ config = PhoenixConfig(endpoint="https://app.phoenix.arize.com/s/dify-integration")+ assert config.endpoint == "https://app.phoenix.arize.com/s/dify-integration"++ def test_endpoint_validation_without_path(self):+ """Test endpoint validation without path"""+ config = PhoenixConfig(endpoint="https://app.phoenix.arize.com")+ assert config.endpoint == "https://app.phoenix.arize.com"class TestLangfuseConfig:@@ -368,13 +373,15 @@ class TestConfigIntegration:"""Test that URL normalization works consistently across configs"""# Test that paths are removed from endpointsarize_config = ArizeConfig(endpoint="https://arize.com/api/v1/test")- phoenix_config = PhoenixConfig(endpoint="https://phoenix.com/api/v2/")+ phoenix_with_path_config = PhoenixConfig(endpoint="https://app.phoenix.arize.com/s/dify-integration")+ phoenix_without_path_config = PhoenixConfig(endpoint="https://app.phoenix.arize.com")aliyun_config = AliyunConfig(license_key="test_license", endpoint="https://tracing-analysis-dc-hz.aliyuncs.com/api/v1/traces")assert arize_config.endpoint == "https://arize.com"- assert phoenix_config.endpoint == "https://phoenix.com"+ assert phoenix_with_path_config.endpoint == "https://app.phoenix.arize.com/s/dify-integration"+ assert phoenix_without_path_config.endpoint == "https://app.phoenix.arize.com"assert aliyun_config.endpoint == "https://tracing-analysis-dc-hz.aliyuncs.com"def test_project_default_values(self):