fix: Enable Tracing Support For Self-Hosted Phoenix Instance (#8256)

* 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 <italojohnnydosanjos@gmail.com>
This commit is contained in:
Ali Saleh 2025-05-29 23:58:51 +05:00 committed by GitHub
commit 85ed6a6ae9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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