Skip to content

opentelemetry-instrumentation-reflex: full-stack OTel package #6227

Description

@masenf

Summary

Create an optional, separately installable opentelemetry-instrumentation-reflex package that instruments the entire Reflex stack.

Instrumentation Surface

  • Event processing: spans for event dispatch, handler execution, state mutation, delta construction, and Replicache sync. Parent-child span relationships for chained/requeued events
  • Compiler: trace full compilation time, per-page compilation, plugin execution, and cache hit/miss rates
  • State synchronization: Replicache mutation round-trip timing, optimistic mutation conflict rates, frontend-to-backend sync latency
  • ASGI middleware (4a): propagate trace context across ASGI boundaries
  • Websocket lifecycle: connection duration, message throughput, reconnection frequency
  • Frontend (browser): web vitals and component render timing as spans correlated with backend traces via W3C trace context headers

Design Principle

The core framework should be instrumentation-aware but zero-cost when the OTel package isn't installed. Uses the standard opentelemetry-api no-op pattern — trace points exist in the framework but are inert without the instrumentation package. No performance penalty for users who don't opt in.

Part of the Reflex Framework Roadmap — Section 1g.

Metadata

Metadata

Assignees

Labels

enhancementAnything you want improved

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions