Skip to content

feat(fi-core): send span exports to FI_TRACES_URL when set - #710

Merged
nik13 merged 3 commits into
devfrom
fix/fi-traces-url
Nov 18, 2026
Merged

nik13 merged 3 commits into
devfrom
fix/fi-traces-url

Conversation

@nik13

@nik13 nik13 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Problem

Self-hosted Docker installs serve the platform API and the trace collector on different ports (often :8100 and :4318). Span exports and platform API calls both read FI_BASE_URL, so a user can't point an app's tracing at the collector and keep CLI/API calls on the API in the same environment. A real-user run against a self-hosted stack hit exactly this:

  • FI_BASE_URL set to the API gave export 404s;
  • FI_BASE_URL set to the collector broke fagi.

Change

FI_TRACES_URL (a base URL, like FI_BASE_URL) names where HTTP span exports go.

  • Python (fi-instrumentation-otel): new settings.get_env_traces_endpoint() returns FI_TRACES_URL, else FI_BASE_URL, else the default. It is used by:

    • register() / TracerProvider;
    • HTTPSpanExporter with no endpoint;
    • the default exporter;
    • Endpoints.FUTURE_AGI;
    • the Temporal helper's default.

    check_custom_eval_config_exists and get_custom_eval_template keep FI_BASE_URL.

  • TypeScript (@traceai/fi-core): constructFullEndpoint uses FI_TRACES_URL before FI_BASE_URL / FI_COLLECTOR_ENDPOINT. An explicit endpoint still wins, and platform API calls keep FI_BASE_URL.

  • Unchanged: gRPC (FI_GRPC_URL); the zero-code auto bootstrap, which can follow once this ships.

  • Unset or blank FI_TRACES_URL keeps today's behaviour exactly.

Changelog entries are under the pending Python 1.4.0 and fi-core 1.3.0 sections.

Tests

Both suites ran in a temporary E2B sandbox.

Python (tests/test_traces_url.py):

  • Two local servers stand in for the API and the collector. HTTPSpanExporter() and the default exporter export only to the collector's /tracer/v1/traces; the API sees nothing.
  • The custom-eval helpers resolve from FI_BASE_URL.
  • Unset, "" and " " fall back to FI_BASE_URL.
  • Results: 6/6 pass, and 5 fail on dev. In the core suite, the failing set is identical with and without the change: 34 framework/auto tests that need packages not installed in the sandbox. No new failures.

TypeScript (src/__tests__/tracesUrl.test.ts):

  • The same two-server export check, plus the fallback cases.
  • Results: 4/4 pass, and the destination case fails on dev. The full fi-core suite passes (72 suites, 2396 tests).

AI use: Claude Code (Opus 5.5) wrote the change and tests; GPT reviewers had mapped the endpoint contract across the SDK, CLI and backend.

🤖 Generated with Claude Code

nik13 and others added 3 commits November 17, 2026 04:55
Self-hosted Docker installs serve the platform API and the trace collector on different ports, but exports and API calls both read FI_BASE_URL, so one shell could not reach both. FI_TRACES_URL now names the trace destination for HTTP exports in Python (register, HTTPSpanExporter, the default exporter, Endpoints, the Temporal helper) and TypeScript fi-core. Unset or blank keeps FI_BASE_URL; custom eval API calls always use FI_BASE_URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The published-core compatibility checks import this otel.py next to a
released fi_instrumentation package whose settings has no
get_env_traces_endpoint. Fall back to the same rule locally there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant