Skip to content

Conversation

@Ray0907
Copy link

@Ray0907 Ray0907 commented Dec 9, 2025

  • Add OpenTelemetry instrumentation that bridges aiEventClient events to
    OTEL spans

    • Follow GenAI Semantic Conventions (gen_ai.system, gen_ai.usage.*, etc.)
    • Create spans for chat, stream, tool calls, and iterations
    • Support configurable content recording for privacy
    • Remove console.log/error from openai and anthropic adapters (security
      improvement)

    🎯 Changes

    Add @tanstack/ai-opentelemetry package that automatically creates
    OpenTelemetry traces and spans for all TanStack AI operations by
    subscribing to the existing aiEventClient event system.

    New Package: @tanstack/ai-opentelemetry

    • Bridges aiEventClient events to OTEL spans
    • Follows GenAI Semantic Conventions
    • Creates spans for: chat, stream, tool calls, iterations
    • Configurable content recording (disabled by default for privacy)

    Security Improvement

    • Remove console.log/error from @tanstack/ai-openai and
      @tanstack/ai-anthropic adapters
    • Errors are still properly emitted via StreamChunk error type

    ✅ Checklist

    • I have followed the steps in the Contributing
      guide
      .
    • I have tested this code locally with pnpm run test:pr.

    🚀 Release Impact

   - Add OpenTelemetry instrumentation that bridges aiEventClient events to
   OTEL spans
   - Follow GenAI Semantic Conventions (gen_ai.system, gen_ai.usage.*, etc.)
   - Create spans for chat, stream, tool calls, and iterations
   - Support configurable content recording for privacy
   - Remove console.log/error from openai and anthropic adapters (security
   improvement)
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.

2 participants