-
Notifications
You must be signed in to change notification settings - Fork 117
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Implement reactive flush instrumentation to create reactive.update spans that wrap each flush cycle.
Goals
- Add
reactive.updatespans that wrap each flush cycle - Store span on ReactiveEnvironment instance for child reactive spans to reference
- Span should include both sequential flush and flushed callbacks
- Respect
REACTIVE_UPDATEcollection level
Implementation
Core Changes
- Modify
ReactiveEnvironment.flush()to wrap in span - Store span on instance (
_current_otel_span) for child spans to access - Use save/restore pattern for nested flush support
Architecture Decision
- Refactored from module-level contextvar to instance variable
- Better encapsulation and single source of truth
- Easier access in Phase 4 for reactive calc/effect/output spans
- Renamed to
_current_otel_spanfor generality
Testing
- Collection level controls (REACTIVE_UPDATE, ALL, SESSION, NONE)
- Span creation during flush
- No-op when not collecting
- Instance variable storage and reset
- Parent-child relationship verification (session.start → reactive.update)
Acceptance Criteria
- Flush cycles create
reactive.updatespans whenSHINY_OTEL_COLLECT >= reactive_update - Span wraps all context flushes and flushed callbacks
- Multiple flush cycles create separate spans
- Span stored on ReactiveEnvironment instance
- All 55 OTel tests pass
Related
- Phase 2: otel: Session Lifecycle Instrumentation #2133
- Phase 4: otel: Reactive Execution Instrumentation #2135
- PR: feat(otel): Phase 3 - Reactive Flush Instrumentation #2146
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request