Skip to content

improving vertx websocket for end to end tracing in camel - POC#24363

Draft
JinyuChen97 wants to merge 1 commit into
apache:mainfrom
JinyuChen97:camel-quarkus-8280-related-investigation
Draft

improving vertx websocket for end to end tracing in camel - POC#24363
JinyuChen97 wants to merge 1 commit into
apache:mainfrom
JinyuChen97:camel-quarkus-8280-related-investigation

Conversation

@JinyuChen97

@JinyuChen97 JinyuChen97 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This commit enables WebSocket message spans to be linked back to their originating HTTP upgrade request spans using OpenTelemetry span links.

Key changes:

  1. VertxWebsocketHost: Capture HTTP upgrade span context using reflection

    • Avoids compile-time dependency on OpenTelemetry
    • Stores span context in RoutingContext during WebSocket upgrade
  2. VertxWebsocketPeer: Store handshake span context

    • New field to hold the HTTP upgrade span context
    • Persists for the lifetime of the WebSocket connection
  3. VertxWebsocketSpanDecorator: Custom span decorator for vertx-websocket

    • Collects span contexts from target WebSocket peers (Producer)
    • Supports multiple span links (sendToAll scenarios)
    • Uses reflection to avoid component dependencies
  4. OpenTelemetryTracer: Create span links from collected contexts

    • Extract span contexts from exchange headers
    • Support both direct SpanContext objects and serialized format
    • Add links to spans during creation
  5. VertxWebsocketConstants: Add HANDSHAKE_SPAN_CONTEXT_KEY constant

Benefits:

  • Complete distributed tracing across HTTP and WebSocket boundaries
  • Zero compile-time dependencies between components
  • Supports both single and multiple span links

Related to: apache/camel-quarkus#8280

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

This commit enables WebSocket message spans to be linked back to their
originating HTTP upgrade request spans using OpenTelemetry span links.

Key changes:

1. VertxWebsocketHost: Capture HTTP upgrade span context using reflection
   - Avoids compile-time dependency on OpenTelemetry
   - Stores span context in RoutingContext during WebSocket upgrade

2. VertxWebsocketPeer: Store handshake span context
   - New field to hold the HTTP upgrade span context
   - Persists for the lifetime of the WebSocket connection

3. VertxWebsocketSpanDecorator: Custom span decorator for vertx-websocket
   - Collects span contexts from target WebSocket peers (Producer)
   - Supports multiple span links (sendToAll scenarios)
   - Uses reflection to avoid component dependencies

4. OpenTelemetryTracer: Create span links from collected contexts
   - Extract span contexts from exchange headers
   - Support both direct SpanContext objects and serialized format
   - Add links to spans during creation

5. VertxWebsocketConstants: Add HANDSHAKE_SPAN_CONTEXT_KEY constant

Benefits:
- Complete distributed tracing across HTTP and WebSocket boundaries
- Zero compile-time dependencies between components
- Supports both single and multiple span links

Related to: camel-quarkus issue apache#8280

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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