Skip to content

chore: add telemetry testing example with OpenTelemetry #7405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Suhaib3100
Copy link

Background

The AI SDK needs comprehensive examples showing how to implement and test telemetry in AI applications. This helps developers understand best practices for monitoring AI operations and implementing proper testing.

Summary

  • Added new next-openai-telemetry-testing example with OpenTelemetry integration
  • Implemented custom metrics for AI operations (completion count, latency, tokens)
  • Added tracing implementation with operation spans
  • Created comprehensive test suite for telemetry functionality
  • Added error handling and monitoring capabilities
  • Included mock telemetry providers for testing

Verification

  • Tested metric recording functionality with success and error cases
  • Verified error handling and monitoring through test suite
  • Confirmed telemetry data collection works as expected
  • Ensured all tests pass with proper mocking
  • Manually tested the example locally to verify end-to-end functionality

Tasks

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (run pnpm changeset in the project root)
  • Formatting issues have been fixed (run pnpm prettier-fix in the project root)

Future Work

  • Add more advanced telemetry patterns
  • Include examples for other telemetry providers
  • Add frontend components to demonstrate end-to-end telemetry
  • Expand test coverage for edge cases

Related Issues

This example helps address the need for better telemetry testing documentation and examples in the AI SDK.

- Upgraded Playwright to version 1.50.1
- Updated TypeScript to version 5.8.3
- Adjusted various package versions to ensure compatibility, including ESLint, Next.js, and Tailwind CSS
- Updated related dependencies to maintain consistency across the project

This update enhances the stability and performance of the project by keeping dependencies up to date.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant