Skip to content

Websocket (wss)-Based Span Processor for Browser & Node Telemetry #1162

@clayroach

Description

@clayroach

What is the problem this feature would solve?

Browser applications need to export telemetry data, but the current options have limitations:

  1. HTTP/OTLP (@opentelemetry/exporter-trace-otlp-http)

    • CORS configuration required on collector
    • Each span batch creates a new request (DevTools noise)
    • No streaming capability
    • Higher overhead for frequent small payloads
  2. No official WebSocket exporter exists

    • OTEP-0099 notes: "Experimental implementation of OTLP over WebSocket transport has shown that it typically has better performance than plain HTTP"
    • Left as "future consideration" due to library availability concerns
    • Community solutions are fragmented and minimally maintained
  3. Standard OTel BatchSpanProcessor limitations

    • Uses setTimeout/setInterval and unmanaged promises
    • Does not participate in Effect's Scope or fiber management
    • No backpressure handling

What is the feature you are proposing to solve the problem?

Add a SocketSpanProcessor to @effect/opentelemetry that leverages @effect/platform's abstract Socket interface. This provides Effect-native telemetry export with proper error handling, automatic reconnection, and resource management—working across Browser, Node, Bun, and any platform with a Socket implementation.

What alternatives have you considered?

1. Use HTTP Exporter Only

The existing @opentelemetry/exporter-trace-otlp-http works but:

  • CORS configuration is an operational burden
  • No streaming means higher latency for real-time use cases
  • DevTools network tab becomes noisy

2. Build a Custom Protocol

Could define a minimal "just span data" format but:

  • Fragments the ecosystem further
  • Loses compatibility with OTLP tooling
  • More work for marginal gains

3. Build Outside Effect Ecosystem

Could publish as separate package but:

  • Loses Effect integration benefits (typed errors, scheduling, resources)
  • Misses opportunity to showcase platform abstractions

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions