The base URL to the Phoenix server (may or may not include the traces endpoint)
A normalized URL string that includes the /v1/traces endpoint
URL without traces endpoint:
const normalized = ensureCollectorEndpoint('https://app.phoenix.arize.com');
// Returns: 'https://app.phoenix.arize.com/v1/traces'
URL that already includes traces endpoint:
const normalized = ensureCollectorEndpoint('https://app.phoenix.arize.com/v1/traces');
// Returns: 'https://app.phoenix.arize.com/v1/traces'
Local development URL:
const normalized = ensureCollectorEndpoint('http://localhost:6006');
// Returns: 'http://localhost:6006/v1/traces'
Normalizes a Phoenix server URL to ensure it includes the correct OTLP traces endpoint.
This utility function ensures that any Phoenix server URL is properly formatted to include the
/v1/tracesendpoint required for OTLP trace export. It handles various URL formats and automatically appends the endpoint if missing.The function:
/v1/traces/v1/tracesto the base URL