Skip to content

Conversation

@vinitkadam03
Copy link
Contributor

@vinitkadam03 vinitkadam03 commented Jan 17, 2026

Description

Adds comprehensive telemetry support to Prism, enabling observability through configurable drivers. This feature was built on the foundations of the eventelemetry branch by @sixlive.

Features

  • Configurable Drivers: Choose from null, log, or otlp drivers via PRISM_TELEMETRY_DRIVER
  • Phoenix/Arize Integration: First-class support for Arize Phoenix with OpenInference semantic conventions
  • Custom Drivers: Register custom telemetry drivers via factory classes or closures
  • User Context Tracking: Track user_id, session_id, and agent across spans
  • Streaming Support: Telemetry for streaming responses with StreamStartEvent/StreamEndEvent capture
  • Async Export: Queue-based span export with configurable retry (3 attempts, 5s backoff)
  • Exception Recording: Automatic SpanException dispatch on failures with context preservation

Configuration

// Enable telemetry
PRISM_TELEMETRY_ENABLED=true
PRISM_TELEMETRY_DRIVER=phoenix

// Phoenix configuration
PHOENIX_ENDPOINT=https://app.phoenix.arize.com/v1/traces
PHOENIX_API_KEY=your-api-key

Usage

Prism::text()
    ->using('openai', 'gpt-4')
    ->forUser(auth()->id())
    ->forConversation($conversation->id)
    ->forAgent('support-bot')
    ->withPrompt('Hello')
    ->asText();

Global Context

// In a service provider
Prism::defaultTelemetryContext(fn () => [
    'user_id' => auth()->id(),
    'environment' => app()->environment(),
]);

Optional Dependencies

For OTLP drivers (Phoenix, etc.), install:

composer require open-telemetry/sdk open-telemetry/exporter-otlp

Breaking Changes

None. Telemetry is disabled by default and fully opt-in.

@vinitkadam03 vinitkadam03 marked this pull request as draft January 17, 2026 11:04
@vinitkadam03 vinitkadam03 changed the title Feat/evented telemetry Feat: Evented telemetry Jan 17, 2026
@vinitkadam03 vinitkadam03 force-pushed the feat/evented-telemetry branch from 477f5a0 to b84c920 Compare January 17, 2026 14:44
@vinitkadam03
Copy link
Contributor Author

vinitkadam03 commented Jan 17, 2026

Still WIP. Would rebase on top of #833 as it fixes bugs and centralizes call tools.

@vinitkadam03 vinitkadam03 force-pushed the feat/evented-telemetry branch from 2d7e046 to 05d6d59 Compare January 17, 2026 21:16
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