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>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant