Skip to content

fix(tracing): use FITracer for TypeScript custom spans - #1047

Merged
nik13 merged 2 commits into
mainfrom
fix/typescript-custom-span-guide
Nov 4, 2026
Merged

nik13 merged 2 commits into
mainfrom
fix/typescript-custom-span-guide

Conversation

@nik13

@nik13 nik13 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Correct the TypeScript custom-span guide to use the already-published FITracer wrapper rather than a raw OpenTelemetry tracer.

  • Initialize async context propagation once, wrap the registered provider's tracer, and activate the returned session/user context with context.with.
  • Await application work, record failures, rethrow them, and always end the span in finally. Flush on script shutdown; explain how servers reuse their provider and context manager.
  • Apply input, output, and error-detail privacy through the wrapper. State explicitly that raw OpenTelemetry spans do not automatically copy Future AGI context attributes or apply wrapper masking.
  • Add an executable test that extracts and type-checks the actual MDX snippet, then sends real OTLP to a loopback collector. CI covers OpenTelemetry 2.0.1 and 2.12.0 with external networking disabled.

Keep, fix, or delete

Keep @traceai/fi-core. The defect is in the guide, not the package. The example runs with registry version 1.1.0; no SDK release, additional integration package, package deletion, or deployment ordering is needed.

No open PR changes this page. Docs #1026 covers related privacy reference pages but does not fix this example.

Verification

  • Reproduced with published @traceai/fi-core 1.1.0: raw spans omit session.id/user.id, expose the synthetic input, and never export a span when the callback throws before span.end(). The context manager was enabled.
  • Extracted snippet: 5/5 tests at OpenTelemetry 2.0.1 and 5/5 at 2.12.0, under a macOS sandbox denying outbound network except loopback. Assertions cover concurrent async request isolation, parentage, no duplicate spans, input/output masking, private error events and status, rethrowing, and shutdown export. TypeScript strict checking covers the example itself (skipLibCheck skips third-party declarations).
  • npm run test:integrations: 9/9 passed.
  • npm run check:integrations: passed.
  • npm run build: passed (794 indexed pages).
  • npm run audit-links: zero broken navigation/content links; 28 pre-existing orphan pages reported.
  • Rendered the real built page in Chromium, selected the TypeScript tab, and checked both code blocks and the wrapper-scope wording.

Re-run the snippet checks with npm ci --ignore-scripts --prefix examples/sdk/fitracer-typescript followed by npm test --prefix examples/sdk/fitracer-typescript. The dedicated workflow additionally runs in a loopback-only Linux network namespace.

E2E coverage

Not applicable (no product e2e/ harness in this documentation repository). The doc example is exercised through its actual published OTLP exporter, and the documentation page was rendered locally. No vendor/model API or live Future AGI account was used.

Review

Self-reviewed against internal standards. No introduced blocking findings; no public SDK API changes, version bumps, generated helper code, or unrelated page edits.

🤖 Generated with Claude Code

nik13 and others added 2 commits October 31, 2026 05:33
Exercise the published wrapper and actual MDX snippet at the OpenTelemetry floor and current versions with loopback-only OTLP checks.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Use zero-argument callbacks and Span.current() for each nested span. Complete the Java imports and link provider initialization.

Add a Maven Central 1.0.1 snippet regression test and CI check covering compilation, OTLP export, span kinds, attributes, lifecycle, and parentage.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@nik13
nik13 merged commit 465a954 into main Nov 4, 2026
7 checks passed
@nik13
nik13 deleted the fix/typescript-custom-span-guide branch November 4, 2026 12:09
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